Frictional Games Forum (read-only)
Player Won't Look At Entity? - 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: Player Won't Look At Entity? (/thread-21389.html)



Player Won't Look At Entity? - FurtherGames - 05-04-2013

Hello, again!

It seems each time I do a new thing when it comes to scripting I have at least one problem. I'm a little new but I understand it. But I don't understand why my player won't look at the entity which is a bed!


HPS FILE:
(All other scripting has been removed)

HPS Script

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Dothing", true, 1);
}




void OnEnter()
{




}




void OnLeave()





}
void Dothing(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("oxfordsbed", 1.0f, 1.0f, "");
SetMessage("Messages", "GetSomeSleep",3);
AddTimer("", 4, "Doelse");
}
void Doelse (string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}



RE: Player Won't Look At Entity? - PutraenusAlivius - 05-04-2013

PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""ScriptArea_1""PlrLookAt"true1);
}




void OnEnter()
{

}

void OnLeave()
{
 
}
void PlrLookAt(string &in asParentstring &in asChildint alState)
{
SetPlayerActive(false);
StartPlayerLookAt("oxfordsbed"1.0f1.0f"");
SetMessage("Messages""GetSomeSleep"3);
AddTimer(""4"PlrStahpLookAt");
}
void PlrStahpLookAt(string &in asTimer)
{
 
StopPlayerLookAt();
 
SetPlayerActive(true);


Fixed. Hopefully.


RE: Player Won't Look At Entity? - FurtherGames - 05-04-2013

(05-04-2013, 01:08 PM)JustAnotherPlayer Wrote:
PHP Code:
void OnStart()
{
    
AddEntityCollideCallback("Player""ScriptArea_1""PlrLookAt"true1);
}




void OnEnter()
{

}

void OnLeave()
{
 
}
void PlrLookAt(string &in asParentstring &in asChildint alState)
{
SetPlayerActive(false);
StartPlayerLookAt("oxfordsbed"1.0f1.0f"");
SetMessage("Messages""GetSomeSleep"3);
AddTimer(""4"PlrStahpLookAt");
}
void PlrStahpLookAt(string &in asTimer)
{
 
StopPlayerLookAt();
 
SetPlayerActive(true);


Fixed. Hopefully.

It's not. All that happens is the player becomes inactive, the message appears and then the player is active again once the countdown finishes.


RE: Player Won't Look At Entity? - PutraenusAlivius - 05-04-2013

Make sure the name matches.


RE: Player Won't Look At Entity? - OriginalUsername - 05-04-2013

You know the 1 in the addentitycollidecallbacks stands for 'only when entering area' that might mess it up if it's a large area and you're already inside it.


RE: Player Won't Look At Entity? - FurtherGames - 05-04-2013

(05-04-2013, 01:13 PM)Smoke Wrote: You know the 1 in the addentitycollidecallbacks stands for 'only when entering area' that might mess it up if it's a large area and you're already inside it.


No, sadly not. It's at the other side of a door so that once you open the door and walk through you look at the bed.

(05-04-2013, 01:11 PM)JustAnotherPlayer Wrote: Make sure the name matches.

Names match, I copied them over.


RE: Player Won't Look At Entity? - OriginalUsername - 05-04-2013

It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.


RE: Player Won't Look At Entity? - FurtherGames - 05-04-2013

(05-04-2013, 01:16 PM)Smoke Wrote: It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.

I'm unsure whether or not I should deactivate the player. I was watching this tutorial, the guy puts the "StartPlayerLookAt" right into OnStart, etc.

(05-04-2013, 01:16 PM)Smoke Wrote: It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.

The player will look at the script but not the bed, so it's fixed now, but it was a little weird.


RE: Player Won't Look At Entity? - OriginalUsername - 05-04-2013

(05-04-2013, 01:19 PM)Matt.btwi Wrote:
(05-04-2013, 01:16 PM)Smoke Wrote: It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.

I'm unsure whether or not I should deactivate the player. I was watching this tutorial, the guy puts the "StartPlayerLookAt" right into OnStart, etc.

It doesn't hurt if the player is active or not. And if you place the StartPlayerLookAt into OnStart, the player'll just look at it right when he enters the map.

(05-04-2013, 01:19 PM)Matt.btwi Wrote:
(05-04-2013, 01:16 PM)Smoke Wrote: It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.

I'm unsure whether or not I should deactivate the player. I was watching this tutorial, the guy puts the "StartPlayerLookAt" right into OnStart, etc.

(05-04-2013, 01:16 PM)Smoke Wrote: It might be a weird glitch. Try to add a script_area and place it in the bed. Try to make him look at that.

The player will look at the script but not the bed, so it's fixed now, but it was a little weird.

True, I'm not sure what caused it..