Frictional Games Forum (read-only)

Full Version: OnPlayerSpotted???
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a script for something like
OnPlayerSpotted("Monster", false)
{

}

So when it is not searching anymore something triggers?
Nope.
If you want to test if the enemy has de-spawned you might be able to do that with a large script area covering your map and a timer which performs a collision test between the enemy and the script area. Testing if the player is seen by the monster isn't going to be possible in the general case, but there may be a hack/solution for your specific scenario if you could elaborate.
I just want the monster to, when it's not searching, go back to where it came from. Is it possible?
EDIT: and stay there
EDIT: Does it work if i make a pathnode? Then i guess it will return to the pathnode, and then get deactivated. Then when i interact with the door, it will activate again.
The game works that when the Monster isn't chasing you he goes back to the last Path node he walked to. I think
When the monster gives up searching for the player, it returns back to where it started and continues on its path (set by path nodes). The monster will get deactivated if the player is out of the monster's activation distance and if the player isn't staring at it. Reactivating the monster after it's been deactivated depends on whether or not it killed the player (though my memory on this is a bit lacking).
Nice! I did it Wink Here is my script if anyone wants it!

What happens is that when i touch the door, the monster gets active, and when i walk in the door it gets player position, but only if the monster is in that room.


void OnStart()
{
SetEntityPlayerInteractCallback("door_teacher", "OnInteract", false);
AddEntityCollideCallback("player", "playercollide1", "IfMonsterCollide", true, 1);
}

void IfMonsterCollide(string &in asParent, string &in asChild, int alState)
{
GetEntitiesCollide("monsterteacher1", "monstercollide1");

if(true)
{
ShowEnemyPlayerPosition("monsterteacher1");
}
}

void OnInteract(string &in asEntity)
{
SetEntityActive("monster_teacher1", true);
AddEnemyPatrolNode("monster_teacher1", "PathNodeArea_1", 2, "");
}