04-08-2015, 02:45 AM
So I started working on a custom story today. I made a key that is supposed to unlock a door but it doesn't. When I try to use the key on the door, it simply says "Cannot use item this way".
I checked through all my code and it seems right to me. I tried the same thing on another map and it didn't work either.
The HPS file:
_________________________________________________________________
void OnEnter()
{
AddUseItemCallback("", "keystair", "doorstair", "UsedKeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("doorstair", false, true);
PlaySoundAtEntity("", "unlock_door", "doorstair", 0, false);
RemoveItem("keystair");
}
void OnLeave()
{
}
_________________________________________________________________
Also, keystair= name of key and doorstair= name of door. I checked to make sure that the objects both have the right name and they do.
I checked through all my code and it seems right to me. I tried the same thing on another map and it didn't work either.
The HPS file:
_________________________________________________________________
void OnEnter()
{
AddUseItemCallback("", "keystair", "doorstair", "UsedKeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("doorstair", false, true);
PlaySoundAtEntity("", "unlock_door", "doorstair", 0, false);
RemoveItem("keystair");
}
void OnLeave()
{
}
_________________________________________________________________
Also, keystair= name of key and doorstair= name of door. I checked to make sure that the objects both have the right name and they do.