Frictional Games Forum (read-only)
[SOLVED]Sanity script problem - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+--- Thread: [SOLVED]Sanity script problem (/thread-26901.html)



[SOLVED]Sanity script problem - Catalyst - 10-18-2014

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


RE: Sanity script problem - DnALANGE - 10-18-2014

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.


RE: Sanity script problem - Catalyst - 10-19-2014

(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...


RE: Sanity script problem - DnALANGE - 10-19-2014

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

}
}


RE: Sanity script problem - Catalyst - 10-19-2014

(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