Frictional Games Forum (read-only)

Full Version: Script help: Monster spawns when picked up a key
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
we could fix it better when you post your try, so we can just correct it and you'll see what you did wrong.
I got it working now BTW, i just did the string wrong.