Making a variable clear after battle?

Status
Not open for further replies.

Conross2479

The Professional Cynic.
Member
Joined
Jan 9, 2013
Messages
25
Reaction score
0
First Language
English
Primarily Uses
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?
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
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:

Conross2479

The Professional Cynic.
Member
Joined
Jan 9, 2013
Messages
25
Reaction score
0
First Language
English
Primarily Uses
Sweet. I was considering using an autorun or parallel process common event, but it would have probably wiped the variable during the battle.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Sweet. I was considering using an autorun or parallel process common event, but it would have probably wiped the variable during the battle.
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.
 

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
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:

Sorakun555

Warper
Member
Joined
Dec 15, 2015
Messages
4
Reaction score
0
First Language
English
Primarily Uses
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:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top