Frictional Games Forum (read-only)

Full Version: Entity Activate/Deactivate?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
SetEntityActive("nameoftheentity, "false");

Not sure if thats what you mean.
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.
,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.
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.
(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
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);
}
It don't have a sound file to load
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)'
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
Pages: 1 2