Use script to get the page number of an event

NeptuneTron

The Salticid Scholar of the North
Member
Joined
Jan 13, 2018
Messages
24
Reaction score
11
First Language
English
Primarily Uses
RMMV
I want to be able to call a script to find the current page that an event is on, and move it to a variable. Does anyone have any idea how to do this?

If you could write out the script and also include an explanation, that would be extremely helpful. I'm pretty new to some of this scripting stuff, but I have some background in coding, so seeing the code is usually the most helpful way for me to learn stuff about scripting.

Thanks in advance!
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,696
Reaction score
556
First Language
Dutch
Primarily Uses
RMMV
what is the reason to know its page number?
On clever way is to make a variable page.
on the beginning of the events/npc's run variable page = Nr
Nr of the page number its on.

but if you can tell for which purpose you need for, coders might be able to help you
on that specific plugin on page number.
 

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
165
First Language
English
Primarily Uses
RMMV
NeptuneTron!
The page index is stored in $gameMap.event(id)._pageIndex
$gameMap is the map object, event(id) is a function that returns the event object, and then ._pageIndex is the variable that stores the page number.

So if you want to know the variable of event 1 you want to set a variable to $gameMap.event(1)._pageIndex

But for your purposes we can set a variable to
$gameMap.event(this.eventId())._pageIndex

The most makery way of doing that is using control variables, the operand script and just ploppin' in $gameMap.event(this.eventId())._pageIndex there ;)

You could alternatively use the script call
JavaScript:
$gameVariables.setValue(2, $gameMap.event(this.eventId())._pageIndex)
That sets variable 2 to the event's page number :')
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Playtesting for Battle Castle is done, demo time for me was roughly 6 hours and 20 minutes. I'm going to pass it on to a few friends first, and after getting some feedback will be posting an official topic.
There's another Humble Bundle available now for RPG developer assets, this time focused somewhat more towards pixel art style games.
Ive got a long lost half uncle. Thats real cool.
I forget what is bumping rule in this forum. Is anyone know? Thank you.
BCj
Ew, why does my blogpost on the rpgmaker.net site look like a garbled mess? Are html codes disabled or something?

Forum statistics

Threads
97,909
Messages
947,780
Members
129,148
Latest member
lemminace
Top