08-10-2012, 07:27 AM
Hello Frictional!
I am trying to zoom in the FOV of player for 4 seconds, then back out after 4 seconds.
This is literally my first go at timers, hopefully I was somewhere close, please correct me if you can!
My script:
oid OnPickup(string &in asEntity, string &in type)
{
SetMessage("Messages", "noise", 4.0);
AddTimer("FOV", 0, "FadePlayerFOVMulTo");
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 0, false);
GiveSanityDamage(25, false);
void FadePlayerFOVMulTo(string &in timer_name)
{
if (timer_name == "FOV")
{
FadePlayerFOVMulTo(0.5, 2);
SetPlayerActive(false);
AddTimer("Normal1", 4, "FadePlayerFOVMulTo");
}
else if (timer_name == "Normal1")
{
FadePlayerFOVMulTo(1, 2);
SetPlayerActive(true);
}
Bold is what I'm talking about
I am trying to zoom in the FOV of player for 4 seconds, then back out after 4 seconds.
This is literally my first go at timers, hopefully I was somewhere close, please correct me if you can!
My script:
oid OnPickup(string &in asEntity, string &in type)
{
SetMessage("Messages", "noise", 4.0);
AddTimer("FOV", 0, "FadePlayerFOVMulTo");
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 0, false);
GiveSanityDamage(25, false);
void FadePlayerFOVMulTo(string &in timer_name)
{
if (timer_name == "FOV")
{
FadePlayerFOVMulTo(0.5, 2);
SetPlayerActive(false);
AddTimer("Normal1", 4, "FadePlayerFOVMulTo");
}
else if (timer_name == "Normal1")
{
FadePlayerFOVMulTo(1, 2);
SetPlayerActive(true);
}
Bold is what I'm talking about