(04-25-2014, 08:23 AM)Mudbill Wrote: When unlocking level doors, you must use the SetLevelDoorLocked script function rather than the SetSwingDoorLocked.
You can change the name of the block to UnlockLevelDoor if you wish, then use that script within. It takes the same parameters as swing doors except for the last boolean (effects). Basically:
SetLevelDoorLocked("castle_1", false);
Its still not working... Am I doing something wrong?
void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_tomb", "castle_1", "UnlockLevelDoor", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "Script_Scare", "Scare", true, 1);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("character_infected_1", true);
SetEntityActive("deformed_man_7", true);
SetEntityActive("deformed_man_8", true);
SetEntityActive("deformed_man_9", true);
SetEntityActive("deformed_man_10", true);
SetEntityActive("deformed_man_11", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 4, "");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_door_1", 0, false);
RemoveItem(asItem);
}
void UnlockLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("castle_1", false);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem(asItem);
}
void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_12", true);
SetEntityActive("deformed_man_13", true);
SetEntityActive("deformed_man_14", true);
SetEntityActive("deformed_man_15", true);
}
void MoveShelf(string &in asEntity, int alState)
{
if (GetLocalVarInt("Check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);
PlaySoundAtEntity("", "quest_completed.snt", "Shelf", 0, false);
SetLocalVarInt("Check", 1);
return;
}
}
}