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 Help SetPlayerLookAt Questions
BadCoverMan Offline
Junior Member

Posts: 27
Threads: 7
Joined: Feb 2012
Reputation: 0
#1
SetPlayerLookAt Questions

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.
(This post was last modified: 02-25-2012, 08:05 PM by BadCoverMan.)
02-25-2012, 08:00 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#2
RE: SetPlayerLookAt Questions

StartPlayerLookAt("[entity name here]", 3.0f, 5.0f, "");

When Life No Longer Exists
Full-conversion mod
02-25-2012, 08:26 PM
Website Find
BadCoverMan Offline
Junior Member

Posts: 27
Threads: 7
Joined: Feb 2012
Reputation: 0
#3
RE: SetPlayerLookAt Questions

(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.
02-25-2012, 09:14 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#4
RE: SetPlayerLookAt Questions

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");
}

When Life No Longer Exists
Full-conversion mod
02-25-2012, 09:17 PM
Website Find
BadCoverMan Offline
Junior Member

Posts: 27
Threads: 7
Joined: Feb 2012
Reputation: 0
#5
RE: SetPlayerLookAt Questions

(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?

02-25-2012, 09:36 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#6
RE: SetPlayerLookAt Questions

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);

When Life No Longer Exists
Full-conversion mod
02-25-2012, 10:28 PM
Website Find
BadCoverMan Offline
Junior Member

Posts: 27
Threads: 7
Joined: Feb 2012
Reputation: 0
#7
RE: SetPlayerLookAt Questions

(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

02-26-2012, 01:15 AM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#8
RE: SetPlayerLookAt Questions

No problem Smile

When Life No Longer Exists
Full-conversion mod
02-26-2012, 10:36 AM
Website Find




Users browsing this thread: 1 Guest(s)