Frictional Games Forum (read-only)
Despawn water lurker when he eats meat? - 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: Despawn water lurker when he eats meat? (/thread-22342.html)



Despawn water lurker when he eats meat? - DeAngelo - 08-06-2013

Quick question, what script would I use to despawn a water lurker once he finishes eating a piece of meat? I want to despawn him then give a message of "That should keep it busy for a while, at least long enough for me to get that gate open" (I would just make the player hurry and get out while he eats, but for some reason half the time he ignores the meat altogether, some times he finishes eating it in like 3 seconds then comes after me, and a few times he spends the proper amount of time eating it.)

Thanks.


RE: Despawn water lurker when he eats meat? - The chaser - 08-06-2013

Hmm... you could try this:

Make a script area that surrounds the water. Put this:

void OnStart()
{
for (int i=1; i<500; i++) //500 in the case that you had 500 meats
{
AddEntityCollideCallback("Meat_"+i, "ScriptWater", "AddCollision", false, 1);
}
}

void AddCollision (string &in asParent, string &in asChild, int alState)
{
SetEnemyDisableTriggers("Waterlurker", false);
AddTimer("", //Time that your waterlurker will be busy//, "Reactivate");
}

void Reactivate (string &in asTimer)
{
SetEnemyDisableTriggers("Waterlurker", true);
}

It's possible that the true's and false's of SetEnemyDisableTriggers
have to be switched, just try this basic script and if it attacks you, change the true's for a false, and viceversa.


RE: Despawn water lurker when he eats meat? - DeAngelo - 08-06-2013

Thanks, but I was just about to post that I figured it out. I couldn't find the right script because I was searching for "destroy" but it turns out I needed Break. I just put in the following script and it worked like a charm:


SetEntityCallbackFunc("LurkerBait", "EatingLurkerBait");

void EatingLurkerBait(string &in asEntity, string &in asBreak)
{
SetEntityActive("waterlurker_1", false);
SetMessage("Messages", "BusyLurker", 6);
}

This works best since the lurker gets "trapped" in a room (I plan on making some particles of him thrashing around the room once you trap him in it) then the player leaves through a doorway (A safety door with a slow lever, which is why he needed to be trapped.)

However the script you gave is neat. I'll use it if I need to do something similar later. Thanks Smile


RE: Despawn water lurker when he eats meat? - The chaser - 08-06-2013

Doesn't matter, I try to help when I can Smile