this is the relevant part of the script
AddEntityCollideCallback("Player", "firstscare", "closetcorpse", true, 1);
}
void closetcorpse(string &in item)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
}
the player walks into the firstscare scriptarea and the closetcorpse activates, or at least that's what is supposed to happen. I have everything punctuated right, what is wrong?
void closetcorpse(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
}
It should be like this
oh, I see! thanks mate! one more question if you please,
SetEntityPlayerInteractCallback("firstkey", "keyfunc", true);
void keyfunc(string &in asItem, string &in asEntity)
{
SetSwingDoorClosed("prison_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
this doesn't seem to work, either.
You want a key to unlock a door, right?
Code:
void OnStart()
{
AddUseItemCallback("UnlockDoor", "firstkey", "prison_1","UseKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_1", false, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
This way you can use the key on the door and it will open.
nope, I want a door to slam when the key is picked up. the key is for a different door than the one mentioned in the code.
Code:
void OnStart()
{
SetEntityCallbackFunc("firstkey", "keyfunc");
}
void keyfunc(string &in asEntity, string &in type)
{
SetSwingDoorClosed("prison_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
This should do the job.
I'm not sure if you can close the door with this function, tell me if it's not working.
yeah that worked

thanks a ton man!
one final question, for the original script, how could I get the corpse to disappear after just a second or two?
Here you go!
Code:
void closetcorpse(string &in item)
{
SetEntityActive("closetcorpse", true);
PlaySoundAtEntity("", "guardian_activated.snt", "closetcorpse", 0, false);
AddTimer("DisableCorpse", 2.5f, "TimerDisableCorpse"); //2.5f defines how long it takes to disappear
}
void TimerDisableCorpse(string &in asTimer)
{
SetEntityActive("closetcorpse", false);
}
Have fun

thanks a ton mate! you've done me a great deal of good here
No problem!
If you still have some questions feel free to ask
