08-01-2011, 04:23 PM
Hey, guys!
So, in my custom story I have a door set to "locked" and you must grab a key and you know, use it to unlock it.
Keys name = key_2
Doors name = keydoor_2
For some reason, the door is always unlocked and I just can't get it to stay locked.
Any ideas?
So, in my custom story I have a door set to "locked" and you must grab a key and you know, use it to unlock it.
Keys name = key_2
Doors name = keydoor_2
Code:
void OnStart()
{
AddUseItemCallback("", "key_1", "keydoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "hidden_key", "hidden_door", "KeyOnHiddenDoor", true);
SetEntityPlayerInteractCallback("key_2", "Spawn_Monster", true);
AddUseItemCallback("", "key_2", "keydoor_2", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("key_1");
SetSwingDoorLocked("keydoor_2", false, true);
PlaySoundAtEntity("", "unlock_door", "keydoor_2", 0, false);
RemoveItem("key_2");
}
void Spawn_Monster(string &in entity)
{
SetEntityActive("grunt", true);
AddEnemyPatrolNode("grunt", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("grunt", "PathNodeArea_3", 4, "");
}
For some reason, the door is always unlocked and I just can't get it to stay locked.
Any ideas?