- Joined
- Aug 22, 2022
- Messages
- 11
- Reaction score
- 4
- First Language
- French
- Primarily Uses
- RMVXA
Hi everyone,
I try to track if the player is facing an event right next to him, in which case I activate a switch.
I managed to do that with a complicated condition tree, however I wanted to try an easier way as I'll use it all over my game.
So I tried with a script:
p = $game_player; e = $game_map.events[6]
$game_switches[21] = false
rx = (e.x - p.x)
ry = (e.y - p.y)
case p.direction
when 2; $game_switches[21] = true if rx = 0 && ry = 1
when 4; $game_switches[21] = true if rx = -1 && ry = 0
when 6; $game_switches[21] = true if rx = 1 && ry = 0
when 8; $game_switches[21] = true if rx = 0 && ry = -1
end
It doesn't work. The switch is permanently on, wherever my character is.
For info, the above mentioned script is added to an event on the map, as parallel process.
Does someone know what should be tweaked there?
I try to track if the player is facing an event right next to him, in which case I activate a switch.
I managed to do that with a complicated condition tree, however I wanted to try an easier way as I'll use it all over my game.
So I tried with a script:
p = $game_player; e = $game_map.events[6]
$game_switches[21] = false
rx = (e.x - p.x)
ry = (e.y - p.y)
case p.direction
when 2; $game_switches[21] = true if rx = 0 && ry = 1
when 4; $game_switches[21] = true if rx = -1 && ry = 0
when 6; $game_switches[21] = true if rx = 1 && ry = 0
when 8; $game_switches[21] = true if rx = 0 && ry = -1
end
It doesn't work. The switch is permanently on, wherever my character is.
For info, the above mentioned script is added to an event on the map, as parallel process.
Does someone know what should be tweaked there?