Frictional Games Forum (read-only)
Making two StartPlayerLookAt one after the other? - 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: Making two StartPlayerLookAt one after the other? (/thread-18367.html)



Making two StartPlayerLookAt one after the other? - Ungotter - 09-16-2012

I feel like I'm being a burden by using these forums almost frequently, but I'm really stuck right now.

My goal here is to have a player look at something, then after that is done, look behind him, so this happens pretty much immediately after the first look is done. Yes, I did post a thread asking how to do the whole thing this is based around, but this is a new problem completely.

What happens is that the player doesn't look a second time, the sound plays and everything works as should, except the second StartPlayLookAt. Can anyone explain why this doesn't work? Please I've been trying to get this to work for hours last night and hours today, I've gone through the script functions on the wiki and found nothing.
Code:
void OnStart()
{
    AddDebugMessage("OnStart!", false);
    AddEntityCollideCallback("Player", "BottleFallArea", "BottleFall", true, 1);
    AddEntityCollideCallback("Player", "BodyAlley", "BodyAlleyScare", true, 1);
}

void OnEnter()
{
    AddDebugMessage("OnEnter!", false);
}

void OnLeave()
{
    AddDebugMessage("OnLeave!", false);
}

void BottleFall(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("wine02_1", true);
}

void BodyAlleyScare(string &in asParent, string &in asChild, int alState)
{
    StartPlayerLookAt("corpse_male_1", 4.0f, 4.0f, "");
    GiveSanityDamage(5.0f, true);
    AddTimer("BodyAlleyTimer", 3.0f, "Timer_01");
}

void Timer_01(string &in asTimer)
{
    StopPlayerLookAt();
    StartPlayerLookAt("stairs_railing_worn_11", 4.0f, 4.0f, "");
    PlaySoundAtEntity("PlatformDoor", "16_bridge_unstuck", "castle_portcullis_3", 0.1f, false);
    AddTimer("BodyAlleyTimer2", 3.0f, "Timer_02");
}

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



RE: Making two StartPlayerLookAt one after the other? - Robby - 09-16-2012

Try removing the "StopPlayerLookAt" function from "Timer_01".


RE: Making two StartPlayerLookAt one after the other? - Ungotter - 09-16-2012

(09-16-2012, 03:36 PM)Nemet Robert Wrote: Try removing the "StopPlayerLookAt" function from "Timer_01".
I just gave it a whirl and it doesn't swap where the player looks. It just continues to look at the first for the length of time for both timers Sad Thanks anyway!


RE: Making two StartPlayerLookAt one after the other? - Robby - 09-16-2012

The script doesn't seem to have problems. Syntaxes are correct, everything else seems to be normal. Are you sure that both names used by the "StartPlayerLookAt" functions are 100% correct and match the ones in the Level Editor?


RE: Making two StartPlayerLookAt one after the other? - Ungotter - 09-16-2012

(09-16-2012, 03:51 PM)Nemet Robert Wrote: The script doesn't seem to have problems. Syntaxes are correct, everything else seems to be normal. Are you sure that both names used by the "StartPlayerLookAt" functions are 100% correct and match the ones in the Level Editor?
Absolutely, I copied and pasted them straight from the editor


RE: Making two StartPlayerLookAt one after the other? - Robby - 09-16-2012

Try using script areas to look at. Place them where you want the player to look to.

Again, double-check the names.


RE: Making two StartPlayerLookAt one after the other? - Ungotter - 09-16-2012

I'll give it a go now, check back in a few minutes and I'll have replied Smile

Edit: Hm, it works perfectly now. Thank you! Why does this occur though? Why am I unable to look at the prop and so have to use a script area?


RE: Making two StartPlayerLookAt one after the other? - Robby - 09-16-2012

Ok. Waiting...

(09-16-2012, 03:55 PM)Ungotter Wrote: Edit: Hm, it works perfectly now. Thank you! Why does this occur though? Why am I unable to look at the prop and so have to use a script area?
Static objects are not props. I don't think you can look at them.


RE: Making two StartPlayerLookAt one after the other? - Ungotter - 09-16-2012

(09-16-2012, 03:56 PM)Nemet Robert Wrote: Ok. Waiting...

(09-16-2012, 03:55 PM)Ungotter Wrote: Edit: Hm, it works perfectly now. Thank you! Why does this occur though? Why am I unable to look at the prop and so have to use a script area?
Static objects are not props. I don't think you can look at them.
Ah I see, odd, but at least I know in future. Thanks, you've been a big help Big Grin


RE: Making two StartPlayerLookAt one after the other? - Robby - 09-16-2012

NP.

Neither do I know why that doesn't work. But I always used Script Areas and they worked perfectly. Static Objects like walls and all that don't work (as it seems).