Hello, I'm wondering if there's a way to place an event at the location of a player's death. I have a script that replaces game overs with common events, and I'm looking to emulate a Dark Souls style of 'soul retrieval'.
Placing an Event at Death Spot
RPG Maker VXAce SupportYou can set a couple of variables to be equal to the player's X and Y coordinates, then use the Set Event Location command to move your event to a location based on the values on those variables. This can likely be done within your game over comment event.
What Rinobi said. Or, if your player is still at the death spot, you can do a simple script call:
$game_map.events[EVENTID].moveto($game_player.x,$game_player.y)
just replace EVENTID with the ID of the event you want to move there.
$game_map.events[EVENTID].moveto($game_player.x,$game_player.y)
just replace EVENTID with the ID of the event you want to move there.
Hrm... the only problem with that is that you would need a "Death event" on every map you could possibly die on. And if you wanted multiple death events on one map, you would need to make extras :\
You could try to "create" a new event using some scripts. It might look something like this (I just made the "add_new_event" command up):
name = "you died"x = $game_player.xy = $game_player.y$game_map.add_new_event(name, x, y)I was trying to create an event by just working with the raw code, but it wasn't easy nor effective... 🙁
You could try to "create" a new event using some scripts. It might look something like this (I just made the "add_new_event" command up):
name = "you died"x = $game_player.xy = $game_player.y$game_map.add_new_event(name, x, y)I was trying to create an event by just working with the raw code, but it wasn't easy nor effective... 🙁
There was an event spawn script somewhere, i just forgot where 🙁 Basically, you would have your death event on a seperate map (that the player can never enter) and clone it onto the map the player died in.
It really depends what he wants to do with the event. If it's just a cutscene, you can easily do everything without moving the event and just changing the graphic of the player, etc. If you can provide details of what you're trying to do, there are probably easier alternatives than to rely on a spawn script. If you absolutely need to spawn an event, you can do it without a script if this is the only instance you need it. I'll post that later if necessary~
What I'm looking for is an event that spawns in place of your death, such as a hexagram, that you can activate later. The problem is that saving is deactivated except at certain save points, and I need to spawn the event at that exact location for me to activate later. Since it's inspired by Dark Souls, I can't have multiple death spots at once, instead, I need to replace the older location with the most recent one.
Also, is there any way that gold can be 'dropped' at the death point to be picked up later using variables? I assume that I have to store the amount of gold in a variable, then remove all gold from the player's inventory, with the 'dropped' gold variable set at the death point to be activated and regained.
Also, is there any way that gold can be 'dropped' at the death point to be picked up later using variables? I assume that I have to store the amount of gold in a variable, then remove all gold from the player's inventory, with the 'dropped' gold variable set at the death point to be activated and regained.
You have multiple options. One would be to have two events on each map, the Death Spot, and the dropped gold. The second would be to spawn the event on the map when the player dies.
Either way, you will need to have another event on each map that starts up whenever the player enters the map to make sure it places the death spot and dropped gold. If you don't have an autorun or parallel process that does this on your maps, you'll have to make it.
You'll also need 6 variables (or 3 if you want to use script calls to randomize the gold location near the death spot)
NOTE: If you're advanced enough, you can use a single variable as an array and utilize script calls, but I'm assuming that's not the case here.
Var[1] = Map ID
Var[2] = Player Death X
Var[3] = Player Death Y
Var[4] = Player Death X (for gold)
Var[5] = Player Death Y (for gold)
Var[6] = Gold amount
The vars are self explanatory. When the player dies, you set each variable to the Map ID, the Player X, and Player Y, respectively.
For Var 4 and 5, you can then add a random amount -1 to 1 for both, to randomize the location in a 3x3 radius around the death spot.
Var 6 you'd set the gold amount however you want.
Autorun or Parallel Process in each map:
Conditional Branch if Var[1] == @Map_id (this checks to see if the current map is where the death location is now)
Set Event Location Death Event to first 3 variables.
Set Event Location Gold to var[1] map, var[4] x and var[5] y (or you can use a script call to randomize its location and avoid var 4/5 entirely)
end
Erase Event
Above, you can replace those set event locations with a spawn event script call instead. IF you want that, let me know.
If you want the death event to be removed completely and deactivated, just erase the event, and change all the vars to 0.
Either way, you will need to have another event on each map that starts up whenever the player enters the map to make sure it places the death spot and dropped gold. If you don't have an autorun or parallel process that does this on your maps, you'll have to make it.
You'll also need 6 variables (or 3 if you want to use script calls to randomize the gold location near the death spot)
NOTE: If you're advanced enough, you can use a single variable as an array and utilize script calls, but I'm assuming that's not the case here.
Var[1] = Map ID
Var[2] = Player Death X
Var[3] = Player Death Y
Var[4] = Player Death X (for gold)
Var[5] = Player Death Y (for gold)
Var[6] = Gold amount
The vars are self explanatory. When the player dies, you set each variable to the Map ID, the Player X, and Player Y, respectively.
For Var 4 and 5, you can then add a random amount -1 to 1 for both, to randomize the location in a 3x3 radius around the death spot.
Var 6 you'd set the gold amount however you want.
Autorun or Parallel Process in each map:
Conditional Branch if Var[1] == @Map_id (this checks to see if the current map is where the death location is now)
Set Event Location Death Event to first 3 variables.
Set Event Location Gold to var[1] map, var[4] x and var[5] y (or you can use a script call to randomize its location and avoid var 4/5 entirely)
end
Erase Event
Above, you can replace those set event locations with a spawn event script call instead. IF you want that, let me know.
If you want the death event to be removed completely and deactivated, just erase the event, and change all the vars to 0.
Original thread: https://forums.rpgmakerweb.com/threads/placing-an-event-at-death-spot.39526/