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
Script Help HELP - Climb Function (If)
Fanskapi Offline
Junior Member

Posts: 23
Threads: 5
Joined: Nov 2011
Reputation: 0
#1
HELP - Climb Function (If)

Sorry for being an (almost) complete noob...But what the hell is wrong with...


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:
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
(This post was last modified: 11-24-2011, 11:04 PM by Fanskapi.)
11-24-2011, 09:24 PM
Find
Fanskapi Offline
Junior Member

Posts: 23
Threads: 5
Joined: Nov 2011
Reputation: 0
#2
RE: HELP - Climb Function (If)

Bump.
11-24-2011, 10:30 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#3
RE: HELP - Climb Function (If)

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?
11-24-2011, 10:43 PM
Find
Fanskapi Offline
Junior Member

Posts: 23
Threads: 5
Joined: Nov 2011
Reputation: 0
#4
RE: HELP - Climb Function (If)

"LadderFunc"

Exactly like that
11-24-2011, 11:03 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: HELP - Climb Function (If)

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.

Tutorials: From Noob to Pro
11-24-2011, 11:14 PM
Website Find
Fanskapi Offline
Junior Member

Posts: 23
Threads: 5
Joined: Nov 2011
Reputation: 0
#6
RE: HELP - Climb Function (If)

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 ^^
11-25-2011, 07:05 PM
Find




Users browsing this thread: 1 Guest(s)