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.

[RMXP] A quick question...

Hey all, um, I have a quick question.
I've used RPG Maker 2003 for a LONG time and I decided that I would go back to my roots and use eventing to get a battle system together. However, I hit a brick wall. Now there's no "Store Event ID", which is a huge inconvenience. :sad:

If anyone can help me to figure out a way to use "Store Event ID" in XP, it would be GREATLY appreciated. Thanks!
 
I don't have access to RMXP at the moment, but I'm thinking there's a something for that in "Change Variables"
Near the bottom, there's a drop box in the dialog. There's a few options in there. If it's not in there, you'll have to see if they have a script for it somewhere...

Sorry I can't do anything more to help!
-abreaction
 
okay, its quite annoying to explain but i'll try.

for example, i have 5 enemies. i want it to track the hero X/Y coordinates and depending on which enemy is inside the hero attack range, it saves the event id to a variable so that i can use that variable to turn on the switch corresponding to the enemy in the range. like this:

-enemy 1 is event 0001.
-after confirming that its in range, save that to event id variable.
-use the event id variable to turn on the switch for damage to enemy 1.

i tried to automate as much of the system as possible, i didnt really want to set enemyX/Y for like, 20 enemies but without the store event id command, its proving difficult.

hope it helps :)
 
I... have no idea where you're going with that.
But I believe you can save the event's ID to a variable with Call Script. I can try, but this will prove pretty difficult. You may want to put up a topic in the Script Support forum for this.
 
Um this isn't very clean, but works. First you have to paste
Code:
attr_reader  :event_id
right under "class Interpreter" in the Interpreter 1 script page.

Then, a "Script..." command in an event with:
Code:
$game_system.map_interpreter.event_id

...would give you that event's ID, but there's either not enough room to do anything with it in that little tiny window, or I just don't know the extra syntax to make the same line go to multiple ones.

Anyway, if you want to store it to a variable, this is ugly, but it fits and gets the job done:

Code:
a = $game_system.map_interpreter

$game_variables[12] = a.event_id

That would store that event's id to variable 12, and fits in that miniscule window.

Also, it takes off the zeroes, so EV0007 would just put 7 in the variable.
 
Building off of what Dustin said...
add this to Interpreter 1, somwhere below "class Interpreter":
Code:
 def get_event_id(var)

    @var = var

    a = $game_system.map_interpreter

$game_variables[var] = a.event_id

end

And then when you call the script, all you have to do is use this line to call the snippet I gave you, and set the event's id to the variable you put in the parenthesis:
get_event_id(variable)

EDIT: You'll have to add the " attr_reader :event_id" like Dustin said

EDIT #2: added the ability to set which variable to save it to. ;)
 
Thanks a lot you guys, you have no idea how much it will help me out. :)
Only thing now is that I want to be able to use the variable to turn on a switch. For example,

variable = 10
the variable then turns on switch 10.

Thanks again!
 
Replace the snippet I just gave you with this:
Code:
  def get_event_id(var)

    @var = var

    a = $game_system.map_interpreter

$game_variables[var] = a.event_id

$game_switches[a.event_id] = true

end

Note that you'll have to manually batch process all the switches if you want to turn them all off. My snippet doesn't turn any switches off for you.

Do you want an off-set for your switches. As in, rather than the switches start at switch1, they start at switch10? I can do that if you'd like.

-abreaction
 
If all you really need is to turn on the switch that cooresponds to the enemy's id, then this is all you need to do that, still including the "attr_reader :event_id" line:

Code:
 

def enemy_switch_on

    $game_switches[$game_system.map_interpreter.event_id] = true

end

 

Then you'd just have to write "enemy_switch_on" in the Script... command.

I had a system a lot like this with separate variables and switches for 10 different monsters that could be on a map. I had to remember to turn off all of the switches and reset the x and y coords every time the hero left that map, so keep that in mind.
 

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