Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Question about RMXP SP.

xctive

Member

Is there a way to make it so the SP just slowly recovers like say diablos mana.
Edit: i would like to do it in out side of battle and inside of battle a % recoverd after earch turn.
 
I'm not familiar with the game you're referencing; do you want this to happen in or out of battle? It can be done either way;

Out of battle:

Add a method to game party

Code:
def reg_sp

   @waiter += 1

   if @waiter == m

      for actor in @actors

         actor.sp += (k * actor.max_sp)/100

         actor.sp = [actor.sp, actor.max_sp].min

      end

      @waiter = 0

    end

end

k is the percent of sp to gen back.
m is how many frames you get this percent back

Finally,
under initialize in $game_party add @waiter = 0
and towards the bottom of the update loop in $scene_map add $game_party.reg_sp.

Doing this in battle is pretty much the same, but I'm guessing that it's for the map.
If you do want this for battle, I can help you if you want:)
 

xctive

Member

Phoenixia im not used to editing the script if you could be a little more specific do i just paste that code in game party? Also i cant find $game_party to add the @waiter = 0. If you could help me that would be great.
 

xctive

Member

ok Phoenixia thank you i figured it out how to get it out of battle now and it works great. If you could help me do it in battle after each turn that would be awsome. Thank you. :smile:
 
xctive":dlp215us said:
you make a good point Unka Josh about that how would i go about just say adding a % to SP after each turn?

Every turn is very, very simple. All that you need to do is create a Battle Event that raises everybody's SP, set it to run every turn, and put it in every troop. (If you make it a common event, you can just put the Call for that in every troop. Or you could just copy-paste it.)

Making it a percentage of max SP is simple enough with Control Variables-- set a variable equal to a character's max SP, divide it by 10 or 20, add it to the character's current SP, repeat for each party member.

FWIW, my default battle system increases SP whenever you defend. Some kind soul around here provided me with a script for that, so it can be found with diligent searching.
 
This can, alternatively be done by scripting, and is rather simple.
Go into the script editor.
Go to Scene_Battle4
Right beneath the "def start_phase4" put:
Code:
 

$game_party.actors.each() {|x| x.sp = [x.sp + ((x.maxsp * k) / 100), x.maxsp].min if !x.dead?}

@status_window.refresh

 

If you want this to apply to monsters too, then add
Code:
 

$game_troop.enemies.each() {|x| x.sp = [x.sp + ((x.maxsp * k) / 100), x.maxsp].min if !x.dead?}

 
Right above the @status_window.refresh

Replace k with whatever % you want to be recovered each round.

Finally, sorry I didn't get back sooner, this is the first chance I've had to check this:)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top