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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help debugging various script functions
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#15
RE: Need help debugging various script functions

Thanks, My Computer. PlayGuiSound fixed things up just right. Now, about the EphiPhirine junk. The syringe code?

The inject function is called when the syringe is picked up. here's the unmodified code for the syringe.

void OnStart()
{  
SetGlobalVarInt("picked", 0); //value to check if the item is picked up
}


void pick(string &in asEntity, string &in type)
{
AddPlayerSanity(-5); //reduce player's sanity so he will be able to use the item(If HIS SANITY IS 100% HE WON'T BE ABLE TO USE THE ITEM!!!)
SetGlobalVarInt("picked", 1);
AddTimer("Used_timer", 1, "Used_timer"); //timer which will check if the item is used

}

void Used_timer(string &in asTimer)
{
if (GetGlobalVarInt("picked")== 1){ //check if it's picked up
AddTimer("Used_timer", 1, "Used_timer"); //loop timer
if (HasItem("syr")==false) {  //check if the item is used...I named my item "syr"
SetPlayerMoveSpeedMul(1.8); //players moving speed...Bigger value will make the player fall of the map!!!
SetPlayerRunSpeedMul(1.5); //players running speed...Bigger value will make the player fall of the map!!!
RemoveTimer("Used_timer"); //remove the timer so it wont loop again
SetGlobalVarInt("picked", 0);
AddTimer("heartbeat_sound", 0, "heartbeat_sound"); //timer to play custom heartbeat sound

AddTimer("finishTimer", 10, "finishTimer"); //duration of the epinephrine effect!Change if needed

}
}
}

void heartbeat_sound(string &in asTimer)
{
if (GetGlobalVarInt("picked")== 0){
PlaySoundAtEntity("heart", "Heartbeat_fast.snt", "Player", 0, true);
AddTimer("heartbeat_sound", 8, "heartbeat_sound"); //loop sound
}
}


void finishTimer(string &in asTimer)
{
SetPlayerMoveSpeedMul(1); //change players speed to normal
SetPlayerRunSpeedMul(1);//change players speed to normal
SetGlobalVarInt("picked", 2); //changed so it wont loop again...Not sure if needed
StopSound("heart", 1); //stop sound if it is still playing
RemoveTimer("finishTimer");
RemoveTimer("heartbeat_sound");
//remove timers...Not sure if needed
}
(This post was last modified: 09-14-2013, 10:48 PM by Silent Darkness.)
09-14-2013, 10:40 PM
Find


Messages In This Thread
RE: Need help debugging various script functions - by Silent Darkness - 09-14-2013, 10:40 PM



Users browsing this thread: 1 Guest(s)