04-14-2014, 03:02 PM
Alright, I have code right now that unlocks the "castle_1" when I use a "key_study_1" on the area "DoorLock_1" (which is on the door handle, to simulate the key going into the lock, not just clicking on the door xD). Is there a way I can modify the code so that I can use this same function anytime I want to open a door on the level in a similar fashion ? As right now it will only unlock "castle_1" ofc.
void UnlockingDoor(string &in key_study_1, string &in DoorLock_1)
{
SetPlayerRunSpeedMul(0);
SetPlayerMoveSpeedMul(0.2);
SetPlayerLookSpeedMul(0.3);
AddTimer("", 2.0f, "Unlocked");
SetSwingDoorLocked("castle_1", false, true);
}
void Unlocked(string &in asTimer)
{
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
SetPlayerRunSpeedMul(1);
SetPlayerMoveSpeedMul(1);
SetPlayerLookSpeedMul(1);
}
void OnEnter()
{
AddUseItemCallback("", "key_study_1", "DoorLock_1", "UnlockingDoor", true);
}
I imagine it is possible if I was using the key directly on the door itself, but I want to know is it possible the way I have it setup! Thanks
void UnlockingDoor(string &in key_study_1, string &in DoorLock_1)
{
SetPlayerRunSpeedMul(0);
SetPlayerMoveSpeedMul(0.2);
SetPlayerLookSpeedMul(0.3);
AddTimer("", 2.0f, "Unlocked");
SetSwingDoorLocked("castle_1", false, true);
}
void Unlocked(string &in asTimer)
{
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
SetPlayerRunSpeedMul(1);
SetPlayerMoveSpeedMul(1);
SetPlayerLookSpeedMul(1);
}
void OnEnter()
{
AddUseItemCallback("", "key_study_1", "DoorLock_1", "UnlockingDoor", true);
}
I imagine it is possible if I was using the key directly on the door itself, but I want to know is it possible the way I have it setup! Thanks