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
Player Won't Look At Entity?
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#1
Wink  Player Won't Look At Entity?

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);
}
(This post was last modified: 05-04-2013, 01:23 PM by FurtherGames.)
05-04-2013, 01:04 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Player Won't Look At Entity?

PHP Code: (Select All)
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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-04-2013, 01:08 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#3
RE: Player Won't Look At Entity?

(05-04-2013, 01:08 PM)JustAnotherPlayer Wrote:
PHP Code: (Select All)
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.
05-04-2013, 01:10 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Player Won't Look At Entity?

Make sure the name matches.

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-04-2013, 01:11 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#5
RE: Player Won't Look At Entity?

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.
05-04-2013, 01:13 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#6
RE: Player Won't Look At Entity?

(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.
(This post was last modified: 05-04-2013, 01:15 PM by FurtherGames.)
05-04-2013, 01:14 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#7
RE: Player Won't Look At Entity?

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.
05-04-2013, 01:16 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#8
RE: Player Won't Look At Entity?

(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.
(This post was last modified: 05-04-2013, 01:21 PM by FurtherGames.)
05-04-2013, 01:19 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#9
RE: Player Won't Look At Entity?

(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..
(This post was last modified: 05-04-2013, 01:22 PM by OriginalUsername.)
05-04-2013, 01:21 PM
Find




Users browsing this thread: 3 Guest(s)