Unlocking a level door with a key error?
Me again...
My problem now is that I want to unlock a level door with a key (not to remove the key from inventory though).
When I use the key on the door, it makes the unlocking sound, but does not unlock the door :/
I've been through all the scripting tutorials, and its not a problem connecting the two maps, as it works when the door is unlocked.
Here is my script for the map:
void OnStart()
{
SetEntityConnectionStateChangeCallback("secret_lever", "func_shelf");
AddEntityCollideCallback("Player", "door_slam", "slam", true, 1);
AddEntityCollideCallback("Player", "brute_spawn", "MonsterFunction1", true, 1);
AddEntityCollideCallback("brute_1", "brute_spawn", "NewPath", true, 1);
SetEntityCallbackFunc("key_kirk", "OnPickup");
AddUseItemCallback("", "key_kirk", "colonade", "Unlock", true);
}
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret_door",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
void slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_5", true, true);
SetSwingDoorLocked("castle_5", true, true);
PlaySoundAtEntity("", "react_pant.snt", "castle_5", 0, false);
PlaySoundAtEntity("", "00_laugh.snt", "castle_5", 0, false);
}
void OnPickup(string &in asEntity, string &in type)
{
PlayMusic("10_puzzle01.ogg", false, 1, 0.1, 10, false);
}
void MonsterFunction1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_1", true);
AddEnemyPatrolNode("brute_1", "PathNodeArea_1", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_2", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_3", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_4", 4, "");
}
void NewPath(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("brute_1", "PathNodeArea_5", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_6", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_7", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_8", 4, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_9", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_10", 0.01, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_11", 0.01, "");
}
void Unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("colonade", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "colonade", 0.0f, false);
}
void OnEnter()
{
PlayMusic("02_amb_strange", true, 1, 5, 0, true);
}
The level door is named 'colonade', and the key is names 'key_kirk'.
Any help would be a appreciated. Sorry for all these different threads I keep making :/
(This post was last modified: 03-07-2013, 11:39 PM by Hailfiretank.)
|