Frictional Games Forum (read-only)
Help with monster activation[SOLVED] - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Help with monster activation[SOLVED] (/thread-7346.html)



Help with monster activation[SOLVED] - Rownbear - 04-13-2011

I want to activate a grunt when I pick up the crowbar but i keep getting error on my script, Unexpected token {. goes away when i remove this part and I dunno what's wrong

Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "crowbar_1", "MonsterActivate1", true);
}

void MonsterActivate1(string& asName, bool abActive);
{
SetEntityActive("servant_grunt_1", true);
}


please help


RE: Help with monster activation - Kraggdog - 04-13-2011

I haven't gotten a monster to spawn with picking up items yet.. but my work around is too create an area around the item that the player will enter.. then you can set a timer and activate the monster.


RE: Help with monster activation - Rownbear - 04-13-2011

Ah thanks! I got that working, but if anyone know how to make them activate by picking up items it would be lovely!


RE: Help with monster activation - Mr. Poppalopolis - 04-14-2011

Try this, taken directly off the wiki:
Code:
void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in entity)

asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity

For you, this would mean you should use:
Code:
SetEntityPlayerInteractCallback("crowbar_1", "MonsterActivate1", true);

Also, make sure you change the inputs for your MonsterActivate1 function to match the callback syntax.


RE: Help with monster activation - palistov - 04-14-2011

Collide means that the two entities literally collide, as in, physically touch. Picking up the crowbar doesn't count as collision. You'll need a interact callback. Select the crowbar in the editor, and find the callback field. Write CrowbarPickUp. Then, in your script, put a function:

void CrowbarPickUp(string &in entity, string &in type)
{
//grunt stuff here.
}

That should do the trick.


RE: Help with monster activation - Rownbear - 04-14-2011

I got it working now, thanks for the replies! Smile