[Solved] $var Teleportation upon death

Hello everyone,

I'm new here, but didn't saw any introduction topic so i'm gonna do it quicly here.

My name's Corentin, i'm French, 23 years old and i'm just starting at RPG Maker VX Ace.

I found this pretty awesome website while I was looking for some tips.

So~

I'm attempting to create a unique savepoint system, which allow the player to save one location at the time, in the aim to be used upon death.

Well, seems easy but I don't understand why it's not working like I want to :/.

That's why I'm asking for some advice.

Currently, I'm saving "@x" & "@y" into 2 variables with an event, and I want to use them while the party is dead.

Screenshots:

Spoiler
2b0g.png


9x94.png

Like that, I was sure it will work just fine, but not really..

When my party is dead i got:

Spoiler
5cce.png
So what I'm trying to do seems not featured by the native script

here:

Spoiler
kkis.png





If I use numbers instead of variables it work properly, but this is not what I am looking for.

I've already tried to write it in others ways without any success..

Any idea will be appreciate <(^-^)>

02:00 am here tho.. Good night/day peoples
Issues:

- moveto won't take you to a different map, just the same coordinates on the current map, so if your save point is at 50,50 and the current map is only 25,25, you'll get an error

- var19 and $var19 are not the same - this is what is causing your error - the script is using $var19 which is never set

- @x and @y have no meaning inside a script call. Script is a method of Game_Interpreter, and @x and @y are properties of the event - two different classes. At best, you would need to use $game_map.events[@event_id].x and $game_map.events[@event_id].y instead

However, why not just set three variables (one for the map, two for the position) to store the coordinates instead of using global variables? Then instead of trying to figure out how to do the transfer (because Game_Interpreter does some snazzy stuff with yielding and fading and checking battles), just turn on a switch in your death check, and have a common event conditioned by that switch that does the transfer using those variables, then turns the switch off again.

Savepoint Event:

Code:
Control Variables: [0001: SaveMap] = Game Data > Other > Map IDControl Variables: [0002: Savepoint X] = Game Data > Character > This Event's > Map XControl Variables: [0003: Savepoint Y] = Game Data > Character > This Event's > Map y
Death Script:
Code:
$game_switches[1] = true if $game_party.all_dead
(switch 1 is used here, but put in whatever number is appropriate)
Hi,

moveto won't take you to a different map
I should find out since it's not asking for the Map ID.. But hope sometimes don't make me realize xD

var19 and $var19 are not the same
Aw, I'm glad to learn that. I was thinking "$var" is used to call a variable into a script and this was the same "var" without.

Then instead of trying to figure out how to do the transfer just turn on a switch in your death check
Hope I will be able to search for other ways to do things on my own by the time, you saved me some time.

Savepoint Event [OK]

Done with Hero's > Map X 'cause i don't want to be in a wall ^^

Death Script [OK]

$game_switches[x] = true/false  will be really handfull!

Thanks for your help!
variables are accessed through $game_variables[id]
Ahah, thanks for the tip.

I'm taking all of them.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Re-opened at OP's request.
Hi,
 
Thanks for re-opened it.
 
 
 
Ok then I will make a quick recap here:
 
With Shaz's help, I was able to modify the death result:

 

#--------------------------------------------------------------------------# * Determine if Game Is Over# Transition to the game over screen if the entire party is dead.#--------------------------------------------------------------------------def check_gameover#SceneManager.goto(Scene_Gameover) if $game_party.all_dead?$game_switches[7] = true if $game_party.all_dead?endand of course with a death's event setup wich looks like:

End BGM
End BGS

Print picture death

Wait 120 frames

Teleportation $var

Full heal party

Switch death OFF

Clear picture

_____________

It's ok.

At least when i was testing it with my event board causing death status to my party.

Today I wanted test my fight ability and i discovered that the death event is not call when i lose.

So, here we go:

To start on something I tried to modify the "Scene_Gameover", without any success, the best i got was to be stuck in the battle or black screen..

  #--------------------------------------------------------------------------  # * Transition to Title Screen  #--------------------------------------------------------------------------  def goto_title    #fadeout_all    #SceneManager.goto(Scene_Title)$game_switches[7] = true    endI've put a lot of Scene_Gameover in commentary and try other ways but, na it won't work

2nd round, i found this in "BattleManager":

#--------------------------------------------------------------------------  # * Defeat Processing  #--------------------------------------------------------------------------  def self.process_defeat    $game_message.add(sprintf(Vocab:😀efeat, $game_party.name))    wait_for_message    if @can_lose      revive_battle_members      replay_bgm_and_bgs      SceneManager.return    else      SceneManager.goto(Scene_Gameover)    end    battle_end(2)    return true  endI'v try with @can_lose = true

    if @can_lose      revive_battle_members      $game_switches[7] = true      #replay_bgm_and_bgs      #SceneManager.returnand without:

    else      #SceneManager.goto(Scene_Gameover)      $game_switches[7] = trueor

    else      #SceneManager.goto(Scene_Gameover)      SceneManager.goto(Scene_Base)    end'cause this is where the working rule is..

I've done a lot of dumb try and I'm still wrong , I don't think "Game_Battler" and "Game_BattlerBase" are involved, that's why I ask for an advice if someone got one ^^
I don't understand this:


"At least when i was testing it with my event board causing death status to my party.


Today I wanted test my fight ability and i discovered that the death event is not call when i lose."


What are you actually trying to accomplish? How did you test it previously? When does it work? When doesn't it work?
Umh, I'll post some screen i guess, it will be more easy for me to explain

So, here is my SavePoint Common Event:

Spoiler
k7dj.png

The player will be able to save is position by using a savepoint monument:

Spoiler
9ur1.png

I aim than the player is not eject onto the title screen whenever he die, by a trap OR a fight OR whatever.

 

Then, when i was testing our previous modification, i was using this:

Spoiler
tv5j.png

With this Death Event, it worked just fine. I was guessing it's perfect 'cause there is only one Death state..

But, when i'm game over into a fight, it seems the

  def check_gameover    #SceneManager.goto(Scene_Gameover) if $game_party.all_dead?    $game_switches[7] = true if $game_party.all_dead?  endthan we used is not enought because i'm just eject at the title screen.

Spoiler
Bonus, my beautiful test map !

xtii.png


[EDIT]  here is a quick video to watch if i'm not explaining it right :/

[EDIT2] Finally i made it on my own, i'm proud of me *-*

  #--------------------------------------------------------------------------  # * Defeat Processing  #--------------------------------------------------------------------------  def self.process_defeat    $game_message.add(sprintf(Vocab:😀efeat, $game_party.name))    wait_for_message    if @can_lose      revive_battle_members      replay_bgm_and_bgs      SceneManager.return    #else      #SceneManager.goto(Scene_Gameover)    end    battle_end(2)    #return true    SceneManager.return    $game_switches[7] = true  endThanks for your help

Original thread: https://forums.rpgmakerweb.com/threads/solved-var-teleportation-upon-death.25464/