[VXA] EVENTS TRIGGERING OTHER EVENTS?
Posts
Pages:
1
So in my game, I am trying to make it so that the player launches a block at an event (out of many), and when that block(which is an event) hits the event, I want the event the block hits to be triggered. I thought the 'Event Touch' condition would work, but that is if the event touches the player. How would I go about doing this? Using X and Y coords may not work because the events are moving around.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
X and Y coordinates will work, and are the simplest method. You'll need to check if the two events are adjacent.
In RM2K3 and RMXP, when an event is in the process of moving and is in between two tiles, its coordinates will give you the tile it's moving to. But in VX, the coordinates might give you the tile it's moving from, or possibly whichever of the two it's closer to, so test that if it matters.
If you're comfortable with some really simple scripting, you can use $game_map.events[eventid].real_x and $game_map.events[eventid].real_y to get the pixel coordinates of an event - just replace eventid with the event's ID. You would use this in a conditional branch of type script, with a line like:
abs($game_map.events[20].real_x - $game_map.events[55].real_x) + abs($game_map.events[20]].real_y - $game_map.events[55].real_y) <= 16
This'll check if event 20 and event 55 are within 16 pixels of each-other, which is half a tile. (This is RMXP script, but I'm assuming it's probably the same in VX Ace. If not, someone will correct me, hopefully.)
In RM2K3 and RMXP, when an event is in the process of moving and is in between two tiles, its coordinates will give you the tile it's moving to. But in VX, the coordinates might give you the tile it's moving from, or possibly whichever of the two it's closer to, so test that if it matters.
If you're comfortable with some really simple scripting, you can use $game_map.events[eventid].real_x and $game_map.events[eventid].real_y to get the pixel coordinates of an event - just replace eventid with the event's ID. You would use this in a conditional branch of type script, with a line like:
abs($game_map.events[20].real_x - $game_map.events[55].real_x) + abs($game_map.events[20]].real_y - $game_map.events[55].real_y) <= 16
This'll check if event 20 and event 55 are within 16 pixels of each-other, which is half a tile. (This is RMXP script, but I'm assuming it's probably the same in VX Ace. If not, someone will correct me, hopefully.)
Thanks LockeZ, I will try that. I use that type of scripting in my projects all of the time.
**I should note that my game is in pixel movement.
**I should note that my game is in pixel movement.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Note: just fixed the script, the [ and ] tags were being killed by the forum.
Alright here is what I got so far in the event page:
Script:
$game_variables[] = ($game_map.events[].x -
$game_map.events[].x)+($game_map.events[].y
-$game_map.events[].y)
# because the conditional branch and set variable commands are a bitch and don't have
# too much space
Cond Branch: Variable [] <= 16
all the junk that the event needs to do
set the event location back
Branch End
My problem is that the abs(x) function isn't preformed that way in ace I think, I am pretty sure it is like .abs . Also, I am pretty sure that real_x and real_y aren't available in ACE, but the .x and .y commands aren't going to work either.
Script:
$game_variables[] = ($game_map.events[].x -
$game_map.events[].x)+($game_map.events[].y
-$game_map.events[].y)
# because the conditional branch and set variable commands are a bitch and don't have
# too much space
Cond Branch: Variable [] <= 16
all the junk that the event needs to do
set the event location back
Branch End
My problem is that the abs(x) function isn't preformed that way in ace I think, I am pretty sure it is like .abs . Also, I am pretty sure that real_x and real_y aren't available in ACE, but the .x and .y commands aren't going to work either.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Haha, you did the same thing in your post that I did the first time, with the brackets. To make a bracket appear in a forum post, you have to type [[] for a left bracket or []] for a right bracket.
But you are correct about the absolute value function, my bad. It's (number).abs, not abs(number).
I'm positive real_x and real_y are variables in Game_Event, but they might not have the same names, or they might not be publically accessible variables. You might have to add lines near the top of Game_Event giving those variables the attr_accessor property (which lets you access them from other scripts).
But you are correct about the absolute value function, my bad. It's (number).abs, not abs(number).
I'm positive real_x and real_y are variables in Game_Event, but they might not have the same names, or they might not be publically accessible variables. You might have to add lines near the top of Game_Event giving those variables the attr_accessor property (which lets you access them from other scripts).
author=LockeZAlright, I willl look into it, I am just going to stick the .abs at the end.
Haha, you did the same thing in your post that I did the first time, with the brackets. To make a bracket appear in a forum post, you have to type [[] for a left bracket or []] for a right bracket.
But you are correct about the absolute value function, my bad. It's (number).abs, not abs(number).
I'm positive real_x and real_y are variables in Game_Event, but they might not have the same names, or they might not be publically accessible variables. You might have to add lines near the top of Game_Event giving those variables the attr_accessor property (which lets you access them from other scripts).
Pages:
1













