Frictional Games Forum (read-only)

Full Version: Pathnodes help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, im working on a custom story but im trying to do pathnodes but it never works. plz help and heres the code:


void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("key1", "OnPickup");
AddUseItemCallback("", "key1", "mansion_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("crowbar_1", "OnPickups");
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
{

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("monster_a", true);
AddEnemyPatrolNode("monster_a", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("monster_a", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("monster_a", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("monster_a", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("monster_a", "PathNodeArea_6", 4, "");
}





void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key1");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}








void func_slam(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door1", 0.0f);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);

PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

void OnLeave()
{

}
If that is the exact copy of the script, it'd be worth mentioning that the "
{" at the bottom of your onStart() is backwards, it should be "}" . If that doesn't have any effect, try adding:


ClearEnemyPatrolNodes(string& asEnemyName);



right in between setting the entity active, and adding the nodes. Hope that helps
TY buth befor you posted that i saw that the { was wrong but thanks for relpying. Big Grin