Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: legacyblade on January 02, 2009, 12:50:53 pm

Title: [RESOLVED] Checking event names
Post by: legacyblade on January 02, 2009, 12:50:53 pm
Hey, I'm making a script based on an event system by Reives. It's for arcade style minigames. Anyways, I decided that the way for configuration that would work best is the blizzABS method of naming events. I searched through the bABS code, and can't figure out how to do what I want to. I'm making a Map_Enemy class (just like bABS). The only difference will be that the event has health. Anyways, you make one of these map enemies by naming the event "\e[Health] " where Health is the number of hits it takes to kill them. Any suggestions on how to do this?
Title: Re: Checking event names
Post by: Blizzard on January 03, 2009, 07:24:03 am
Game_Event contains a variables named @event which contains an instance of RPG::Event. RPG::Event has an instance variable called @name. That's the one you are looking for. I usually check all the names at map entry and replace the Game_Event instances with my Map_Enemy instances or other classes according to the given name.
Title: Re: Checking event names
Post by: legacyblade on January 03, 2009, 02:02:46 pm
Ok, but what contains all the events on the map? I'm figuring it's game_map, but I haven't been able to figure out the syntax. I want it to do something like this


map_events.each {|event| #loop through all the events on the map (not sure where they're stored)
#check to see if the event's name is an enemy (\e[health] where health is a number)
#If so, change it to the map_retroEnemy class, and pass it what's contained between the brackets of the name


I'd also like the event to keep it's current move route, graphics, and other event settings (like stop animation, always on top, ect). I'm not sure how to do any of this. I tried looking through the bABS code, but it's hard for me to figure out exactly what's going on.
Title: Re: Checking event names
Post by: Blizzard on January 03, 2009, 02:12:11 pm
$game_map.events.values

This will return an array of all Game_Event instances. "$game_map.events" itself is hash with the event IDs as key.
Title: Re: Checking event names
Post by: legacyblade on January 03, 2009, 04:12:15 pm
Alright, that's really helpful. I'll keep messing around with the script, and I can probably get it to work now. Thanks blizz.