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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help my door does not lock
Calypse1 Offline
Junior Member

Posts: 7
Threads: 3
Joined: Jan 2012
Reputation: 0
#1
my door does not lock

Hello, I have been trying to get my script to work for quite a while now but it does not seem to work. The thing i want to happen is that: a door is locked, i pick up a key and open the lock. But what happens is that i pick up the key and use it on the door and that works fine, but the door is open before i use the key. Making the key useless unless you want to hear the unlock_door sound Big Grin

Please help!

Here is my script so far


////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
AddEntityCollideCallback("Player", "cookarea", "CollideCookArea", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "oohnoo", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "hejmonster", true, 1);
AddEntityCollideCallback("Player", "RoomTwoArea1", "CollideRoomTwo1", true, 1);
AddEntityCollideCallback("Player", "Walk_Quest_Area", "GetWalkQuest", true, 1);
AddEntityCollideCallback("Player", "Walk_Complete_Area", "FinishWalkQuest", true, 1);
AddEntityCollideCallback("Player", "Walk_Quest_Area_1", "GetWalkQuest1", true, 1);
AddEntityCollideCallback("Player", "Walk_Complete_Area_1", "FinishWalkQuest1", true, 1);
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
SetSwingDoorLocked("mansion_1", true, true);
}
void CollideCookArea(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_wall_stomp", "Player", 0, false);
AddPropImpulse("cook", 0, 0, 5, "");
GiveSanityDamage(30, true);
AddEntityCollideCallback("Player", "AfterCookArea", "CollideAfterCookArea", true, 1);
}
void oohnoo(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("BoxLight_2", false);
GiveSanityDamage(10, true);
PlayMusic("01_amb_darkness.ogg", true, 1, 3, 0, true);
}
void hejmonster(string &in asParent, string &in asChild, int alState)
{
PlayMusic("amb_alert01.ogg", false, 1, 3, 0, false);
}
void CollideRoomTwo1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_6", true, true);
SetSwingDoorLocked("mansion_6", true, true);
}
void GetWalkQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("walkquest", "WalkQuest");
}

void FinishWalkQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("walkquest", "WalkQuest");
}
void GetWalkQuest1(string &in asParent, string &in asChild, int alState)
{
AddQuest("walkquest1", "WalkQuest1");
}

void FinishWalkQuest1(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("walkquest1", "WalkQuest1");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor", 0.0f, true);
RemoveItem("monsterdoorkey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
01-29-2012, 10:32 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: my door does not lock

Have you checked the box Locked on the door in the level editor? Smile

01-29-2012, 10:59 PM
Find
Calypse1 Offline
Junior Member

Posts: 7
Threads: 3
Joined: Jan 2012
Reputation: 0
#3
RE: my door does not lock

(01-29-2012, 10:59 PM)SilentStriker Wrote: Have you checked the box Locked on the door in the level editor? Smile
thank you, well i feel like an idiot now Big Grin
01-29-2012, 11:08 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: my door does not lock

(01-29-2012, 11:08 PM)Calypse1 Wrote:
(01-29-2012, 10:59 PM)SilentStriker Wrote: Have you checked the box Locked on the door in the level editor? Smile
thank you, well i feel like an idiot now Big Grin
Well it's a newbie mistake don't worry ^^


01-29-2012, 11:08 PM
Find




Users browsing this thread: 1 Guest(s)