Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] 10% sp recovery at the end of battle script

Started by wiiman, May 16, 2007, 02:09:41 AM

0 Members and 1 Guest are viewing this topic.

wiiman

does anyone have a script that at the end of every battle, a certain percentage of your sp is recovered? Like in Tales of Symphonia, thanks in advance

bulls84

That sounds very interesting, I would also perhaps like that to happen in my game. I'll try and figure this out.

Falcon

Sounds simple, I'll do this tomorrow if no one else beats me to this.

Sthrattoff


class Auto_Recover

  def main
    for i in 0..3
      max = $game_party.actors[i].maxsp
      now = $game_party.actors[i].sp
      now = now + (max/10)
    end
  end

end


I don't know it works or not ('coz I didn't use RGSS for a long time) but that's the concept. And it's still need an identifier that make sure that this script ONLY works when you won a battle...
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Shinami

Nets, Falcon, sorry! As with all of my scripts, if you have a question on how I did something then just ask and I'll respond. Also, dead actor's will not regain SP at the end of battle.

class Scene_Battle
 
  alias shinami_start_phase5 start_phase5
  def start_phase5
    for i in 0...$game_party.actors.size
      unless $game_party.actors[i].dead?
        sp_regain = $game_party.actors[i].maxsp * 0.1
        $game_party.actors[i].sp += sp_regain.to_i
      end#of "unless $game_party.actors[i].dead?"
    end#of "for i in 0...$game_party.actors.size"
    shinami_start_phase5
  end#of aliased "def start_phase5"
end#of class Scene_Battle

Sthrattoff

Ok, guess the problem solved.
Thank for helping, Shinami.
Symphony of Alderra : Memoirs of Life

Storyline : 200% (Overimaginatives)
Scripting : 100% (At last...)
Eventing  : 100%
Mapping   : 0.125%

Shinami


wiiman

thx everybody, the script works great. thx to all.

Kokowam

Add [Resolved] to the topic title to help others and do it by editing the title of your first post. ;D

@Shinami: How are things going in life? Syntax book? (Sorry to sound a bit self-centered T_T)