Frictional Games Forum (read-only)

Full Version: Help on locking level doors?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
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.
1. You haven't defined 'CellarLockedFunc'
2. Did you put locked in the entity tab of the level door?
(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
Everytime you are creating a new function you need something to call that function. Like a timer or a callback code
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.
Check so everything is spelled correctly. other than that I can't find a problem, probably something I missed thought
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");
}
are you using
SetEntityPlayerInteractCallback?

Since it's unlocked when you pick up the key
I'm using a UseItem callback, if that's any help.
Pages: 1 2