Frictional Games Forum (read-only)

Full Version: [SOLVED]Sanity script problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
void OnStart()
{
AddTimer("", 1, "AmountOfSanity");
}

void AmountOfSanity(string &in asTimer)
{
if(GetPlayerSanity() < 100.0f)
{
PlaySoundAtEntity("Player", "insanity_whisper.snt", "Player", 0, false);
PlaySoundAtEntity("Player", "insanity_baby_cry.snt", "Player", 0, false);
}
}


So , I need a normal script, if sanity is lower than x amount, in my case is 100 for test, player hears insane sounds. But in my script its not happening. Anybody can give me a working script example?

I putted many scare areas and get 0 sanity but nothing...

Thanks, + reputation for man that will help me Smile
In the void amounth of sanity you missing a timer wich will time or replay the sounds.
Just add a timer in that fanction and add the amounth of nanity in it.
That should do the trick.
(10-18-2014, 08:16 PM)DnALANGE Wrote: [ -> ]In the void amounth of sanity you missing a timer wich will time or replay the sounds.
Just add a timer in that fanction and add the amounth of nanity in it.
That should do the trick.

ok, but i can make a timer that never stops, i mean circular one?

You can give a example, I dont know with what to start...
void OnStart()
{
AddTimer("", 1, "AmountOfSanity");
}

void AmountOfSanity(string &in asTimer)
{
if(GetPlayerSanity() < 100.0f)
{
PlaySoundAtEntity("Player", "insanity_whisper.snt", "Player", 0, false);
PlaySoundAtEntity("Player", "insanity_baby_cry.snt", "Player", 0, false);

AddTimer("", 10, "AmountOfSanity");// <-- This timer will LOOP your timer-script every 10 seconds -> AmountOfSanity

}
}
(10-19-2014, 11:51 AM)DnALANGE Wrote: [ -> ]void OnStart()
{
AddTimer("", 1, "AmountOfSanity");
}

void AmountOfSanity(string &in asTimer)
{
if(GetPlayerSanity() < 100.0f)
{
PlaySoundAtEntity("Player", "insanity_whisper.snt", "Player", 0, false);
PlaySoundAtEntity("Player", "insanity_baby_cry.snt", "Player", 0, false);

AddTimer("", 10, "AmountOfSanity");// <-- This timer will LOOP your timer-script every 10 seconds -> AmountOfSanity

}
}

Thank you Smile