How to make an Object open an Interface on Devolution.
NOTE: My name Is the same as is in Moparscape, so don't say it was leeched!
Difficulty: 2/10
--------------------
Server Base: Dodian
--------------------
Classes Modified: Client.Java
----------------------------------------------
What it's supposed to do: This tutorial would probably make you learn how to open an Interface with an object.
Today, let's start off a .. Let's try a telescope for now.
But, before we start it you would need to add an object, or find an object that is a telescope.
I will be using the telescope on the second floor of Wise Old Men's Place. It is in Draynor
After you find the telescope upstairs. Let's start it.
In case you don't know how to add an object, You would use this code:
Code:
Code:
public void makeGlobalObject(int x, int y, int typeID, int orientation, int tileObjectType){ //Makes Global objects
for (Player p : server.playerHandler.players){
if(p != null){
client person = (client)p;
if((person.playerName != null || person.playerName != "null")){
if(person.distanceToPoint(x, y) <= 60){
person.createNewTileObject(x, y, typeID, orientation, tileObjectType);}}}}}
public void NewObjects() {
makeGlobalObject(####, ####, 7092, #, 10);
Then you would add this code under case 121:
Code:
OR you could use this too. It is under case 121 too:
Code:
Code:
ReplaceObject2(####, ####, 7092, #, 10);
The first "#" is for X Coords
The second "#" is for Y Coords
The "7092" is the telescope object ID.
The last "#" is for the facing. You could use 0, -1, -2 or -3
The "10" is for the facing like the southeast or southwest etc.
I will be using the telescope on the second floor of Wise Old Men's Place.
After you find the telescope upstairs. Let's start it.
Now you search for:
Code:
Code:
if (objectID == 2321) {
And on the last "}" you would add the code:
Code:
Code:
if(objectID == 7092) {
showInterface(####);
}
On the "####" let's add 3702. It is the interface for telescope.
It would look like this:
Code:
Code:
if(objectID == 7092) {
showInterface(3702);
}
If you want to use another interface, download mines. It has tons of Interface ID's:
[Only registered and activated users can see links. Click Here To Register...]
OR, you could make a void, and it would be a little bit different.
If you want to make a void, you would search for:
Code:
Code:
public void modhelp
( You could use something else, that's what I prefer.)
Then after the last "}" you can use this code:
Code:
Code:
public void telescope() {
showInterface(3702);
}
Then we should use this code instead from above, which is the first one I showed you:
Code:
Code:
if(objectID == 7092) {
telescope();
}
Then Of Course, save that and COMPILE IT!