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
Help on locking level doors?
Wyz Offline
Junior Member

Posts: 12
Threads: 3
Joined: Jul 2012
Reputation: 0
#1
Help on locking level doors?

I recently started a new CS and I want to lock a level door in the first map, but regardless of my code, the door stays unlocked.


void OnStart()
{
SetPlayerLampOil(0);
AddEntityCollideCallback("Player", "ArmorTrigger", "ArmorTriggerFunc", true, 1);

}


//Function to make armor's head fall in cellar

void ArmorTriggerFunc(string &in asParent, string &in asChild, int alState)
{
AddPropForce("fallingArmor", 50, 0, 300, "World");
}


//Function to set "Atrium" door locked in cellar

void CellarLockedFunc(string &in asEntity)
{
SetLevelDoorLocked("Atrium", false);
}

Is there something I'm missing?
07-11-2012, 03:14 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Help on locking level doors?

I would guess that the CellarLockedFunc is called from an entity inside the level editor? and if you want to LOCK it then you should have write true instead of false.

07-11-2012, 03:21 PM
Find
Stepper321 Offline
Senior Member

Posts: 263
Threads: 26
Joined: Nov 2011
Reputation: 8
#3
RE: Help on locking level doors?

1. You haven't defined 'CellarLockedFunc'
2. Did you put locked in the entity tab of the level door?

Signature to awesome to be displayed.
07-11-2012, 03:30 PM
Find
Wyz Offline
Junior Member

Posts: 12
Threads: 3
Joined: Jul 2012
Reputation: 0
#4
RE: Help on locking level doors?

(07-11-2012, 03:30 PM)Stepper321 Wrote: 1. You haven't defined 'CellarLockedFunc'
2. Did you put locked in the entity tab of the level door?
1. Hmm, I thought since it wasn't a collide function, then it would not need a callback. Is this true? Would I define that on start?

2. I'm sure I did, I'll double check.

I got it, thank you for the replies. The SetLockedLevelDoor is only for unlocking, you set the door locked in the entity tab Tongue
(This post was last modified: 07-11-2012, 04:45 PM by Wyz.)
07-11-2012, 04:41 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: Help on locking level doors?

Everytime you are creating a new function you need something to call that function. Like a timer or a callback code

07-11-2012, 04:58 PM
Find
Wyz Offline
Junior Member

Posts: 12
Threads: 3
Joined: Jul 2012
Reputation: 0
#6
RE: Help on locking level doors?

I did not want to create a whole new thread for this, but I've got the level door locked, and when I try to use my key on it, it doesn't work and sometimes disappears before I even use it. Here's my code:


AddUseItemCallback("", "OldKey", "Atrium", "AtriumDoorUnlock", true);



void AtriumDoorUnlock(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked(asEntity, false);
PlaySoundAtEntity("", "unlock_door", "Atrium", 0, false);
RemoveItem(asItem);
}

Thanks for your help.
07-11-2012, 09:04 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: Help on locking level doors?

Check so everything is spelled correctly. other than that I can't find a problem, probably something I missed thought

07-11-2012, 09:52 PM
Find
Wyz Offline
Junior Member

Posts: 12
Threads: 3
Joined: Jul 2012
Reputation: 0
#8
RE: Help on locking level doors?

I've played around with the function a bit, but now the door is unlocked once I pick up the key.


void AtriumDoorUnlock(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Atrium", false);
PlaySoundAtEntity("", "unlock_door", "Atrium", 0, false);
RemoveItem("OldKey");
}
07-12-2012, 12:02 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: Help on locking level doors?

are you using
SetEntityPlayerInteractCallback?

Since it's unlocked when you pick up the key

07-12-2012, 12:11 AM
Find
Wyz Offline
Junior Member

Posts: 12
Threads: 3
Joined: Jul 2012
Reputation: 0
#10
RE: Help on locking level doors?

I'm using a UseItem callback, if that's any help.
07-12-2012, 12:26 AM
Find




Users browsing this thread: 5 Guest(s)