Frictional Games Forum (read-only)
Script help: Monster spawns when picked up a key - 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: Script help: Monster spawns when picked up a key (/thread-16627.html)



Script help: Monster spawns when picked up a key - jakeni96 - 06-30-2012

So, I'm making my own custom story right now, and im trying to make a monster spawn exactly when you pick up a key. I've tried to make it work a couple of times, but still no results.

If anyone knows how to fix this, tell me.


RE: Script help: Monster spawns when picked up a key - ApeCake - 06-30-2012

There are multiple ways to do this, I prefer this one.


void OnStart()
{
SetEntityCallbackFunc("NAMEofKEY", "OnPickup");
}
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "NAMEofKEY")
{
SetEntityActive("NAMEofYOURMONSTER", true);
}
}


Just make sure to UNCHECK "active" under the monstername in the level editor.


RE: Script help: Monster spawns when picked up a key - Cruzore - 06-30-2012

we could fix it better when you post your try, so we can just correct it and you'll see what you did wrong.


RE: Script help: Monster spawns when picked up a key - jakeni96 - 07-01-2012

I got it working now BTW, i just did the string wrong.