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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Entity Activate/Deactivate?
Bonehead Offline
Member

Posts: 50
Threads: 12
Joined: Apr 2013
Reputation: 1
#1
Entity Activate/Deactivate?

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?
(This post was last modified: 05-20-2013, 05:25 PM by Bonehead.)
05-19-2013, 08:05 AM
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#2
RE: Entity Activate/Deactivate?

SetEntityActive("nameoftheentity, "false");

Not sure if thats what you mean.
(This post was last modified: 05-19-2013, 08:33 AM by Kullin.)
05-19-2013, 08:32 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Entity Activate/Deactivate?

Yep, it can be done.
PHP Code: (Select All)
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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 05-19-2013, 08:40 AM by Romulator.)
05-19-2013, 08:39 AM
Find
Bonehead Offline
Member

Posts: 50
Threads: 12
Joined: Apr 2013
Reputation: 1
#4
RE: Entity Activate/Deactivate?

,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.
05-19-2013, 04:09 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#5
RE: Entity Activate/Deactivate?

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.

(This post was last modified: 05-19-2013, 04:13 PM by 7heDubz.)
05-19-2013, 04:12 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Entity Activate/Deactivate?

(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]
void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);
//Plays a sound.
void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
//Plays music

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-19-2013, 04:14 PM
Find
Bonehead Offline
Member

Posts: 50
Threads: 12
Joined: Apr 2013
Reputation: 1
#7
RE: Entity Activate/Deactivate?

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);
}
05-19-2013, 04:29 PM
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#8
RE: Entity Activate/Deactivate?

It don't have a sound file to load
(This post was last modified: 05-19-2013, 04:59 PM by Kullin.)
05-19-2013, 04:57 PM
Find
Bonehead Offline
Member

Posts: 50
Threads: 12
Joined: Apr 2013
Reputation: 1
#9
RE: Entity Activate/Deactivate?

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)'
(This post was last modified: 05-19-2013, 05:10 PM by Bonehead.)
05-19-2013, 05:07 PM
Find
Kullin Offline
Member

Posts: 218
Threads: 23
Joined: May 2013
Reputation: 3
#10
RE: Entity Activate/Deactivate?

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
(This post was last modified: 05-19-2013, 06:02 PM by Kullin.)
05-19-2013, 05:53 PM
Find




Users browsing this thread: 1 Guest(s)