As the title says, I am looking for a way to pass a dynamic variable to $game_map.events[] so I can use it in a condition with changing event_ids.
The point is that I have multiple "enemy events" which can be killed if they touch another event which has to be activated by the player. A trap basically. If the player activates the trap event, the event_id is passed to a variable. If the enemy is near the trap (that part already works), it should check, if the event_id of the trap is the activated one, which was passed to the variable earlier.
This is the code I would use in a conditional branch, on the "enemy event" as a script, but I couldnt find a way to pass a variable:
$game_map.events[event_id].x - $game_map.events[My_Variable].x + $game_map.events[event_id].y - $game_map.events[My_Variable].y <= 1
Any idea?
Hope thats the right place, I am new to the forum...
$game_map.events[My_Variable] not a static event id
● ARCHIVED · READ-ONLY
-
-
why don't you use the event variables?
$game_variables[id] where ID is the number of the general variable - that way you can even use the control variable command to set or check which event is currently triggered. -
How would I use them in the context of a condition? Because something like this:why don't you use the event variables?
$game_variables[id] where ID is the number of the general variable - that way you can even use the control variable command to set or check which event is currently triggered.
MyEventId = $game_variables[21]
$game_map.events[MyEventId].x <= 1
doesnt seem to work in a conditional branch :( -
Of course not - you have only a single script line for the conditional branches.That means thatHow would I use them in the context of a condition? Because something like this:
MyEventId = $game_variables[21]
$game_map.events[MyEventId].x <= 1
doesnt seem to work in a conditional branch :(
$game_map.events[$game_variables[21]].x <=1does work in a conditional branch.Edit:
You need to make sure that the event ID stored in the variable does exist on that specific map however, all maps have their own list of events... -
That worked. Thanks! Didnt come to my mind to write the variable definition directly in the event -.-
-
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.