Frictional Games Forum (read-only)
How to activate entities ?? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to activate entities ?? (/thread-12999.html)

Pages: 1 2


How to activate entities ?? - FinBanana - 01-31-2012

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.


RE: How to activate entities ?? - Prelauncher - 01-31-2012

Are you using: SetEntityActive(string& asName, bool abActive);


RE: How to activate entities ?? - FinBanana - 01-31-2012

(01-31-2012, 07:53 PM)Prelauncher Wrote: Are you using: SetEntityActive(string& asName, bool abActive);
Yeah.



RE: How to activate entities ?? - Prelauncher - 01-31-2012

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


RE: How to activate entities ?? - FinBanana - 01-31-2012

(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);
}





RE: How to activate entities ?? - Datguy5 - 01-31-2012

Im not 100% sure,but try putting each of them into their own voids.


RE: How to activate entities ?? - FinBanana - 01-31-2012

(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?


RE: How to activate entities ?? - Your Computer - 01-31-2012

Pickup1 has the wrong callback syntax.


RE: How to activate entities ?? - SilentStriker - 01-31-2012

(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


RE: How to activate entities ?? - FinBanana - 01-31-2012

(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