Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with monster activation[SOLVED]
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#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
Kraggdog Offline
Member

Posts: 69
Threads: 12
Joined: Apr 2011
Reputation: 0
#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
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#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
Mr. Poppalopolis Offline
Junior Member

Posts: 1
Threads: 0
Joined: Apr 2011
Reputation: 0
#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
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#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
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#6
RE: Help with monster activation

I got it working now, thanks for the replies! Smile
04-14-2011, 09:32 AM
Find




Users browsing this thread: 1 Guest(s)