Hi, guys.
I am trying to call a certain func when the player interacts with a door and the door is not locked. However, the function just keeps repeating when the player interacts and I want it to stop after it is called once. Here is my script.
void OnStart()
{
SetEntityPlayerInteractCallback("mansion_6", "Fade", false);
}
void Fade(string &in asEntity)
{
if(GetSwingDoorLocked("mansion_6") == false)
{
SetSwingDoorClosed("mansion_3", true, true);
SetSwingDoorLocked("mansion_3", true, true);
PlaySoundAtEntity("", "guardian_activated.snt", "Player", 0, false);
GiveSanityDamage(10, true);
StartScreenShake(0.05f, 3.5f, 1.25f, 3.5f);
FadePlayerRollTo(-50, 33, 33);
MovePlayerHeadPos(0, -1, 0, 1, 0);
PlaySoundAtEntity("", "player_bodyfall.snt", "Player", 0, false);
SetPlayerCrouching(true);
SetPlayerActive(false);
FadeOut(7);
AddTimer("", 13, "Fog");
}
}
If I change the
SetEntityPlayerInteractCallback("mansion_6", "Fade", false);
to
SetEntityPlayerInteractCallback("mansion_6", "Fade", true);
The "Fade" won't be called if the player has already interacted with the door when it's locked. If it remains "false" it will just continue to repeat (the player will just fade every time he touches the door if it isn't locked and I want him to fade only the first time). Quite a head rush, eh ?
. I hope it has a solution