All right, so here's the order of things I want:
Interact with door:
If key != in inventory, display message "I need a key."
If key == in inventory, keep key and display message "My hands are too cold, I need to warm them up."
Light fire:
If key != in inventory, nothing happens.
If key == in inventory, it will now work on door.
I need to do some inventory things to make this work, it seems.
Here's my code, anyways
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
if(GetLocalVarInt("FireLit") == 1)
{
SetSwingDoorLocked("cellar_wood01", false, true);
PlaySoundAtEntity("", "unlock_door", "cellar_wood01", 0, false);
RemoveItem("shop_key");
}
if(GetLocalVarInt("FireLit") != 1)
{
SetMessage("00_woodshop", "LockedDoorNoFire", 0);
}
}
void getwarm(string &in EntityName, string &in Type)
{
if(Type == "OnIgnite")
{
CompleteQuest("questtext1","questtext1");
GiveSanityBoost();
SetLocalVarInt("firelit", 1);
}
}
It looks good to me, but it's missing parts, such as checking the inventory for the key when the door is used.
This is really complicated considering I just started working with this code two days ago, but if it works this is gonna be great.
Okay, so the code I just pasted above works almost perfectly. The only problem is that once the fire is lit, the key doesn't work on the door. It says "Can't use item this way!". However, the key does give the message that your hands are too cold if you use it without the fire. HOWEVER, if you light the fire before you pick the key up, the key works.