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
Script - Force Player to Look in Direction
Rokotain Offline
Member

Posts: 54
Threads: 9
Joined: Jul 2011
Reputation: 0
#1
Script - Force Player to Look in Direction

Hello Forum People! Big Grin

I'm quite new to scripting and don't understand 100% of Frictional Games's Scripting Tutorial. Blush

What I have is a grunt spawning and I would like to have a script that forces the player to look at the grunt for a certain amount of time.

I read another thread where I found:
StartPlayerLookAt("Name?", 5.0f, 5.0f, "");
But I don't understand what it means, are "5.0f" coordinates? and the "Name?" is that the name of a Script Area Entity or an Object/Enemy Entity?

The place it would be is in this:
void LookAtGrunt(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("ghostgrunt", true);
    ShowEnemyPlayerPosition("ghostgrunt");
    AddTimer("", 2, "TimerGruntEnd");
        (>- Here -<)
}

Don't worry about the "LookAtGrunt" name in top, already got figured out how to activate that script.

So how would I get the player to look at the place the grunt is standing/spawns/area, we.

Also, I'm Norwegian so please excuse me if there are any typos. Angel

Thanks for reading!
Hope you have a solution! ^-^
Rokotain
(This post was last modified: 07-20-2011, 08:41 PM by Rokotain.)
07-20-2011, 08:40 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#2
RE: Script - Force Player to Look in Direction

void LookAtGrunt(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("ghostgrunt", true);
    ShowEnemyPlayerPosition("ghostgrunt");
    AddTimer("", 2, "TimerGruntEnd");
   StartPlayerLookAt("MonsterName", 10, 50, "");
   AddTimer("", 2, "TimerStopPlayerLook");
}

void TimerStopPlayerLook (string &in asTimer)
{
StopPlayerLookAt();
}

void StartPlayerLookAt(string& asEntityName, float afSpeedMul, float afMaxSpeed, string& asAtTargetCallback);
void StopPlayerLookAt();

Forces the player to look at a certain entity until StopPlayerLookAt is used.

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

[Image: 44917299.jpg]Dubstep <3
07-20-2011, 09:30 PM
Find
Rokotain Offline
Member

Posts: 54
Threads: 9
Joined: Jul 2011
Reputation: 0
#3
RE: Script - Force Player to Look in Direction

Thank you! Big Grin

I have tested it, and it works perfectly fine.
This will create a nasty surprise hehe^^

Thanks again for your time replying on this.
-Rokotain
07-21-2011, 04:23 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#4
RE: Script - Force Player to Look in Direction

No problem Smile

[Image: 44917299.jpg]Dubstep <3
07-21-2011, 04:47 PM
Find




Users browsing this thread: 1 Guest(s)