Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with monster activation[SOLVED]
Author Message
Rownbear Offline
Member

Posts: 157
Joined: Apr 2011
Reputation: 2
Post: #1
Help with monster activation[SOLVED]
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
(This post was last modified: 04-14-2011 09:33 AM by Rownbear.)
04-13-2011 06:57 PM
Find all posts by this user Quote this message in a reply
Kraggdog Offline
Member

Posts: 69
Joined: Apr 2011
Reputation: 0
Post: #2
RE: Help with monster activation
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.
04-13-2011 07:16 PM
Find all posts by this user Quote this message in a reply
Rownbear Offline
Member

Posts: 157
Joined: Apr 2011
Reputation: 2
Post: #3
RE: Help with monster activation
Ah thanks! I got that working, but if anyone know how to make them activate by picking up items it would be lovely!
04-13-2011 07:20 PM
Find all posts by this user Quote this message in a reply
Mr. Poppalopolis Offline
Junior Member

Posts: 1
Joined: Apr 2011
Reputation: 0
Post: #4
RE: Help with monster activation
Try this, taken directly off the wiki:
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:
SetEntityPlayerInteractCallback("crowbar_1", "MonsterActivate1", true);

Also, make sure you change the inputs for your MonsterActivate1 function to match the callback syntax.
04-14-2011 12:37 AM
Find all posts by this user Quote this message in a reply
palistov Offline
Posting Freak

Posts: 1,175
Joined: Mar 2011
Reputation: 56
Post: #5
RE: Help with monster activation
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.

(This post was last modified: 04-14-2011 02:16 AM by palistov.)
04-14-2011 02:12 AM
Find all posts by this user Quote this message in a reply
Rownbear Offline
Member

Posts: 157
Joined: Apr 2011
Reputation: 2
Post: #6
RE: Help with monster activation
I got it working now, thanks for the replies! Smile
04-14-2011 09:32 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)