Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger script when using any laudanum
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#11
RE: Trigger script when using any laudanum

PHP Code: (Select All)
void HPCheck(string &in t)
{
    if(
GetPlayerHealth()-5.0f GetLocalVarFloat("PlayerLastHP"))
    {
        
PlayerUsedPotion();
    }
    else if(
GetPlayerHealth() > 95)
    {
        
PlayerUsedPotion();
    }
    else
    {
        
SetLocalVarFloat("PlayerLastHP"GetPlayerHealth());
        
AddTimer(t0.0166f"HPCheck");
    }


Like this?

(I also put the end of the script in it's own "else" bracket so that the timer stops repeating if one of the conditions is satisfied.)

06-07-2012, 08:38 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#12
RE: Trigger script when using any laudanum

Does it work properly if you put the timer and LocalVar inside a else statement? If it do then it looks good Smile

06-07-2012, 08:40 AM
Find
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#13
RE: Trigger script when using any laudanum

logical or: ||

PHP Code: (Select All)
void HPCheck(string &in t)
{
    if(
GetPlayerHealth()-5.0f GetLocalVarFloat("PlayerLastHP") || 
     
GetPlayerHealth() > 95)
    {
        
PlayerUsedPotion();
    }
    else
    {
        
SetLocalVarFloat("PlayerLastHP"GetPlayerHealth());
        
AddTimer(t0.0166f"HPCheck");
    }


Dark Seclusion Here
(This post was last modified: 06-07-2012, 10:22 AM by FragdaddyXXL.)
06-07-2012, 10:20 AM
Find




Users browsing this thread: 1 Guest(s)