How to make new events by script?

Tushin

Warper
Member
Joined
Oct 3, 2018
Messages
1
Reaction score
0
First Language
Portuguese
Primarily Uses
RMMV
I can use a pre-defined event (I can see here), using:
>> $gameMap.event(EventID, EventPage).start();

I can re-use event using, but it is not working:
>> var event = $gameMap.event(EventID, EventPage)
>> event.start();



However, I could not re-use it after changing map or returning for it. Other problem occurring when I using, but it is not working:
>> var event = new Game_Event(MapID, EventID)
>> event.start()


I saw which variables are controlling:
._starting
._locked



If anyone has any idea...
 
Last edited:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,278
Reaction score
508
First Language
indonesian
I can use a pre-defined event (I can see here), using:
>> $gameMap.event(EventID, EventPage).start();

I can re-use event using, but it is not working:
>> var event = $gameMap.event(EventID, EventPage)
>> event.start();



However, I could not re-use it after changing map or returning for it. Other problem occurring when I using, but it is not working:
>> var event = new Game_Event(MapID, EventID)
>> event.start()


I saw which variables are controlling:
._starting
._locked



If anyone has any idea...
i think it because $gameMap is only storing ONE map(current one) only...

and everytime you change map... it will 'remove' the current data and 'load' next map data from editor...

so when you're adding your custom event in a map... when changing map it will be 'erased'... and when back to that map again it will load the 'default' map data which your custom event did not exist...

to solve this you need plugins that can save the map data to something (some easy alternative is $gameSystem because it saved in savefile).... then when loading map... do some check... if there's saved mapdata... use that instead loading from editor... if not... load from editor.

hope this help...
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,773
Reaction score
938
First Language
Chinese
Primarily Uses
N/A
I'd suggest a slightly different approach:
1. Whenever you create a custom event, save its json contents(including the list of id of map having that event) in $gameSystem
2. Add those json contents to $dataMap having the map wanting to use that event
3. You can ensure the uniqueness of the events by their id and/or names, so you can avoid adding duplicate events and/or overwriting existing events(no 2 different events among any map should have the same id and name)
4. Upon loading the save file, load all event json contents in $gameSystem into $dataMap if the map it's storing should have those events
That way, you don't have to store the whole map into save files, which prevents the save file from being too big(> 50000 bytes)
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,278
Reaction score
508
First Language
indonesian
I'd suggest a slightly different approach:
1. Whenever you create a custom event, save its json contents(including the list of id of map having that event) in $gameSystem
2. Add those json contents to $dataMap having the map wanting to use that event
3. You can ensure the uniqueness of the events by their id and/or names, so you can avoid adding duplicate events and/or overwriting existing events(no 2 different events among any map should have the same id and name)
4. Upon loading the save file, load all event json contents in $gameSystem into $dataMap if the map it's storing should have those events
That way, you don't have to store the whole map into save files, which prevents the save file from being too big(> 50000 bytes)
yeah i got that big save file too big problem in my MV plugins that save map. (2mb and it's only because i limit the map that can create custom event)...
maybe when i convert it to MZ later i might change to that concept (only saving extra event). but the downside is we cannot Delete the real existing event... cause it will be reloaded when reenter map... maybe need some extra object container that store deleted 'real' map event...

so the concept will be when entering a map...
1. load real map event of that map
2. delete real map event that included in deleted event object container.
3. merge with custom event of that map

then when deleting event also check do the deleted event is custom event or not. if yes delete the object that store custom event directly. if not add the deleted event to the deleted event object container...
 

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

Latest Threads

Latest Profile Posts

Do you have an audio you want me to animate? If so send me the youtube link and I’ll animate it.
Okay, so I'm working on Draft 2 of my game's script.
Will try to keep you guys posted, if you're interested!

This is vid of my new game, Crystalgazers. A demo is available on my Gamejolt

I just thought of the best achievement for my game: "'I Didn't Know You Were a Developer!' Find and enter one or more dev room(s)."
I made this animation to apply to a job, what do you think?

Forum statistics

Threads
105,590
Messages
1,014,837
Members
137,253
Latest member
Koshibari
Top