Frictional Games Forum (read-only)
[SCRIPT] HELP - Climb Function (If) - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] HELP - Climb Function (If) (/thread-11488.html)



HELP - Climb Function (If) - Fanskapi - 11-24-2011

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


RE: HELP - Climb Function (If) - Fanskapi - 11-24-2011

Bump.


RE: HELP - Climb Function (If) - MrBigzy - 11-24-2011

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?



RE: HELP - Climb Function (If) - Fanskapi - 11-24-2011

"LadderFunc"

Exactly like that


RE: HELP - Climb Function (If) - Your Computer - 11-24-2011

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.


RE: HELP - Climb Function (If) - Fanskapi - 11-25-2011

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 ^^