Hehe, didn't the original LoZ have a glitch just like that in the first dungeon?
Quote from: Fat Cerberus on September 04, 2017, 01:06:05 pmHehe, didn't the original LoZ have a glitch just like that in the first dungeon?Only with the first northern door. You had to leave and reenter level 1 to make the door vanish.Currently, in ZeC, it's all doors. The same issue occurs if I unlock the Eastern door pictured in the image or other doors in the dungeon. I can't figure out how that is occurring due to the fact that only the current doors variable being is being accessed.
var data = {name:"hi", open:false};//And then set another variable to equal that object:var foo = data;//the object is not copied, rather a reference to it is passed//so...foo.open = true;//will result inif(data.open===true){ //this code would be executed}
Code: [Select]var foo = data;
var foo = data;
Currently, each dungeon level has its own js file with its own variables. So all of the variables for Kain's Tomb (short handed as KT) are stored in kainstomb.js. Kain's Tomb is a 21 room dungeon level. The code would be a huge mess if I tried to store everything in 1 file. Not every room has a door that requires a key, so the amount of variables are at a minimum.I've designed a function called UseKey. It is currently set as UseKey(name, v). Name being the name of the door, v being the variable of the door. The function "unlocks" the door. When called it:Determines if it is a normal key or magic keysets v equal to falseDestroyPerson(name)Dectucts a key from NumKeys if a normal key was used.
var x = 812;function f(v) { v = 1208; }f(x);// x is still == 812 here!
Just to be clear, this doesn't do what you think it does:Code: [Select]var x = 812;function f(v) { v = 1208; }f(x);// x is still == 812 here!
function modify(obj) { obj.c = -128; // note: this *still* wouldn't work: // obj = somethingElse}var obj = { a: 812, b: 1208, c: 0 };modify(obj);// obj.c == -128 now
Okay, well like I said above, setting v = false; inside the function won't have any effect. When you pass a variable to a function you're actually just passing the value, so that just sets your local copy of v. If you want to modify something you passed into the function, you'd have to pass in an object, e.g.:Code: (javascript) [Select]function modify(obj) { obj.c = -128; // note: this *still* wouldn't work: // obj = somethingElse}var obj = { a: 812, b: 1208, c: 0 };modify(obj);// obj.c == -128 nowI can't understand why that would cause ALL your doors to get unlocked though.