imancity Posted June 7, 2016 Posted June 7, 2016 Like I'm on the 3rd floor of a place; the area coordinates only check ground floor, but I need to make sure he's in that third floor before continuing.
Eagle Scripts Posted June 7, 2016 Posted June 7, 2016 You can define a area with z = 3 Doing this ; new Area(new Position(x y z), new Position(x y z)) OR Position t = new position(x y z) Or tile t im not sure, not at home if (myPlayer().getPosition() == t){ \\something } 1
imancity Posted June 7, 2016 Author Posted June 7, 2016 You can define a area with z = 3 Doing this ; new Area(new Position(x y z), new Position(x y z)) OR Position t = new position(x y z) Or tile t im not sure, not at home if (myPlayer().getPosition() == t){ \\something } Ohh forreal?? That helps a ton. Thanks man! Area AREA = new Area(x1, y1, x2, y2).setPlane(z); Totally missed this post, thanks appreciate it!! 1
liverare Posted June 7, 2016 Posted June 7, 2016 (edited) If you're checking a specific Position, don't use Area and don't compare objects using "==". Keep it simple: Position myPos = myPosition(); Position targetPos = new Position(1000, 1000, 3); if (myPos.equals(targetPos)) { // You're at position } else { // You're not at position } Edit: After reading your first post, you can simply do this: Position myPos = myPosition(); if (someArea.contains(myPos) && myPos.getZ() == 3) { // You're in an area AND on the 3rd floor } else { // You're not... } You can set a plane for the Area, but that's only useful if the Area location is unique to whichever plane you're checking. For instance, if I'm in Lumbridge Castle, my Area will cover the entire castle and I will check the plane using my character's Z value, instead of setting the plane of the Area. Otherwise, I will have to constantly set that value to check what floor I'm on, which is just terrible. Example of how I would handle Lumbridge Castle's many floors to spin flax: Position myPos = myPosition(); if (lumbridgeCastle.contains(myPos)) { switch(myPos.getZ()) { case 0: // Ground floor // Climb staircase UP break; case 1: // First floor // Use spinning wheel, or go bank // upstairs break; case 2: // Second floor // Withdraw flax, or go to // spinning wheel downstairs break; } } Edited June 7, 2016 by liverare