Frictional Games Forum (read-only)

Full Version: Stop Player Look at [Solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, maybe anyone can me help.
I want to let the player stop looking at the door.

Code:
//Door-Slam
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("AutoDoor", true, true);
StartPlayerLookAt("AutoDoor", 9, 9, "door");
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddTimer("", 1, "stop");
}

void stop()
{
    StopPlayerLookAt();
}

If i write the StopPlayerLookAt(); in the func_slam, it wont even look at the door.
I think its quite simple, but i dont get it :/
Your mistake is in:

void stop()
{
StopPlayerLookAt();
}

Because you are clearly calling a timerfunction with

AddTimer("", 1, "stop");

Therefore the script-functino must be:

void stop(string &in asTimer)
{
StopPlayerLookAt();
}


Do you see what i added?
These are called parameters, and they help the script understand what kind of function you want to call.

This might help:
http://www.frictionalgames.com/forum/thread-18368.html
(04-21-2014, 10:36 AM)FlawlessHappiness Wrote: [ -> ]Your mistake is in:

void stop()
{
StopPlayerLookAt();
}

Because you are clearly calling a timerfunction with

AddTimer("", 1, "stop");

Therefore the script-functino must be:

void stop(string &in asTimer)
{
StopPlayerLookAt();
}


Do you see what i added?
These are called parameters, and they help the script understand what kind of function you want to call.

This might help:
http://www.frictionalgames.com/forum/thread-18368.html

Alright! I understand, i thought the "stop" in the timer would say the script, that he use the function stop Big Grin Thanks!