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
Scripting a LookAt?
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#1
Scripting a LookAt?

Well, I have tried scripting a LookAt event, but it doesn't work. What's wrong with this script? The Monster Spawn is working perfectly btw.

void CollideAreaMonster(string &in asParent, string &in asChild, int alState)
{
  StartPlayerLookAt("corpses", 6.0f, 5.0f, "");
  PlaySoundAtEntity("ScareSound2", "react_pant.snt", "Player", 0, true);
  GiveSanityDamage(6.0f, true);
  AddTimer("look_at_corpses", 0.5f, "corpses_scare");
}

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

void ClosetMonster(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("grunt_1", true);
  ShowEnemyPlayerPosition("grunt_1");
}


////////////////////////////
// Run first time starting map
void OnStart()
{
  AddEntityCollideCallback("Player", "closetScare" , "ClosetMonster" , true , 1);
  AddEntityCollideCallback("Player", "corpseScare" , "corpses_scare" , true , 1);
}

Creator of The Dark Treasure.
01-20-2011, 07:48 PM
Website Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: Scripting a LookAt?

AddEntityCollideCallback("Player", "corpseScare" , "corpses_scare" , true , 1);
Is meant to be?
AddEntityCollideCallback("Player", "corpseScare" , "CollideAreaMonster" , true , 1);
01-20-2011, 08:41 PM
Website Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#3
RE: Scripting a LookAt?

Nope, no differance =/
It worked without the timer, but then my char would look at that place forever.

Creator of The Dark Treasure.
01-20-2011, 10:04 PM
Website Find
Vradcly Offline
Member

Posts: 100
Threads: 6
Joined: Jan 2011
Reputation: 0
#4
RE: Scripting a LookAt?

I did like this, maybe you can find what is missing by comparing?

AddEntityCollideCallback("Player", "Torso_area1", "CollideTorso_area1", true, 1);

void CollideTorso_area1(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Looking at torso", false);
StartPlayerLookAt("corpse_male_1", 10, 10, "");
AddTimer("stoplook", 25.0f, "TimerStopLook");
}

void TimerStopLook(string &in asTimer)
{
AddDebugMessage("Stoped looking", false);
StopPlayerLookAt();
}

Im getting confused by your code so I cant say exactly what you have to do,
hopefully that will help Smile
01-20-2011, 10:20 PM
Find
Seragath Offline
Junior Member

Posts: 34
Threads: 1
Joined: Jan 2011
Reputation: 0
#5
RE: Scripting a LookAt?

void CollideAreaMonster(string &in asParent, string &in asChild, int alState)
{
  StartPlayerLookAt("corpses", 6.0f, 5.0f, "");
  PlaySoundAtEntity("ScareSound2", "react_pant.snt", "Player", 0, true);
  GiveSanityDamage(6.0f, true);
  AddTimer("look_at_corpses", 0.5f, "corpses_scare"); // Change the timer to 6.0f not 0.5f
}

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

void ClosetMonster(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("grunt_1", true);
  ShowEnemyPlayerPosition("grunt_1");
}


////////////////////////////
// Run first time starting map
void OnStart()
{
  AddEntityCollideCallback("Player", "closetScare" , "ClosetMonster" , true , 1);
  AddEntityCollideCallback("Player", "corpseScare" , "corpses_scare" , true , 1);
}

The mistake is that the timer will trigger in 0.5 seconds. change it to the same as the amount the StartLookingAt is.
01-21-2011, 03:56 PM
Find




Users browsing this thread: 1 Guest(s)