How do I use an item obtained from combining two others to open for example a door?
Here's my inventory.hps file:
void CombineOilKey(string &in asItemA, string&in asItemB)
{
AddPlayerSanity(10);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("key_tomb", "Puzzle", "CabinetKey", "key_tomb.tga", 0);
}
void OnGameStart()
{
AddCombineCallback("", "key_cabinet_rusty", "glass_container_oil_1", "CombineOilKey", false);
}
This script works perfectly fine, I use the Oil on the Rusty Key and get the Key I want, however I'm not sure how to use the new key for another script.
Here's the script file for the level "Second_Floor"
void UnlockCabinet(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("unlock_door.snt", "cabinet_simple_1", asEntity, 0.0f, false);
SetSwingDoorLocked("cabinet_simple_1", false, true);
RemoveItem(asItem);
}
void OnStart()
{
AddUseItemCallback("", "key_tomb", "cabinet_simple_1", "UnlockCabinet", true);
}
void OnEnter()
{
}
void OnLeave()
{
}
Obviously this is wrong, but I'm not sure what else to do. I've been staring at the script for the hand drill and hammer & chipper for a long time now and I can't make sense of it anymore >.< please help.
EDIT: Solved it! the above script should now be correct.