Frictional Games Forum (read-only)

Full Version: Level door
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys,
I need to fix something: I've locked my level door, but I can still go through it, even though it's locked. Is there a way I can only make the shifting map code of my script work if the door is open?
you mean you can still open it, or that you can walk through it?
(05-06-2011, 11:49 PM)dragonlordsd Wrote: [ -> ]you mean you can still open it, or that you can walk through it?

I am able to use it, as in opening it, and go to the other map, even though it's locked.
If in the editor it says it is locked, then check your files and delete the .mapcache file for your map if it is there.
(05-06-2011, 11:57 PM)Kyle Wrote: [ -> ]If in the editor it says it is locked, then check your files and delete the .mapcache file for your map if it is there.

I tried it, it doesn't work, to help you think of a solution, I'll give you the code I'm using:
Code:
void OnStart()
{
    AddUseItemCallback("", "TowerKey", "TowerDoor", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("TowerDoor", "TeleportFunction", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("TowerDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "TowerDoor", 0, false);
    RemoveItem("TowerKey");
}

void TeleportFunction(string &in asEntity)
{
ChangeMap("Custom02", "PlayerStartArea_1", "", "");
}
do I maybe have to do something with an if-statement? It does look like it, but I don't know how to use it, or if it can be used in hps language.
Umm... why are you teleporting the player to change maps? Doesn't the door just automatically link to the next map?
(05-07-2011, 12:41 AM)dragonlordsd Wrote: [ -> ]Umm... why are you teleporting the player to change maps? Doesn't the door just automatically link to the next map?

Yeah, it does.

I see your mistake, you added a interact callback; that means that when ever the player touches the door, he teleports.
Code:
void OnStart()
{
AddUseItemCallback("", "TowerKey", "TowerDoor", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("TowerDoor", "TeleportFunction", true);
}


void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("TowerDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "TowerDoor", 0, false);
    RemoveItem("TowerKey");
}

void TeleportFunction(string &in asEntity)
{
if (GetSwingDoorLocked("TowerDoor") == false)
{
ChangeMap("Custom02", "PlayerStartArea_1", "", "");
}
}
This might work? But it's not a swing door. :/

Whoops... Alright, fixed that.
I'd remove all the scripting and just go via the level editor for level doors, it's a lot easier.
I tried doing it in the level editor, but now the key won't unlock the door... :/
(05-07-2011, 09:37 AM)Karai16 Wrote: [ -> ]I tried doing it in the level editor, but now the key won't unlock the door... :/

The command you're looking for, to set the level door unlocked is this:
Code:
SetLevelDoorLocked(string& asName, bool abLocked);

Swing doors are the doors that move when push or pulled.
Pages: 1 2