Frictional Games Forum (read-only)

Full Version: HELP - Climb Function (If)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sorry for being an (almost) complete noob...But what the hell is wrong with...


Code:
GetSwingDoorLocked("Door1");
if(GetSwingDoorLocked("Door1") == false) {
SetEntityActive("LadderFunc", true);
}

Im trying to make so when i unlock a hatch (Door1 is actually a hatch), it will activate a "climb" function (that is unactivated, atleast in the map editor) , or rather the Ladder Area thingy. I don't want it to be active all the time because then i would be able to just glitch thru it. I've been trying to solve this a bit over 1½ hours.

(Don't laugh at my newb script/programming skills) Smile


Full script for the map:
Code:
void OnStart() {

AddUseItemCallback("", "Key1", "Door1", "DoorOne", true);
AddUseItemCallback("", "Key2", "Door2", "DoorTwo", true);
GetSwingDoorLocked("Door1");
if(GetSwingDoorLocked("Door1") == false) {
SetEntityActive("LadderFunc", true);
}
}

void DoorOne(string &in asItem, string &in asEntity) {    
SetSwingDoorLocked("Door1", false, true);    
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);    
RemoveItem("Key1");                          
}

void DoorTwo(string &in asItem, string &in asEntity){    
SetSwingDoorLocked("Door2", false, true);    
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);    
RemoveItem("Key2");                          
}

EDIT: Formatted the text :S
Bump.
Is the problem that the area right now is always inactive? In that case, is the area in the level editor named "ladderfunc" or something else?
"LadderFunc"

Exactly like that
Your code logic is faulty. If you want the ladder area to activate when you unlock a door, then why is the code in OnStart where it gets called when you first load the map for the first time?

You don't have to check if the door is unlocked if you put SetEntityActive("LadderFunc", true); in the DoorOne function.
Such an easy fix, idk what struck me there... fail logic indeed. The concept was a fail too, i just continued climbing...guess basic boxes will do for the climbing ^^