PDA

View Full Version : [PI] How to teleblock a location (such as jail) [PI]



Naughty`
January 8th, 2012, 21:47
Classes Affected: Player.Java
Difficulty: 1/10

In Player.Java make a new boolean called "inName" Name = the location you want teleblocked..... for example.... if you wanted to teleblock your jail it would look like this...



public boolean inJail() {

This makes the boolean which we will use later on....


Now..... you will add a line which will designate the area by using the coordinates within the area as follows...



if (absX > XXXX && absX < XXXX && absY > YYYY && absY < YYYY) {


replace XXXX, and YYYY with the dimensions of your jail.... for example if your jail is the combat training portion of the tutorial island it would look like this :



if (absX > 3090 && absX < 3115 && absY > 9509 && absY < 9525) {


Next we will add the line to declare the boolean as true and false...



return true;
}
return false;
}

"return true;" means that if the player is within the specified coordinates the boolean is true.
"return false;" means if they are not within the coordinates the boolean is false.

If you did it right the finished product should look like this.



public boolean inJail() {
if (absX > 3090 && absX < 3115 && absY > 9509 && absY < 9525) {
return true;
}
return false;
}

Nouish
January 8th, 2012, 21:50
public boolean inJail() {
return absX > 3090 && absX < 3115 && absY > 9509 && absY < 9525;
}

Naughty`
January 8th, 2012, 21:51
public boolean inJail() {
return absX > 3090 && absX < 3115 && absY > 9509 && absY < 9525;
}Instead of just posting it, I decided to explain it. <.<

Nouish
January 8th, 2012, 21:53
Instead of just posting it, I decided to explain it. <.<

Then explain dat one, m8 :[).

Naughty`
January 8th, 2012, 21:54
Then explain dat one, m8 :[).Explain what? Where my jail is located?