[VX ACE] $GAME_MAP.EVENTS[X] AND EVENT ID
Posts
Pages:
1
So I'm working on a little mission that involves NPCs firing projectiles. I have a a custom script on the bullet to better detect collision, so if the bullet enters the same space as the player, he takes damage. The script I'm calling (as a conditional branch) is:
Now the weird thing is that game_map.events numbers that I have to use don't seem to make any logical sense! After a little trial and error, I figured out that if I used a # that was 2 higher than the actual event_id of the bullet event, it would work. So for Event ID:012, I put in this and it worked.Weird, but I figured, maybe it reserves the first few for something else. No big deal.
However, after creating some other events on the map, I went to make another bullet. This one was Event ID:034... so based on my logic from earlier I should put this in right?Wrong! Using this triggers Event ID:030 on the other side of the map. And this one triggers Event ID:032. Better yet, this last one crashes the whole game! "Invalid octal digit."
Anyone ever get wonky results like this? Is the Event ID:# at the top of the event window not the same as the event_id? Is there a reason these numbers seem to be jumping all over the place? Or am I experiencing some weird kind of bug? Thanks!
(Edited to add code brackets)
$game_player.x == $game_map.events[014].x and $game_player.y == $game_map.events[014].y
Now the weird thing is that game_map.events numbers that I have to use don't seem to make any logical sense! After a little trial and error, I figured out that if I used a # that was 2 higher than the actual event_id of the bullet event, it would work. So for Event ID:012, I put in this and it worked.
$game_map.events[014]]
However, after creating some other events on the map, I went to make another bullet. This one was Event ID:034... so based on my logic from earlier I should put this in right?
$game_map.events[036]
$game_map.events[036]
$game_map.events[040]
$game_map.events[039]
Anyone ever get wonky results like this? Is the Event ID:# at the top of the event window not the same as the event_id? Is there a reason these numbers seem to be jumping all over the place? Or am I experiencing some weird kind of bug? Thanks!
(Edited to add code brackets)
The event number should be the same as the ID, but be sure you don't add the leading zero. That could be why it thinks it's octal, and why it seems to be pointing at random events on the map.
Disclaimer: your square bracket stuff isn't showing up (putting it inside a Code block should work), so I'm using my imagination as to whether that's what happened.
Disclaimer: your square bracket stuff isn't showing up (putting it inside a Code block should work), so I'm using my imagination as to whether that's what happened.
Thank you Deltree! It works now! You were right about the leading zero throwing everything off. Weird that that's all it was, but I'm glad I don't have to keep track of all these different numbers in my head anymore. ...And this is why I generally stick to art and design instead of programming... such a minor detail can break your whole game! :p
(Also nice job deciphering the problem without being able to read the numbers in the brackets. I fixed it so if anyone ever has the same problem and stumbles upon this topic, they can see what I was trying to say.)
(Also nice job deciphering the problem without being able to read the numbers in the brackets. I fixed it so if anyone ever has the same problem and stumbles upon this topic, they can see what I was trying to say.)
Pages:
1














