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
How do I make the player look at a certain spot?
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#1
How do I make the player look at a certain spot?

Okay, I want to make it that when you pick up a certain note and close it again the game makes you look at a certain spot to the right. How do I do this? thanks!
04-13-2014, 06:35 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: How do I make the player look at a certain spot?

PHP Code: (Select All)
StartPlayerLookAt(stringasEntityNamefloat afSpeedMulfloat afMaxSpeedstringasAtTargetCallback); 

asEntityName - the entity to look at
afSpeedMul - how fast should the player look at the entity
afMaxSpeed - maximum speed allowed
asAtTargetCallback - function to call when player looks at target

Just place a ScriptArea where you want the player to look, and call that the asEntityName part.

You need to put a StopPlayerLookAt(); somewhere as well, otherwise, the player will remain focused on that Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-13-2014, 06:45 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#3
RE: How do I make the player look at a certain spot?

Can the player still move when looking at the entity or do I have to put the PlayerActive somewhere in there aswell?

And also how do I make the script start when the player picks up a certain object?
(This post was last modified: 04-13-2014, 06:55 PM by goodcap.)
04-13-2014, 06:53 PM
Find
MsHannerBananer Offline
Member

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
#4
RE: How do I make the player look at a certain spot?

As far as I'm aware, you can call a function when you pick something up with the EntityPlayerInteract.

Not sure if it works with notes, but worth a shot.

PHP Code: (Select All)
SetEntityPlayerInteractCallback(stringasNamestringasCallbackbool abRemoveOnInteraction); 

asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity

Here, the internal name would be what you've named the note in the editor.

Then you set the name of your function and use this syntax: void MyFunc(string &in asEntity) .

So if you want your player to look at something after he picked up the note, you could set a timer so he doesn't immediately go to look for what he's looking at, however, I'm pretty sure nothing can disturb you while you read notes, so I don't think it's a big deal to set a timer.

04-13-2014, 07:29 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#5
RE: How do I make the player look at a certain spot?

You helped me out a ton, buddy Tongue One more question and then it will all be working. How do I make the player not be able to move during the looking at a certain thing untill the event is finished?
04-13-2014, 08:15 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: How do I make the player look at a certain spot?

PHP Code: (Select All)
SetPlayerActive(false);      //Player can't move 

PHP Code: (Select All)
SetPlayerActive(true);       //Player can move 

Just put them wherever they need to go! Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-13-2014, 08:19 PM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#7
RE: How do I make the player look at a certain spot?

THANK YOU SO MUCH! IT WORKS!!!

I bow for you, sir haha Tongue
(This post was last modified: 04-13-2014, 09:22 PM by goodcap.)
04-13-2014, 09:18 PM
Find




Users browsing this thread: 2 Guest(s)