coyotecraft
Sponsor
Save Points
In RMXP it was common for save points to appear as crystals or maybe a book. All they needed was an action button trigger to open the save screen. But since RMVX and VXACE it has became possible to place event graphics under the player character. This was only possible in RMXP if the event was set "through"; but even then if the graphic was too big it would pop above the player if they were to walk a tile behind it. With the new "below character" option people started using magic circles as save points. It could function with an action button trigger, but it is much more fashionable for the circles to light up and enable saving when the player touched them and then turn off when the player walked away.
Design Issue
However, engineering the save circle to work this way can get tricky. The touch triggers work fine when the player walks onto an event, but they don't work when the player walks off an event. I've seen some pretty messy event systems to work around this. Most of the time I see people using switches and placing extra events around the save circle to determine if a player has walked away.
A better way would use conditional branches to watch for the arrow keys being pressed, which would normally mean the player is walking away. Except this has it's problems when the save circle is placed next to a wall or some solid object; if the player hit an arrow in that direction the circle would turn off while the player is still on it.
Lastly, you could rig a collision detection system by recording the event and player's X and Y positions in in-game variables and comparing them in a couple conditional branchs. But it's a lengthy process to do through the event menu, takes up a lot of variables, and not very efficient since its duplicating data and processing it every moment to check for a collision.
Solution
This can be done all on one event page, but I prefer not to have a parallel process running at all times if it doesn't need to be so it doesn't cause lag. So I have the first event page a deactivated circle graphic and a touch trigger that will turn on self switch A and play a sound effect.
The second event page, with a self switch A = on condition, has the activated circle graphic and a parallel process trigger. We'll use a conditional branch to turn off self switch A and disable saving when the player isn't over the save circle, but as long as the player is on the circle it'll remain active.
How do we do that? We'll use the last option in the conditional branch menu to write a line of script. "Scripting" sounds complicated and hard to understand to some people but this is easy to implement; even if you don't understand coding language you can just copy and paste. For the save circle to work it needs to properly detect the player's position relative to it's own. The X and Y positions for everything already exists within the game's code so all you need to do is compare:
[$game_player.x , $game_player.y] == [$game_map.events[@event_id].x , $game_map.events[@event_id].y]
In English this is asking if the player's x and y position is the same as this event's (the save circle) x and y position. Within the conditional branch you can tell how the event processes each case; stay active while sharing coordinates else turn circle off.
(click to enlarge)
Not only is this method easier to look at. But it works in a way that the event can be copy and pasted where ever and each one will work independently without needing to change anything and can be used for things like a pressure plate that must have someone standing on it or revealing a hidden path by walking under a ceiling tile.
In RMXP it was common for save points to appear as crystals or maybe a book. All they needed was an action button trigger to open the save screen. But since RMVX and VXACE it has became possible to place event graphics under the player character. This was only possible in RMXP if the event was set "through"; but even then if the graphic was too big it would pop above the player if they were to walk a tile behind it. With the new "below character" option people started using magic circles as save points. It could function with an action button trigger, but it is much more fashionable for the circles to light up and enable saving when the player touched them and then turn off when the player walked away.
Design Issue
However, engineering the save circle to work this way can get tricky. The touch triggers work fine when the player walks onto an event, but they don't work when the player walks off an event. I've seen some pretty messy event systems to work around this. Most of the time I see people using switches and placing extra events around the save circle to determine if a player has walked away.
A better way would use conditional branches to watch for the arrow keys being pressed, which would normally mean the player is walking away. Except this has it's problems when the save circle is placed next to a wall or some solid object; if the player hit an arrow in that direction the circle would turn off while the player is still on it.
Lastly, you could rig a collision detection system by recording the event and player's X and Y positions in in-game variables and comparing them in a couple conditional branchs. But it's a lengthy process to do through the event menu, takes up a lot of variables, and not very efficient since its duplicating data and processing it every moment to check for a collision.
Solution
This can be done all on one event page, but I prefer not to have a parallel process running at all times if it doesn't need to be so it doesn't cause lag. So I have the first event page a deactivated circle graphic and a touch trigger that will turn on self switch A and play a sound effect.
The second event page, with a self switch A = on condition, has the activated circle graphic and a parallel process trigger. We'll use a conditional branch to turn off self switch A and disable saving when the player isn't over the save circle, but as long as the player is on the circle it'll remain active.
How do we do that? We'll use the last option in the conditional branch menu to write a line of script. "Scripting" sounds complicated and hard to understand to some people but this is easy to implement; even if you don't understand coding language you can just copy and paste. For the save circle to work it needs to properly detect the player's position relative to it's own. The X and Y positions for everything already exists within the game's code so all you need to do is compare:
[$game_player.x , $game_player.y] == [$game_map.events[@event_id].x , $game_map.events[@event_id].y]
In English this is asking if the player's x and y position is the same as this event's (the save circle) x and y position. Within the conditional branch you can tell how the event processes each case; stay active while sharing coordinates else turn circle off.
(click to enlarge)
Not only is this method easier to look at. But it works in a way that the event can be copy and pasted where ever and each one will work independently without needing to change anything and can be used for things like a pressure plate that must have someone standing on it or revealing a hidden path by walking under a ceiling tile.