Changing Event Graphic on Specific Page through Script Call?

Markholla

Villager
Member
Joined
Sep 24, 2013
Messages
10
Reaction score
1
First Language
English
Primarily Uses
Is there a way to change event graphic on a specific page through Script Call?

I am dynamically creating events which randomize the Event Graphic. Issue is when Self Switch Activates and the Page changes, his graphic changes too. I am using Mog Event Sensor to activate self switch D.

2.png1.png
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,143
Reaction score
12,416
First Language
English
Primarily Uses
RMMV
If you just use the provided commands, it will only change the image on the active page, and when you change variables, switches, self switches, etc and it activates a new page the image will be reset. But if you go to the source, where it's pulling the page data from, and change it there, then it should stay that way for that page, as long as you're on the map. If you leave the map and return later, obviously, it will be reset to what you saved in the editor. If you want the change to stick, you're going to have to start looking at plugins to include this stuff with the save data.

If you want to change the image on page 5 (remembering that arrays start at 0 so the index will be 4), I think it would be something like this (in a script call):

Code:
var img = $dataMap.events[this.eventId()].pages[4].image;
img.characterName = "Actor1";
img.characterIndex = 0;
 

Markholla

Villager
Member
Joined
Sep 24, 2013
Messages
10
Reaction score
1
First Language
English
Primarily Uses
1585995785851.png

I tried your code, which gives me this. It could be possible as I am spawning events from other map using Galv's Event Spawner, the specific event doesnt have a proper ID.

I first tried it on the parallel process of the spawned event, which gave me this message. I then tried it on the spawner itself, which gave me the same message.
1585996009463.png
1585996032577.png

EDIT: I realised my code was wrong. Ive changed it according to @Shaz .
Still the black screen though :C
1585996482162.png
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,143
Reaction score
12,416
First Language
English
Primarily Uses
RMMV
It could be possible as I am spawning events from other map using Galv's Event Spawner, the specific event doesnt have a proper ID
It probably will have an id by the time it's spawned, but it probably won't be in $dataMap. It depends on what the event spawner plugin does. If it has the source map permanently loaded, there might be a way to refer to it, but in that case, it probably WILL continue from map to map, at least until you close the game.
 

Markholla

Villager
Member
Joined
Sep 24, 2013
Messages
10
Reaction score
1
First Language
English
Primarily Uses
It does have an ID. Can't we acess event's pages from $gameMap?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

A mousefolk sprite I made, I think I did good.
Discovering math. functions for damage formulas was one of the greatest things for me.
It's very useful for balancing skills to work in a variety of possible circumstances.
For example if you have a skill that is supposed to work for both mages and warriors:
Code:
Math.max(a.atk * 2 - b.def, a.mat * 2 - b.mdf)
SpaceX: First-ever successful (manned) commercial spaceflight!! In these terrible and self-sabotaging times for the world, that's a ray of excitement and hope I needed badly.
GameDevJohn wrote on whtdragon's profile.
Hey I used you bunny and cat spritesheet for a game jam game. Thanks so much! You have really beautiful stuff here. I'll credit you at https://gamedevjohn.itch.io/bunny-boy

Forum statistics

Threads
98,017
Messages
948,571
Members
129,276
Latest member
abhikhurana
Top