FANDOM


Created by Taz.

; Tazgame
; Date/Time: 4:20:52 PM on 3/2/2009
; By Tazco on NADDAZ
;need to fix sit animation 

Using "RC_Core.rcm" 

Function Main()
Player = Actor()
PlayerMaxHP% = MaxAttribute(Player, "Health")
PlayerHP% = Attribute(Player, "Health")
PName$ = Name(Player)
ScriptLog("Food_Bread running by " + PName)

 CurrPHunger% = Attribute(Player, "Hunger")
 CurrMaxPHunger% = MaxAttribute(Player, "Hunger")

    
 
 If (PlayerHP >= PlayerMaxHP) And (CurrPHunger >= CurrMaxPHunger) 
  
      OutPut(Player, "You dont need that right now", 200, 45, 32)
    Return
 
 EndIf
 
         If (PlayerHP >= PlayerMaxHP) And (CurrPHunger <= CurrMaxPHunger) 
        ;Give player hunger incress.
        CurrPHunger% = Attribute(Player, "Hunger")
        TotHungerToGive% = CurrPHunger + 50
        SetAttribute(Player, "Hunger", TotHungerToGive)
        GiveItem(Player, "Bread", - 1)
        Return
         EndIf
         
         
 If (PlayerHP <= PlayerMaxHP) And (CurrPHunger >= CurrMaxPHunger) 
 
 OutPut(Player, "You sit and eat some bread", 0, 200, 40)
 GiveItem(Player, "Bread", - 1)
 
 AnimateActor(Player, "Sit Down", 1.7)
 
 
 Ticks% = 6 ;total ticks of health
 
 Repeat
 
 Tothealth% = Attribute(Player, "Health")
 totPlayerMaxHP% = MaxAttribute(Player, "Health")
 DoEvents(1)
 
 NewHp% = Attribute(Player, "Health") + 45 ;tick health amount
 
 AnimateActor(Player, "Sit idle", .05, 1)
 
 If (Tothealth >= totPlayermaxhp)
     AnimateActor(Player, "Standup", 1)
    Ticks% = 0
     Return
 EndIf    
 
 TickChance% = Rnd(1, 32)
 
 If (TickChance = 1)
 NewHp% = Attribute(Player, "Health") + Rnd(3, 5) ;tick health amount
 TotalHp% = NewHp
 SetAttribute(Player, "Health", TotalHp) ;give player health per tick
 EndIf
 
 Until (Tothealth = totPlayermaxhp)
 
 
 
 
 Return
 EndIf
 
 End Function