The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having problems with key unlocking a door scripting.
ieatbrainz Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jun 2012
Reputation: 0
#1
Having problems with key unlocking a door scripting.

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 Smile
06-10-2012, 02:46 AM
Find


Messages In This Thread
Having problems with key unlocking a door scripting. - by ieatbrainz - 06-10-2012, 02:46 AM



Users browsing this thread: 1 Guest(s)