Frictional Games Forum (read-only)
Need help with multiple direction forcing. - 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: Need help with multiple direction forcing. (/thread-13406.html)



Need help with multiple direction forcing. - Asphex - 02-18-2012

Hey everybody! I want the player to look into a certain direction, then shortly after look in the other direction. I also need to display text on both of the actions when the player looks, but something as always fails on me. I seem to have a problem in my script, but I tried so many different variations, that I don't even know where I am now. Could you please enlighten me and help my way out of this mess? Working on my first custom story and still new to this. :p

Here's my script:

Spoiler below!
void OnEnter()
{

}

void Credits(string &in asParent, string &in asChild ,int alState)
{

}
//////////////////////////
///Starts here
void OnStart()
{
AddEntityCollideCallback("Player", "ScareLookArea", "LookAtDoor", true, 1);
AddEntityCollideCallback("Player", "ScareDoorArea", "CollideScareDoor", true, 1);
AddEntityCollideCallback("Player", "ScareLookWallArea", "LookAtWall", true, 1);

}

void LookAtDoor(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("mansion_1", 5, 50, "");
AddTimer("", 2, "TimerStopPlayerLook");
}

void LookAtWall(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("wall_default_short_13", 10, 50, "");
AddTimer("", 4, "TimerStopLook2");
}

void TimerStopPlayerLook(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(true);
StopPlayerLookAt();
SetMessage("LookAtDoor", "LookDoor", 2);
AddTimer("", 2, "LookAtWall");
}

void TimerStopLook2(string &in asTimer)
{
StopPlayerLookAt();
SetMessage("LookAtWall", "LookWall", 4);
}

void CollideScareDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("mansion_1", true, true);
}

void OnLeave()
{

}


Thank you in advance! (:


RE: Need help with multiple direction forcing. - Your Computer - 02-18-2012

For starters, you gave TimerStopPlayerLook the wrong callback syntax. I would suggest you take the time to better understand the functions available to you by the engine, as the current code is showing signs that you are more willing to get things done than to learn how things work first.



RE: Need help with multiple direction forcing. - Asphex - 02-24-2012

Thanks for your response ! This time I've done my homework and I've got things working :p and I have learned a lot too. When you said that the code showing signs of me being more willing to get things done.. Actually I just threw a crappy code here and started a thread 'cause I was too frustrated trying to get it to work. Anyways got it all figured out now Smile