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
Help with hps script! (OnPickup)
Fozzarn Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#1
Help with hps script! (OnPickup)

Hi, so i saw the Activate Enemy on Item Pickup guide, but i wonder can u activate props? like statues? I tried , and no error is given when launching Amnesia, but when i pick up the key nothing happens...

I do have lots of other scripts working, so i know that i placed SetEntity, void OnPickup and dat shit on the right place. below is NOT my whole hps file, only the lines needed. I am also sure dat my key name is "key4"
Heres my Hps:

SetEntityCallbackFunc("key_4", "OnPickup");


void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("ac1", true);
SetEntityActive("ac2", true);
SetEntityActive("ac3", true);
SetEntityActive("ac4", true);
SetEntityActive("ac5", true);
SetEntityActive("ac6", true);
SetEntityActive("ac7", true);
SetEntityActive("ac8", true);
SetEntityActive("bt1", true);
SetEntityActive("bt2", true);
SetEntityActive("bt3", true);
SetEntityActive("bt4", true);
GiveSanityDamage(10.0f, true);
PlaySoundAtEntity("", "00_laugh.snt", "Player", 0, false);
}
03-21-2012, 06:01 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#2
RE: Help with hps script! (OnPickup)

I'm not sure if this is it but a game can run a whole script without any fatal errors if a syntax is incorrect. So the game runs, but that function does not work. Try changing the callback to this:

void OnPickup(string &in asEntity, string &in asType)
03-21-2012, 06:07 PM
Find
pandasFTW Offline
Member

Posts: 71
Threads: 21
Joined: Feb 2012
Reputation: 2
#3
RE: Help with hps script! (OnPickup)

(03-21-2012, 06:01 PM)Fozzarn Wrote: Hi, so i saw the Activate Enemy on Item Pickup guide, but i wonder can u activate props? like statues? I tried , and no error is given when launching Amnesia, but when i pick up the key nothing happens...

I do have lots of other scripts working, so i know that i placed SetEntity, void OnPickup and dat shit on the right place. below is NOT my whole hps file, only the lines needed. I am also sure dat my key name is "key4"
Heres my Hps:

SetEntityCallbackFunc("key_4", "OnPickup");


void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("ac1", true);
SetEntityActive("ac2", true);
SetEntityActive("ac3", true);
SetEntityActive("ac4", true);
SetEntityActive("ac5", true);
SetEntityActive("ac6", true);
SetEntityActive("ac7", true);
SetEntityActive("ac8", true);
SetEntityActive("bt1", true);
SetEntityActive("bt2", true);
SetEntityActive("bt3", true);
SetEntityActive("bt4", true);
GiveSanityDamage(10.0f, true);
PlaySoundAtEntity("", "00_laugh.snt", "Player", 0, false);
}
this is just a wild guess... really i,ve never tried it myself.
but you could try to replace the " SetEntityCallbackFunc " with "SetEntityPlayerInteractCallback"
here is what the engine scripts page says about that


void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
Calls a function when the player interacts with a certain entity.
Callback
syntax: void MyFunc(string &in asEntity)
asName - internal name
asCallback - function to
call
abRemoveOnInteraction - determines whether the callback should
be removed when the player interacts with the entity
good luck Smile

03-21-2012, 06:17 PM
Find
Fozzarn Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#4
RE: Help with hps script! (OnPickup)

Hmm, tried to replace
SetEntityCallbackFunc("key_4", "OnPickup");

with
SetEntityPlayerInteractCallback("key4", "OnPickup", false);

but same results Sad not working :/

Also tried to fix
void OnPickup(string &in asEntity, string &in asType)


but nothing Sad
03-21-2012, 06:29 PM
Find
pandasFTW Offline
Member

Posts: 71
Threads: 21
Joined: Feb 2012
Reputation: 2
#5
RE: Help with hps script! (OnPickup)

the only thing i can see wrong in that is then,,,,
you said your key name was key4 but in the script it says key_4 ... i dont know if that was a spellling mistake or??? oh and note : SCRIPTS ARE CASE SENSITIVE!!! if the key in the editor is Key4 and the name in the script is key4 with a small " k " it wont read it as a script, so make sure that is right too.
03-21-2012, 06:34 PM
Find
Fozzarn Offline
Junior Member

Posts: 5
Threads: 2
Joined: Mar 2012
Reputation: 0
#6
RE: Help with hps script! (OnPickup)

(03-21-2012, 06:34 PM)pandasFTW Wrote: the only thing i can see wrong in that is then,,,,
you said your key name was key4 but in the script it says key_4 ... i dont know if that was a spellling mistake or??? oh and note : SCRIPTS ARE CASE SENSITIVE!!! if the key in the editor is Key4 and the name in the script is key4 with a small " k " it wont read it as a script, so make sure that is right too.
What the actual fu** ... something is messing with my scripts... some of the enteties had changed name to like ac61 and so on and now key_4 ?? yeah its working now Smile thanks lad!
03-21-2012, 06:37 PM
Find
pandasFTW Offline
Member

Posts: 71
Threads: 21
Joined: Feb 2012
Reputation: 2
#7
RE: Help with hps script! (OnPickup)

haha
you are very much welcome Smile PM me anytime if ur' in need of help
03-21-2012, 06:47 PM
Find




Users browsing this thread: 4 Guest(s)