- Joined
- Aug 7, 2019
- Messages
- 32
- Reaction score
- 10
- First Language
- English
- Primarily Uses
- RMXP
Hi!
I'm currently working on a project using RPG Maker XP in a pretty complicated way. Anyway, I'm trying to create a global event that reads when the player is facing a wall. Is thre anything out there that already does so?
So far the only idea I have is to make a HUGE series of conditional branches in which, for each map, it checks the direction of the player is facing and its coordinates to see if next to a wall, But that is, first of all, insane, and, second, not efficient at all.
Is there any way to interact with the Tile Counters or Tile Terrains using a script maybe to know when I'm adjacent to (not over) them? For example, if I put a wall with a Tile Terrain indicator in 1, then if the player is adjacent to the wall, it would trigger the event.
This is what I have in mid (hope it makes any sense and it's possible):
If Character facing Terrain 1
if Distance between Character and Terrain 1 == 1
Facing Wall Switch = ON
end
else
Facing Wall Switch = OFF
end
If you know how to address terrain tags or counter tags on scripts please elt me know.
If you know a script that does this already please let me know too.
Any help is welcome.
EDIT: Never mind, I think I managed to make a script that does so... I'll put it in the comments in case anyone needs it
EDIT FOR THE SCRIPT:
Usage:
Put in the terrain tab on the tilesets the Tiles you need to be as walls with a terrain number (in this case 1)
When you need it, call the script and check for variables. In this case, the variable 25. When the character is facing a wall, the variable will be set as 1. When not, it will be a 0.
Then, in the event you're calling the scrip, check for the conditions: If Variable 25 = 1, then do something when facing the wall.
It wasnt that hard to make actually. Hope you find it useful.
If you use it in your game, i'd appreciate a mention in the credits
I'm currently working on a project using RPG Maker XP in a pretty complicated way. Anyway, I'm trying to create a global event that reads when the player is facing a wall. Is thre anything out there that already does so?
So far the only idea I have is to make a HUGE series of conditional branches in which, for each map, it checks the direction of the player is facing and its coordinates to see if next to a wall, But that is, first of all, insane, and, second, not efficient at all.
Is there any way to interact with the Tile Counters or Tile Terrains using a script maybe to know when I'm adjacent to (not over) them? For example, if I put a wall with a Tile Terrain indicator in 1, then if the player is adjacent to the wall, it would trigger the event.
This is what I have in mid (hope it makes any sense and it's possible):
If Character facing Terrain 1
if Distance between Character and Terrain 1 == 1
Facing Wall Switch = ON
end
else
Facing Wall Switch = OFF
end
If you know how to address terrain tags or counter tags on scripts please elt me know.
If you know a script that does this already please let me know too.
Any help is welcome.
EDIT: Never mind, I think I managed to make a script that does so... I'll put it in the comments in case anyone needs it
EDIT FOR THE SCRIPT:
class FaceWall
#Script by Sumerian Games
#Call with FaceWall.new
def initialize
if $game_player.direction == 2
viendox = $game_player.x
viendoy = $game_player.y + 1
end
if $game_player.direction == 4
viendox = $game_player.x - 1
viendoy = $game_player.y
end
if $game_player.direction == 6
viendox = $game_player.x + 1
viendoy = $game_player.y
end
if $game_player.direction == 8
viendox = $game_player.x
viendoy = $game_player.y - 1
end
terraintype = $game_map.terrain_tag(viendox, viendoy)
if terraintype == 0 #here the terrain type is the one in the tileset
$game_variables[25] = 0 #change the variable number here
end
if terraintype == 1
$game_variables[25] = 1
end
end
end
#Script by Sumerian Games
#Call with FaceWall.new
def initialize
if $game_player.direction == 2
viendox = $game_player.x
viendoy = $game_player.y + 1
end
if $game_player.direction == 4
viendox = $game_player.x - 1
viendoy = $game_player.y
end
if $game_player.direction == 6
viendox = $game_player.x + 1
viendoy = $game_player.y
end
if $game_player.direction == 8
viendox = $game_player.x
viendoy = $game_player.y - 1
end
terraintype = $game_map.terrain_tag(viendox, viendoy)
if terraintype == 0 #here the terrain type is the one in the tileset
$game_variables[25] = 0 #change the variable number here
end
if terraintype == 1
$game_variables[25] = 1
end
end
end
Usage:
Put in the terrain tab on the tilesets the Tiles you need to be as walls with a terrain number (in this case 1)
When you need it, call the script and check for variables. In this case, the variable 25. When the character is facing a wall, the variable will be set as 1. When not, it will be a 0.
Then, in the event you're calling the scrip, check for the conditions: If Variable 25 = 1, then do something when facing the wall.
It wasnt that hard to make actually. Hope you find it useful.
If you use it in your game, i'd appreciate a mention in the credits
Last edited: