Frictional Games Forum (read-only)

Full Version: How to activate entities ??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have a problem. Again.. lol : D
But yeah, about the problem:
I have a room that has a key in it. When I pick up the key, the script is supposed to create a couple of those knight armours in the hallway outside the room. They just don't appear when I pick up the key.
I wish someone could tell how to make entities appear when a specific action is done.

Thanks.
Are you using: SetEntityActive(string& asName, bool abActive);
(01-31-2012, 07:53 PM)Prelauncher Wrote: [ -> ]Are you using: SetEntityActive(string& asName, bool abActive);
Yeah.
Ok. would be a bit easier if I could see your script Wink but are you using this line for when the player pick up the key: SetEntityCallbackFunc(string& asName, string& asCallback);
Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity, string &in type)
Type depends on entity type and includes: “OnPickup”, “Break”, “OnIgnite”, etc
(01-31-2012, 08:19 PM)Prelauncher Wrote: [ -> ]Ok. would be a bit easier if I could see your script Wink but are you using this line for when the player pick up the key: SetEntityCallbackFunc(string& asName, string& asCallback);
Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity, string &in type)
Type depends on entity type and includes: “OnPickup”, “Break”, “OnIgnite”, etc
Here it is:
The bolded lines are the ones that should create the armors.
Lines 1-23


void OnStart()
{
AddUseItemCallback("", "key_study_1", "castle_7", "UsedKeyOnDoor2", true);
AddUseItemCallback("", "KeyOH", "castle_4", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "KeyOH", "castle_6", "UsedKeyOnDoor1", true);
AddUseItemCallback("", "key_study_2", "castle_8", "UsedKeyOnDoor3", true);
AddUseItemCallback("", "key_study_3", "castle_9", "UsedKeyOnDoor4", true);
AddUseItemCallback("", "key_study_3", "castle_10", "UsedKeyOnDoor5", true);
AddUseItemCallback("", "key_study_4", "castle_12", "UsedKeyOnDoor6", true);
AddUseItemCallback("", "key_laboratory_1", "castle_11", "UsedKeyOnDoor7", true);
AddUseItemCallback("", "key_1tohall", "1tohall_1", "UsedKeyOnLevelDoor1", true);
SetEntityPlayerInteractCallback("key_study_2", "Pickup1", true);
SetEntityPlayerInteractCallback("key_study_3", "Scare3", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Scare1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Scare2", true, 1);
}

void Pickup1(string& asName, bool abActive)
{
SetEntityActive("armor1", true);
SetEntityActive("armor2", true);
SetEntityActive("armor3", true);
}


Im not 100% sure,but try putting each of them into their own voids.
(01-31-2012, 08:29 PM)Datguy5 Wrote: [ -> ]Im not 100% sure,but try putting each of them into their own voids.
you mean like having 3 different 'SetEntityPlayerInteractCallback' lines
and then the first one calls for void Pickup1 and the second one Pickup2 and so on?
Pickup1 has the wrong callback syntax.
(01-31-2012, 08:37 PM)FinBanana Wrote: [ -> ]
(01-31-2012, 08:29 PM)Datguy5 Wrote: [ -> ]Im not 100% sure,but try putting each of them into their own voids.
you mean like having 3 different 'SetEntityPlayerInteractCallback' lines
and then the first one calls for void Pickup1 and the second one Pickup2 and so on?
I don't think that will help, Try first with only armor1 and see if it appears. And btw have you renamed the armor to armor1 armor2 etc?

EDIT: As YourComputer said
(01-31-2012, 08:43 PM)Your Computer Wrote: [ -> ]Pickup1 has the wrong callback syntax.
What it should be then ?
(01-31-2012, 08:43 PM)SilentStriker Wrote: [ -> ]
(01-31-2012, 08:37 PM)FinBanana Wrote: [ -> ]
(01-31-2012, 08:29 PM)Datguy5 Wrote: [ -> ]Im not 100% sure,but try putting each of them into their own voids.
you mean like having 3 different 'SetEntityPlayerInteractCallback' lines
and then the first one calls for void Pickup1 and the second one Pickup2 and so on?
I don't think that will help, Try first with only armor1 and see if it appears. And btw have you renamed the armor to armor1 armor2 etc?
Yeah, when I put them in the map they were something like "armour_nice_complete1" so I changed their names to only "armor1" and 2 and 3

Pages: 1 2