FANDOM


Regen script by Taz.

Using "RC_Core.rcm"
; Test
 ; Date/Time: 12:12:19 AM on 10/7/2010
; By Naddaz on TAZCO
;Basic regen, you will need to add a death check so it will not run when player dies.
Function Main()

;Debuging checking to see if script is running.



Player = Actor() 
plvl = ActorLevel(Player)
AddActorEffect(Player, "Regen", "", 0, 0, 1) ;give player regen buff change icon id
Fullticks% = 10 ; ten repeats

Repeat 
DoEvents(2000)
PHealth% = Attribute(Player, "Health") 
PHealthMax% = MaxAttribute(Player, "Health") 
PMana% = Attribute(Player, "Mana")
PManaMax% = MaxAttribute(Player, "Mana")


Pname$ = Name(Player)

  Fullticks% = Fullticks - 1
  If (TotalHpMp = TotalMaxHpMp)
    DeleteActorEffect(Player, "Regen") ;take regen buff away
    Fullticks% = 0
    Return
   Endif  
 
 
 
 ; Regen Health
         If (PHealth < PHealthMax) ;player Health is less then max then return some health
               If (plvl > 15)
                NewPHealth% = PHealth + Rand(20, 25) ;player level 15 or more give more regen
               Else
                NewPHealth% = PHealth + Rand(15, 10) ;player level under 15 give less regen
               Endif


            If (NewPHealth > PHealthMax) 
                NewPHealth% = PHealthMax 
            EndIf 

            SetAttribute(Player, "Health", NewPHealth)  ;set health to the restore amount
        EndIf ;end health regen
 
 
         If (PMana < PManaMax)
            
                 If (plvl > 15)
                NewPMana% = PMana + Rand(12, 14) ;player level 15 or more give more regen
               Else
               NewPMana% = PMana + Rand(7, 9) ;player level under 15 give less regen
               Endif



            If (NewPMana > PManaMax)
            NewPMana% = PManaMax
            Endif

        SetAttribute(Player, "Mana", NewPMana)
        Endif
 
 DoEvents(500)
    
 
 
 Until (Fullticks = 0)
 
 
 End Function