Help - Search - Members - Calendar
Full Version: HP/MP De/Regeneration
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
Moonchaos
Hi Community, after a lot of search i found out there is no easy to understand regeneration script.
So i took my time building this script.

Script description:

If you call the script "drainGroupMP" or "restoreGroupHP" inside a event the script activates.
You can use it for battle is you want to gain a ammount of Hp/Mp regenerated or degenerated, but you need
to add the condition for the script to activate. (like if you defend or attack with a special weapon/skill)
But this you need to add to the script yourself.

My script is more used for map de/regeneration and special about it for only some of your partymember if you want.

Example: (just like the script is unchanged now)
All partymembers will regenerate 3% hp and + 1 hp (minimum) everytime the script is active
but only partymember 2-4 will lose - 1 mp everytime the script is active

Of course you can change that if you need, the ammounts of hp/mp and the actors wich will be targeted.
The script will deactivate if the charakter is in incap/dead state. (If state id is 1, otherwise change script)

Set it up to the map with a step count:

Thats probably the most wanted function for the script.
# I use the german patched game maker vx so dont worry about the commands, you can change all the variable names.

This time it is every 10 steps activated

Screenshots:



Thats it already, change it just like you need it.

Installation:

Just copy the script and add it under "Material" in the Scripteditor (F11)
# the script only activate after you call it on page 3 RGSS "Script"

Script:
CODE
#-------------------------------------------------
#Mp degeneration
#-------------------------------------------------
def drainGroupMP    # rename if you want
  1.upto($game_party.members.length - 1) do    # from Party ID 1 (2. Member) downwards
    |i|
    @actor = $game_party.members[i]
    if @actor != nil
      if @actor.state?(1) # if charakter is Status id (1) (Incapacitate/Dead) the hp is disabled
      else      
      @actor.mp -= 1    # -1 Mp
      end  
    end
  end
end
#-------------------------------------------------
#Hp regeneration
#-------------------------------------------------
def restoreGroupHP    # rename if you want
  0.upto($game_party.members.length - 1) do    # from Party ID 0 (Hero) downwards
    |i|
    @actor = $game_party.members[i]
  if @actor != nil  
    if @actor.state?(1)    # if charakter is Status id (1) (Incapacitate/Dead) the hp is disabled
    else
    @actor.hp += (@actor.maxhp * 3 / 100) + 1    # +3% hp + 1 hp
# If the regenerated hp are under 0,44 he would return 0 but with +1 he will add min. 1 hp
      end  
    end
  end
end


Credits:

If you want to thank me it is ok, but you dont need to.
Fonstw
Hey!

I was looking for a script in wich you can a state regenerate/deregenerate HP and/or MP, could you make somethinbg like that too?


Example: You make a note in the state like
CODE
regenarate hp = [3]
to gain 3 HP each turn/step, and for example
CODE
deregenerate mp = [1]
would make the actor lose 1 MP each turn??
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.