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
[SCRIPT] Running a script when attacked
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#2
RE: [SCRIPT] Running a script when attacked

You could run a timer checking if the player health is lower than 99. But before the player enters the area you have to make sure he has more than 99 health. (That means 100). It won't be exactly when the player's hit, but it's close.

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Scriptarea1""Player""Starttimer"true0);
}

void Starttimer(string &in asParentstring &in asChildint alState)
{
AddTimer(""1"starttimer2");
SetPlayerHealth(100);
}

void starttimer2(string &in asTimer)
{
AddTimer("timer2"1"starttimer3");
checkhealth();
}

void starttimer3(string &in asTimer)
{
AddTimer("timer1"1"starttimer2");
checkhealth();
}

void checkhealth()
{
if(
GetPlayerHealth(<100))
{
//Do whatever you want
RemoveTimer("timer1");
RemoveTimer("timer2");
}


I'm not sure if the getplayerhealth is right, could someone tell me/us if it is?
(This post was last modified: 05-18-2013, 04:01 PM by OriginalUsername.)
05-18-2013, 03:39 PM
Find


Messages In This Thread
RE: [SCRIPT] Running a script when attacked - by OriginalUsername - 05-18-2013, 03:39 PM



Users browsing this thread: 1 Guest(s)