I'm new to editing and I have done a few little scripting things on my map so far, but now I am attempting to bring a key into it. I've watched a fair few tutorials, gone through heaps of threads in attempt to find an answer.. I can get into the map, no fatal errors or anything, but the key doesn't actually work on the door. I have the names right for the key and the door.
I have another item in my scripting, so if you can be awesome and look through my scripting to see where I went wrong it would mean a lot.
////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
AddUseItemCallback("", "KeyOne", "manny", "UsedKeyOnDoor", true);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Mansion_1", true, true);
StartPlayerLookAt("Mansion_1", 10.0f, 10.0f, "");
AddTimer("", 1, "stoplook");
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
GiveSanityDamage(5.0f, true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("manny", false, true);
PlaySoundAtEntity("", "unlock_door", "manny", 0, false);
RemoveItem("KeyOne");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I also have the key/door on a separate level, I'm not sure if this means I need to make a separate .hps file or not...
Thanks heaps