Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making two StartPlayerLookAt one after the other?
Ungotter Offline
Junior Member

Posts: 11
Threads: 3
Joined: Sep 2012
Reputation: 0
#1
Question  Making two StartPlayerLookAt one after the other?

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.
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();
}
(This post was last modified: 09-16-2012, 04:51 PM by Ungotter.)
09-16-2012, 03:34 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#2
RE: Making two StartPlayerLookAt one after the other?

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

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-16-2012, 03:36 PM
Website Find
Ungotter Offline
Junior Member

Posts: 11
Threads: 3
Joined: Sep 2012
Reputation: 0
#3
RE: Making two StartPlayerLookAt one after the other?

(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!
09-16-2012, 03:48 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#4
RE: Making two StartPlayerLookAt one after the other?

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?

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-16-2012, 03:51 PM
Website Find
Ungotter Offline
Junior Member

Posts: 11
Threads: 3
Joined: Sep 2012
Reputation: 0
#5
RE: Making two StartPlayerLookAt one after the other?

(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
09-16-2012, 03:52 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#6
RE: Making two StartPlayerLookAt one after the other?

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

Again, double-check the names.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-16-2012, 03:54 PM
Website Find
Ungotter Offline
Junior Member

Posts: 11
Threads: 3
Joined: Sep 2012
Reputation: 0
#7
RE: Making two StartPlayerLookAt one after the other?

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?
(This post was last modified: 09-16-2012, 04:01 PM by Ungotter.)
09-16-2012, 03:55 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#8
RE: Making two StartPlayerLookAt one after the other?

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.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 09-16-2012, 04:05 PM by Robby.)
09-16-2012, 03:56 PM
Website Find
Ungotter Offline
Junior Member

Posts: 11
Threads: 3
Joined: Sep 2012
Reputation: 0
#9
RE: Making two StartPlayerLookAt one after the other?

(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
09-16-2012, 04:07 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#10
RE: Making two StartPlayerLookAt one after the other?

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).

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
09-16-2012, 04:09 PM
Website Find




Users browsing this thread: 4 Guest(s)