Help what is wrong in my script
So i am working on a customstory project and when i use key_1 it also unlocks the prisondoor can you help me?
void OnStart()
{
AddUseItemCallback("", "key_1", "monsterdoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "Scriptarea_1", "func_bam", true, 1);
AddUseItemCallback("", "rust_1", "prisondoor_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "banish", "BanishFunction", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor_1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
SetSwingDoorLocked("prisondoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "prisondoor_1", 0, false);
}
void func_bam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("monsterdoor_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_5", 0, "");
}
void BanishFunction(string &in asParent, string &in asChild, int alState)
{
SetEnemyDisabled("servant_grunt_2", true);
SetEntityActive("servant_grunt_2", false);
}
|