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
[SOLVED] StartPlayerLookAt following a grunt?
Aletho Offline
Junior Member

Posts: 14
Threads: 4
Joined: Jan 2015
Reputation: 0
#1
[SOLVED] StartPlayerLookAt following a grunt?

Hello!

I want to force the player to look at where the monster would be, behind the wall, and follow its movements past the door, simulating the player following the origin of the sound the monster is making.

Is there any way to do this? So far I've only managed to get the player to look at the point where the monster spawns.

Thanks in advance! Big Grin
(This post was last modified: 02-26-2015, 09:28 AM by Aletho.)
02-25-2015, 07:34 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: StartPlayerLookAt following a grunt?

I've had the player's view follow the monster just fine. All I did was the expected StartPlayerLookAt with the monster as the target. Only thing I remember doing in addition was SetPlayerActive(false); but I don't know if that really makes the difference.

(This post was last modified: 02-25-2015, 08:23 PM by Mudbill.)
02-25-2015, 08:22 PM
Find
Aletho Offline
Junior Member

Posts: 14
Threads: 4
Joined: Jan 2015
Reputation: 0
#3
RE: StartPlayerLookAt following a grunt?

(02-25-2015, 08:22 PM)Mudbill Wrote: I've had the player's view follow the monster just fine. All I did was the expected StartPlayerLookAt with the monster as the target. Only thing I remember doing in addition was SetPlayerActive(false); but I don't know if that really makes the difference.

This is my code for the monster/looking script:

Spoiler below!
void MonsterBeginning(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt",true);

AddEnemyPatrolNode("grunt","beginning_node_1",0,"");
StartPlayerLookAt("grunt", 5.0f, 15.0f, "");
}


but this makes the player look at the point of origin of the monster and stays there, instead of following the monster :/
02-25-2015, 08:41 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#4
RE: StartPlayerLookAt following a grunt?

Then what you can do is update the StartPlayerLookAt with a timer. The camera should then adjust perfectly by itself with this.

void TimerGruntUpdate(string &in asTimer)
{
StartPlayerLookAt("grunt", 3.0f, 3.0f, "");
AddTimer("grunt", 0.01f, "TimerGruntUpdate");
}

Derp.
(This post was last modified: 02-25-2015, 08:58 PM by Neelke.)
02-25-2015, 08:58 PM
Find
Aletho Offline
Junior Member

Posts: 14
Threads: 4
Joined: Jan 2015
Reputation: 0
#5
RE: StartPlayerLookAt following a grunt?

(02-25-2015, 08:58 PM)Neelke Wrote: Then what you can do is update the StartPlayerLookAt with a timer. The camera should then adjust perfectly by itself with this.

void TimerGruntUpdate(string &in asTimer)
{
StartPlayerLookAt("grunt", 3.0f, 3.0f, "");
AddTimer("grunt", 0.01f, "TimerGruntUpdate");
}

That worked really well, now the camera follows the grunt perfectly. There's just one problem, now that script will go on forever meaning a simple "StopPlayerLookingAt" line won't stop it from looking at the point where the grunt got deactivated, since it updates itself every 1/10 of a second :/
02-25-2015, 10:54 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: StartPlayerLookAt following a grunt?

Use RemoveTimer("grunt"); at the same time as the StopPlayerLookAt script. That will cancel the loop.

02-26-2015, 12:06 AM
Find
Aletho Offline
Junior Member

Posts: 14
Threads: 4
Joined: Jan 2015
Reputation: 0
#7
RE: StartPlayerLookAt following a grunt?

(02-26-2015, 12:06 AM)Mudbill Wrote: Use RemoveTimer("grunt"); at the same time as the StopPlayerLookAt script. That will cancel the loop.

Ahh thanks, that worked! :-)
02-26-2015, 09:28 AM
Find




Users browsing this thread: 1 Guest(s)