Making a variable clear after battle?

Discussion in 'RPG Maker VX Ace' started by Conross2479, Feb 3, 2014.

Thread Status:
Not open for further replies.
  1. Conross2479

    Conross2479 The Professional Cynic. Member

    Messages:
    25
    Likes Received:
    0
    Location:
    England
    First Language:
    English
    I have an actor with two skills. The first increases the value of a variable. The second deals damage based on the value of said variable and sets it to 0.

    The issue here is that since I'm using variables the stacks carry over after battles, meaning the player could get these stacks to ridiculous levels and oneshot everything.

    Is there a way to make it so the value of the variable is set to 0 after every battle?
     
    #1
  2. kerbonklin

    kerbonklin Hiatus King Veteran

    Messages:
    1,728
    Likes Received:
    281
    First Language:
    English
    Primarily Uses:
    RMMV
    I would recommend a hard-coded variable assign at the end of Battle Processing. Easiest and most simple solution. Let me quickly write it.

    Go to BattleManager, around line 267 and add the line I noted. (Change the variable number)

    Code:
      #--------------------------------------------------------------------------  # * End Battle  #     result : Result (0: Win 1: Escape 2: Lose)  #--------------------------------------------------------------------------  def self.battle_end(result)    @phase = nil    @event_proc.call(result) if @event_proc    $game_party.on_battle_end    $game_troop.on_battle_end    $game_variables[9] = 0       #Add this line and edit accordingly    SceneManager.exit if $BTEST  end
     
    Last edited by a moderator: Feb 3, 2014
    #2
  3. Conross2479

    Conross2479 The Professional Cynic. Member

    Messages:
    25
    Likes Received:
    0
    Location:
    England
    First Language:
    English
    Sweet. I was considering using an autorun or parallel process common event, but it would have probably wiped the variable during the battle.
     
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,695
    Likes Received:
    6,600
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Not with a parallel process, because those are stopped during battlescreen. That's why you could activate the parallel at the beginning of the battle and it only works after the player has returned to the map.
     
    #4
  5. Zoltor

    Zoltor Veteran Veteran

    Messages:
    1,550
    Likes Received:
    210
    First Language:
    English
    You could also make a autorun Common event., you don't "need" to use a script(although if you're gonna have a metric ton of these types of spells, it would probally be easier)

    "Sweet. I was considering using an autorun or parallel process common event, but it would have probably wiped the variable during the battle."

    No Common events can't autorun in battle, I have a similar spell set in my game, and autorun common event doesn't take effect in battle, when turning on the switch, that the autorun event requires(it will only take effect after battle(aka you're back on a map).
     
    Last edited by a moderator: Feb 3, 2014
    #5
  6. Sorakun555

    Sorakun555 Warper Member

    Messages:
    4
    Likes Received:
    0
    Location:
    Washington
    First Language:
    English
    Would anyone mind helping me with this? Because I mean...

    #-------------------------------------------------------------------------- # * End Battle # result : Result (0: Win 1: Escape 2: Lose) #-------------------------------------------------------------------------- def self.battle_end(result) @phase = nil @event_proc.call(result) if @event_proc $game_party.on_battle_end $game_troop.on_battle_end $game_variables[1] = 0 SceneManager.exit if $BTEST endAside from the variable ID it's exactly like above and the variable's value still doesn't reset to 0. Did I somehow put it in wrong? In case it helps, I have some other scripts for a target arrow (Victor's, specifically) but even after removing those to see if maybe somehow that was the issue the value still never went back to 0.

    EDIT: Nevermind, it turns out that's not the issue but something else. Carry on.
     
    Last edited by a moderator: Dec 16, 2015
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,951
    Likes Received:
    11,614
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Sorakun555, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

    Please post your own thread in the correct forum (RGSSx Script Support) and give links to the other scripts you're using.

    I would guess that you are using a script that also uses variable 1 - something like Yami's Overlay script - and you have not configured it or set up your variables based on it.
     
    #7
Thread Status:
Not open for further replies.

Share This Page