The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: wiiman on May 16, 2007, 02:09:41 AM

Title: [RESOLVED] 10% sp recovery at the end of battle script
Post by: wiiman on May 16, 2007, 02:09:41 AM
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
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: bulls84 on May 16, 2007, 02:15:42 AM
That sounds very interesting, I would also perhaps like that to happen in my game. I'll try and figure this out.
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: Falcon on May 16, 2007, 02:18:51 AM
Sounds simple, I'll do this tomorrow if no one else beats me to this.
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: Sthrattoff on May 16, 2007, 04:10:07 AM

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...
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: Shinami on May 16, 2007, 04:15:47 AM
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
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: Sthrattoff on May 16, 2007, 04:45:46 AM
Ok, guess the problem solved.
Thank for helping, Shinami.
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: Shinami on May 16, 2007, 05:40:21 AM
Always a pleasure, never a chore.
Title: Re: [Request] 10% sp recovery at the end of battle script
Post by: wiiman on May 23, 2007, 12:11:21 AM
thx everybody, the script works great. thx to all.
Title: Re: [Resolved] 10% sp recovery at the end of battle script
Post by: Kokowam on May 23, 2007, 12:28:16 AM
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)