Frictional Games Forum (read-only)

Full Version: Script - Force Player to Look in Direction
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
Code:
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
Code:
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
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
No problem Smile