Frictional Games Forum (read-only)
Force Player lookat coding help - 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: Force Player lookat coding help (/thread-20039.html)



Force Player lookat coding help - Cyphermur9t - 01-24-2013

What am I doing wrong here? I've tried multiple types of coding and nothing seems to be working and is getting frustrating! All I want is for the player to be forced to look at something, then the player can again stop being forced to look and continue doing what they want. I have the looking at part working, however they never stop looking. If I move the mouse away, it'll just go right back to where he was looking at and it will not stop.


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ScriptArea_1", true, 1);
AddTimer("", 3, "stoplook");
}

//////////////////////////////////////////

void ScriptArea_1(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Look1", 5.0f, 5.0f, "");
}

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


RE: Force Player lookat coding help - The chaser - 01-24-2013

(01-24-2013, 11:40 AM)Cyphermur9t Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ScriptArea_1", true, 1);
AddTimer("", 3, "stoplook");
}

//////////////////////////////////////////

void ScriptArea_1(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Look1", 5.0f, 5.0f, "");
}

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

I think it would be better this way:

[code]void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "FUNCTION", true, 1);
}

//////////////////////////////////////////

void FUNCTION(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Look1", 5.0f, 5.0f, ""); //Look1 is the area you look at
AddTimer("", 3, "stoplook");
}

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


RE: Force Player lookat coding help - youngblood128 - 01-30-2013

(01-24-2013, 11:40 AM)Cyphermur9t Wrote: What am I doing wrong here? I've tried multiple types of coding and nothing seems to be working and is getting frustrating! All I want is for the player to be forced to look at something, then the player can again stop being forced to look and continue doing what they want. I have the looking at part working, however they never stop looking. If I move the mouse away, it'll just go right back to where he was looking at and it will not stop.


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ScriptArea_1", true, 1);
AddTimer("", 3, "stoplook");
}

//////////////////////////////////////////

void ScriptArea_1(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Look1", 5.0f, 5.0f, "");
}

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

This is easy use this way instead:

void ScriptArea_1(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Look1", 5.0f, 5.0f, "");
AddTimer("", 3, "stoplook");
}

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


and remove the other AddTimer function, this is always how I do mines, what you were doing is as soon as the map starts it will start a timer and if you weren't looking at anything then nothing would happen, I hope this helped.