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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"SetEntityActive" Help.
Asaratha Offline
Junior Member

Posts: 14
Threads: 5
Joined: Jul 2011
Reputation: 0
#1
"SetEntityActive" Help.

Hello, this time I'm having help with the "SetEntityActive" function, I have made it so if you pick up "potion_oil_1", it is supposed to set 5 "armour_nice_complete"s active, although, it isnt working.


void OnStart()
{
SetEntityPlayerInteractCallback("potion_oil_1", "superscare", true);
}
void superscare(string &in asItem, string &in asEntity)
{
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("armour_nice_complete_4", true);
SetEntityActive("armour_nice_complete_5", true);
}

Any ideas?
(This post was last modified: 03-14-2012, 10:47 PM by Asaratha.)
03-14-2012, 05:21 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: "SetEntityActive" Help.

Is this the only script in your .hps.

03-14-2012, 05:28 AM
Find
Asaratha Offline
Junior Member

Posts: 14
Threads: 5
Joined: Jul 2011
Reputation: 0
#3
RE: "SetEntityActive" Help.

(03-14-2012, 05:28 AM)flamez3 Wrote: Is this the only script in your .hps.
No.


void OnStart()
{
AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
AddEntityCollideCallback("Player", "prisonsound1", "Sound1", true, 1);
AddEntityCollideCallback("Player", "prisonsound2", "Sound2", true, 1);
SetEntityPlayerInteractCallback("potion_oil_1", "superscare", true);
}
void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("prison_2", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
GiveSanityDamage(5.0f, true);
}
void Sound1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "15_prisoner_scream.snt", "prisonsound1", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
GiveSanityDamage(10.0f, true);
}
void Sound2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "insanity_baby_cry.snt", "prisonsound2", 0, false);
}
void superscare(string &in asItem, string &in asEntity)
{
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("armour_nice_complete_4", true);
SetEntityActive("armour_nice_complete_5", true);
}

This is my entire .hps.
03-14-2012, 05:47 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: "SetEntityActive" Help.

Do all the other scripts work? Also, is there a error that occurs?

(This post was last modified: 03-14-2012, 06:45 AM by flamez3.)
03-14-2012, 06:44 AM
Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#5
RE: "SetEntityActive" Help.

You're using the wrong function to call that function you'd use for oil. SetEntityPlayerInteractCallback is more for when the player interacts with entities like Doors, Chairs etc. For items, use SetEntityCallbackFunc.

Like this:
void OnStart() {
SetEntityCallbackFunc("potion_oil_1", "superscare");
}

void superscare(string &in asEntity, string &in type) {

SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("armour_nice_complete_4", true);
SetEntityActive("armour_nice_complete_5", true);

}
(This post was last modified: 03-14-2012, 08:18 AM by Equil.)
03-14-2012, 08:14 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: "SetEntityActive" Help.

(03-14-2012, 08:14 AM)Equil Wrote: You're using the wrong function to call that function you'd use for oil. SetEntityPlayerInteractCallback is more for when the player interacts with entities like Doors, Chairs etc.

Actually, he just has the wrong callback syntax for the superscare function.

Tutorials: From Noob to Pro
(This post was last modified: 03-14-2012, 10:06 AM by Your Computer.)
03-14-2012, 10:05 AM
Website Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#7
RE: "SetEntityActive" Help.

(03-14-2012, 10:05 AM)Your Computer Wrote:
(03-14-2012, 08:14 AM)Equil Wrote: You're using the wrong function to call that function you'd use for oil. SetEntityPlayerInteractCallback is more for when the player interacts with entities like Doors, Chairs etc.

Actually, he just has the wrong callback syntax for the superscare function.

Ah yes, well that too. But Isn't SetEntityCallbackFunc still the more appropriate function to use? Since it includes “OnPickup”, “Break”, “OnIgnite”, etc?

(This post was last modified: 03-14-2012, 10:25 AM by Equil.)
03-14-2012, 10:25 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#8
RE: "SetEntityActive" Help.

No. I used the same one he is using, works for me with notes; I would imagine it would work with this.

03-14-2012, 10:41 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: "SetEntityActive" Help.

(03-14-2012, 10:25 AM)Equil Wrote: But Isn't SetEntityCallbackFunc still the more appropriate function to use? Since it includes “OnPickup”, “Break”, “OnIgnite”, etc?

Either one should do for whatever scenario, but for most practical cases there is no need to check for the type of interaction made. When determining which one to use, you should ask yourself: Do you need the second parameter? If you're not going to use it, then SetEntityPlayerInteractCallback would be the more logical choice.

Tutorials: From Noob to Pro
(This post was last modified: 03-14-2012, 11:33 AM by Your Computer.)
03-14-2012, 11:31 AM
Website Find
Strembitsky Offline
Senior Member

Posts: 254
Threads: 37
Joined: Feb 2012
Reputation: 3
#10
RE: "SetEntityActive" Help.

I had this problem in my CS, and I asked Statyk. He said that you cannot set static entities active/unactive, so I had to go into the model editor and change the object's properties.

The Nightmares v1.0 - Dreadful Fires WIP
03-14-2012, 02:16 PM
Find




Users browsing this thread: 1 Guest(s)