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
GetPlayerSanity Trouble
Southlaguna Offline
Member

Posts: 70
Threads: 21
Joined: Jan 2012
Reputation: 0
#1
GetPlayerSanity Trouble

Hey guys

So iv'e been trying to make sequence based on a players sanity level and im starting to figure out this isn't so easy... I'm trying to make it so that the player looses sanity in a specific location and outside of the location the sanity drain stops and so does the sanityevents timer. Im still kinda new to if functions and such so i may have just missd something tiny. PLEASE HELP, information on this type of san_timer will be a huge help for the rest of the project!
-----------------------------------------------------------------------------------
void Drink(string &in asEntity)
{
SetPlayerActive(false);
AddTimer("DrinkPosSet", 1.8f, "DrinkingNow");
StartPlayerLookAt("Drink_Area", 0.5f, 1.8f, "");
MovePlayerHeadPos(0.0f, -0.1f, 0.0f, 0.1f, 0.1f);

}

void DrinkingNow(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
AddTimer("sanloop", 0.1f, "SanityDrain");
AddTimer("sanevents", 3.0f, "Sanevents");
AddTimer("pig", 5.0f, "PigTime");

}
void SanityDrain(string &in asTimer)
{
GiveSanityDamage(0.1f, false);

AddTimer("sanloop", 0.1f, "SanityDrain");
}
void Sanevents(string &in asTimer)
{
AddLocalVarInt("iInsane", 1);
float partSpeed = 2.5f;
switch (GetLocalVarInt("iInsane"))
{

case 1: // First part
partSpeed = 6.5f;
GetPlayerSanity();
if(GetPlayerSanity()==97){
PlaySoundAtEntity("", "afx_spooky_door_creaky.snt", "ps_fog_28", 0.8f, false);
AddTimer("sane", 6.8f, "Sanevents");
}
else if(GetPlayerSanity()> 97){
RemoveTimer("sane");
}
break;

case 2: // Second part
partSpeed = 12.9f;
GetPlayerSanity();
if(GetPlayerSanity()==94){
PlaySoundAtEntity("", "afx_spooky_eerie_monster.snt", "ps_fog_28", 0.1f, false);
AddTimer("sane", 12.9f, "Sanevents");
}
else if(GetPlayerSanity()> 94){
RemoveTimer("sane");
}
break;

case 3:// Third Part
partSpeed = 7.0f;
GetPlayerSanity();
if(GetPlayerSanity()==82){
PlaySoundAtEntity("", "insanity_statue_spawn.snt", "spawn_01", 0.1f, false);
AddTimer("sane", 6.8f, "Sanevents");
}
else if(GetPlayerSanity()> 82){
RemoveTimer("sane");
}
break;

case 4:// Fourth Part
partSpeed = 6.5f;
GetPlayerSanity();
if(GetPlayerSanity()==75){
PlaySoundAtEntity("", "insanity_statue_spawn.snt", "spawn_2", 0.1f, false);
}
else if(GetPlayerSanity()> 82){
RemoveTimer("sane");
}
break;
}
}
void PigTime(string &in asTimer)
{
GetPlayerSanity();
if(GetPlayerSanity()==65){
SetNPCAwake("Hunter", true, true);
}
else if(GetPlayerSanity()> 65){
AddTimer("pig", 5.0f, "PigTime");
}
}
void StopDrain(string &in asParent, string &in asChild, int alState)
{
RemoveTimer("sanloop");
}

11-15-2015, 10:11 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: GetPlayerSanity Trouble

You tried to make something. So what happened? Why isn't your script working?

Trying is the first step to success.
11-15-2015, 03:53 PM
Find




Users browsing this thread: 1 Guest(s)