Frictional Games Forum (read-only)

Full Version: [SOLVED]Collide doesn't work (I must be blind)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This function won't call.
No errors. No alerts.

What should happen is easy:
Door collides with area -> Monster gets active -> Monster follows pathnode -> Monster disappear

Script:

void OnStart()
{
AddEntityCollideCallback("castle_arched01_1", "AreaOpenDoorGrunt", "OpenDoorGrunt", true, 0);

AddEntityCollideCallback("servant_grunt_3", "AreaMonsterDisappear_1", "MonsterDisappear_1", true, 0);

}


void OpenDoorGrunt(string &in asParent, string &in asChild, int alState)
{

AddDebugMessage("CALLING SCRIPT", false);

if(GetLocalVarInt("MonsterIsActive") == 1)
{
return;
}

if(GetLocalVarInt("StopMonster") == 1)
{
return;
}
AddDebugMessage("MONSTER ACTIVE", false);
SetEntityActive("servant_grunt_3", true);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
SetLocalVarInt("MonsterIsActive", 1);
SetEntityActive("AreaOpenDoorGrunt", false);
}


void MonsterDisappear_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", false);
PlaySoundAtEntity("", "Enabled.snt", "AreaStopMonster", 0, false);
}

None of the 2 debug messages get called. What am I missing?
(08-29-2012, 06:55 PM)beecake Wrote: [ -> ]void OnStart()
{
AddEntityCollideCallback("castle_arched01_1", "AreaOpenDoorGrunt", "OpenDoorGrunt", true, 1);

AddEntityCollideCallback("servant_grunt_3", "AreaMonsterDisappear_1", "MonsterDisappear_1", true, 1);

}


void OpenDoorGrunt(string &in asParent, string &in asChild, int alState)
{

AddDebugMessage("CALLING SCRIPT", false);

if(GetLocalVarInt("MonsterIsActive") == 1)
{
return;
}

if(GetLocalVarInt("StopMonster") == 1)
{
return;
}
AddDebugMessage("MONSTER ACTIVE", false);
SetEntityActive("servant_grunt_3", true);
AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
SetLocalVarInt("MonsterIsActive", 1);
SetEntityActive("AreaOpenDoorGrunt", false);
}


void MonsterDisappear_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", false);
PlaySoundAtEntity("", "Enabled.snt", "AreaStopMonster", 0, false);
}
In OnStart, yu have the functions set to 0 at the end, which is both when colliding and not colliding. Basically, this function will be calling as soon as you start the level. Change them to 1 and try it again.
No why would they call when i start the level?
The door isn't colliding with them... The 0 should not be the problem...
I'm pretty sure it only triggers when it has collided, and then gets out of the area
Did you at least try it? I could agree that I'm wrong if it actually failed and try to help you more from there.
I will try when i get back from school ^_^
Damn. I had the same problem for Rising Water in its early stages, where a Suitor would come from a door, patrol a bit, then walk into a Script Area and become inactive, but I could never get it right. I eventually scrapped the idea when I came up with the whole "sea level is rising" type thing instead of the "captured and dragged into a mansion, you have to escape" idea which I originally had, instead replacing it with a Lurker that becomes active after you interact with a certain door. If I knew how to fix it, though, I would help you.

Still can't get the Lurker to get unstuck from door frames though Dodgy
I actually found out that i had to close Amnesia.exe and start it again Wink