Frictional Games Forum (read-only)
[SOLVED]Collide doesn't work (I must be blind) - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SOLVED]Collide doesn't work (I must be blind) (/thread-18031.html)



[SOLVED]Collide doesn't work (I must be blind) - FlawlessHappiness - 08-29-2012

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?


RE: Collide doesn't work (I must be blind) - Statyk - 08-29-2012

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


RE: Collide doesn't work (I must be blind) - FlawlessHappiness - 08-29-2012

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


RE: Collide doesn't work (I must be blind) - Statyk - 08-29-2012

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.


RE: Collide doesn't work (I must be blind) - FlawlessHappiness - 08-30-2012

I will try when i get back from school ^_^


RE: Collide doesn't work (I must be blind) - Zaffre - 09-01-2012

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


RE: Collide doesn't work (I must be blind) - FlawlessHappiness - 09-01-2012

I actually found out that i had to close Amnesia.exe and start it again Wink