Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RESOLVED]Creating a new event on a map using call script...

Haki

Member

Here's the problem.

I tried to create a new event on a map using call script. I found out it could be done but it's very hard. Instead I tried just to duplicate an existing event and change it's location. I created two events. The first had only a message command and said "BLAH" and the graphic was "001-Fighter01. The second had the graphic "010-Lancer02" and it looked like this:
Code:
@>Call Script:ev = $game_map.events
              new_ev = Game_Event.new($game_map.map_id,ev[1].event)
              ev[ev.size + 1] = new_ev
              ev[ev.size].event.x = 0

This actually duplicates the commands but not the graphic. There was nothing there but when I tried to walk over the tile where the new event was supposed to be I couldn't walk over it and when I pressed enter it said "BLAH". I couldn't figure out why there's no graphic and I would appreciate if someone could tell me why's this happening.
 
Well, I don't have RMXP open right now, but I guess you would have to set the page graphic and passability yourself. To do it, all you have to do is:

Code:
new_ev.page.graphic = "010-Lancer02"
new_ev.through = true

That should fix the problem, but then again, I haven't tested it...
 
be careful because $game_map.events is a hash and not an array, and you could have situations in which its contents have keys 2 3 and 4, its size is 3, size+1 is 4 and you overwrite the event 4.

EDIT: you need to use something a little more elaborated that looks for the first unused id
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top