Frictional Games Forum (read-only)
[SCRIPT] Stop Player Look at [Solved] - 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)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Stop Player Look at [Solved] (/thread-25126.html)



Stop Player Look at [Solved] - ShipinShen - 04-21-2014

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 :/


RE: Stop Player Look at - FlawlessHappiness - 04-21-2014

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


RE: Stop Player Look at - ShipinShen - 04-21-2014

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