Hello
, I think that the better way to do that is to use a lever(custom entity)-that when is attached at a mount(support) and the player move the lever in the right direction the result will be something like: unlock a door/ opens a way/unlock a gate for the next path. Using a ScriptArea is one of the easiest way in order to make the lever to attach at the specific mount (the lever is hidden somewhere "random" in the map).Here is my ScriptArea:
LevelEditor the area.rar (Size: 224.25 KB / Downloads: 135)
That ScriptArea has an EntityCollideCallback function:
AddEntityCollideCallback("Handle", "ConnectTheLever", "AttachLeverToMount", true, 1);
And the rest sequence of the HPS file:
void AttachLeverToMount(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Lever_1", true);//So I place a compound(lever and the mount) -which I set them Inactive in the level editor
SetEntityActive(asParent, false);
SetEntityActive("Mount", false);
}
//the next part is for unlocking the door depending on the lever's state(position):
//so as Romulator said before the up state is marked with number 1 which i used
void UnlockDoor(string &in asEntity, int LeverState)
{
if(LeverState == 1) {
SetSwingDoorLocked("Mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Mansion_1", 0, false);
SetLeverStuckState(asEntity, LeverState, true);//this locks the lever in the position in which the player move it
}
}
it works