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
please help
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.
Ah thanks! I got that working, but if anyone know how to make them activate by picking up items it would be lovely!
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.
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.
I got it working now, thanks for the replies!