Frictional Games Forum (read-only)

Full Version: SetPlayerLookAt Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there. What I am hoping to achieve is that I have the player enter a room with a living entity in it. He then pulls a lever, which plays the "guardian activate" sound, and activates a Script Area in the doorway. As soon as he tries to leave and collides with it, he is forced to look back at the entity. The entity then warns him about something.

This is what I have so far, it's pretty much everything except the functions to be executed when leaving through the door.

Edit: Also, the sound file to played will be "warning_1.snt"

Spoiler below!

void ShelfSwing(string &in asEntity, int alState)
{
if (alState == -1)
{
SetMoveObjectState("shelf_1",1.0f);
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
StartScreenShake(.4, 4, 1, 1);
SetEntityActive("Warning_1", true);
return;
}


void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_1", "ShelfSwing");
AddEntityCollideCallback("Player", "Warning_1", "EntityTalk", true, 1);
}

void EntityTalk(string &in asParent, string &in asChild, int alState)
{
//Function needed for Player to look at entity and have entity speak to him. Then possibly fade to dust? Something like that.
}


I appreciate the help, thank you.
StartPlayerLookAt("[entity name here]", 3.0f, 5.0f, "");
(02-25-2012, 08:26 PM)Unearthlybrutal Wrote: [ -> ]StartPlayerLookAt("[entity name here]", 3.0f, 5.0f, "");
Worked perfectly. It played the sound too, but I tried to add a timer and it didn't do what I wanted it to.

This is what it looks like.

Spoiler below!

void Warning(string &in asTimer)
{
if(asTimer == "StopLookAt")
{
StopPlayerLookAt();
}
if(asTimer == "FadeSmoke")
{
FadeEnemyToSmoke("alexander_1", true);
}
}

void Onstart();
{
AddEntityCollideCallback("Player", "Warning_1", "EntityTalk", true, 1);
}

void EntityTalk(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("alexander_1", 3.0f, 5.0f, "");
PlaySoundAtEntity("", "warning_1.snt", "Player", 0, false);
AddTimer("StopLookAt", 4, "Warning");
AddTimer("FadeSmoke", 4, "Warning");
}


I wanted both things to happen after 4 seconds.
void Warning(string &in asTimer)
{
StopPlayerLookAt();
FadeEnemyToSmoke("alexander_1", true);
}

void Onstart();
{
AddEntityCollideCallback("Player", "Warning_1", "EntityTalk", true, 1);
}

void EntityTalk(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("alexander_1", 3.0f, 5.0f, "");
PlaySoundAtEntity("", "warning_1.snt", "Player", 0, false);
AddTimer("stoplook", 4, "Warning");
}
(02-25-2012, 09:17 PM)Unearthlybrutal Wrote: [ -> ]void Warning(string &in asTimer)
{
StopPlayerLookAt();
FadeEnemyToSmoke("alexander_1", true);
}

void Onstart();
{
AddEntityCollideCallback("Player", "Warning_1", "EntityTalk", true, 1);
}

void EntityTalk(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("alexander_1", 3.0f, 5.0f, "");
PlaySoundAtEntity("", "warning_1.snt", "Player", 0, false);
AddTimer("stoplook", 4, "Warning");
}
Thank you very much. I just realized though that Alexander is not an "enemy" so FadeEnemyToSmoke wouldn't necessarily work. I'd rather not have him just abruptly disappear so is there any way to fade him to smoke?

SetPropActiveAndFade("alexander_1", false, 3.0f);
Fades the entity away.

...you can use particle system to make the smoke
CreateParticleSystemAtEntity("particle", " [particlesystem you want to use].ps ",
"alexander_1" , false);
(02-25-2012, 10:28 PM)Unearthlybrutal Wrote: [ -> ]SetPropActiveAndFade("alexander_1", false, 3.0f);
Fades the entity away.

...you can use particle system to make the smoke
CreateParticleSystemAtEntity("particle", " [particlesystem you want to use].ps ",
"alexander_1" , false);
Thank you very much! I really appreciate your help Big Grin

No problem Smile