Frictional Games Forum (read-only)
Entity Activate/Deactivate? - 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: Entity Activate/Deactivate? (/thread-21546.html)

Pages: 1 2


Entity Activate/Deactivate? - Bonehead - 05-19-2013

I'm trying something sneaky. I want it so when the player picks up the pot full of chemicals the two suits of armor in the other room (entities) Deactivate... Then two suits of armor directly behind the player which are inactive, activate. I just have no idea on how to go about it in scripting. Anyone have any pointers?


RE: Entity Activate/Deactivate? - Kullin - 05-19-2013

SetEntityActive("nameoftheentity, "false");

Not sure if thats what you mean.


RE: Entity Activate/Deactivate? - Romulator - 05-19-2013

Yep, it can be done.
PHP Code:
OnStart()
{
SetEntityPlayerInteractCallback("Chemical_Pot""StatueAppear"true);
}

void StatueAppear(string &in asEntity)
{
SetEntityActive("Statue_1"false); //Statue in other room
SetEntityActive("Statue_2"false); //Statue in other room
SetEntityActive("Statue_3"true); //Statue behind you
SetEntityActive("Statue_4"true); //Statue behind you


Just make sure in your level editor, the "Statue_x" is named as it is in script, so if my statue were actually named boo, I would need to name the statue in the script boo.

Also, in the level editor, make sure the statues behind you are inactive and are close enough to the player to scare if this is your point, but can also allow the player to move away. Make sure as well that the player cannot get stuck inside the statues.


RE: Entity Activate/Deactivate? - Bonehead - 05-19-2013

,Thank you very much guys.. I'm slowly getting the hang of this. Tested it out and it worked great.. but now it's lacking sound. I want to make it play a sound behind the player. The particular sound being "impact_wood_heavy_low3" but when I try this the sound repeats itself nontstop.. sorry for asking so many questions.


RE: Entity Activate/Deactivate? - 7heDubz - 05-19-2013

void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);

Which one are you using.


RE: Entity Activate/Deactivate? - PutraenusAlivius - 05-19-2013

(05-19-2013, 04:12 PM)WIWWM Wrote: [script]void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);[/script]
[script]void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);[/script]

Which one are you using.
Btw, it's
Code:
[code]
[/code]
Code:
void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
//Plays a sound.
Code:
void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
//Plays music


RE: Entity Activate/Deactivate? - Bonehead - 05-19-2013

this is what I had... and now it's not working at all..

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("armour_nice_complete_8", "", 0, false);
PlaySoundAtEntity("armour_nice_complete_7", "", 0, false);
}


RE: Entity Activate/Deactivate? - Kullin - 05-19-2013

It don't have a sound file to load


RE: Entity Activate/Deactivate? - Bonehead - 05-19-2013

My bad.. had it down wrong..

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("armour_nice_complete_8", "impact_wood_heavy_low3.snt", 0, false);
PlaySoundAtEntity("armour_nice_complete_7", "impact_wood_heavy_low3.snt", 0, false);
}


EDIT: Now causing this crash

FATAL ERROR: Could not load script file 'custom_stories/TestMap/maps/test1.hps'!
main (42,2):ERR No Matching Signatures to
'PlaySoundAtEntity(string@&, const uint, const bool)
main (43,2):ERR: No Matching Signatures to
'PlaySoundAtEntity(string@&, string@&, const uint, const bool)'


RE: Entity Activate/Deactivate? - Kullin - 05-19-2013

Replace your playsoundatentity with

PlaySoundAtEntity("", "nameofthesound", "wherethesoundcomesfrom", 0.1, true);

And ofcourse change the sound name and where the sound comes from to what it should be