I just noticed something. You say the next thing:
int oldObjectX = server.objectHandler.ObjectX[doorID];
but in my server the doorID equals the objectModelId, so more than 1 door have the same doorID. This will probably help you out.
|
Alright, me and chase young were working on a project that would open every door in the server individually, without error. We were using this method,paired w/ an if statement *unimportant, will keep hidden until released*Code:public void openDoor(int doorID, int objectX, int objectY, String position) { int face = 0; int oldObjectX = server.objectHandler.ObjectX[doorID]; //Leeched int oldObjectY = server.objectHandler.ObjectY[doorID]; //Leeched int oldFace = server.objectHandler.ObjectFace[doorID]; //Leeched if (position.equalsIgnoreCase("east")) { face = -1; } else if (position.equalsIgnoreCase("west")) { face = -3; } else if (position.equalsIgnoreCase("south")) { face = -2; } else if (position.equalsIgnoreCase("north")) { face = 0; } else { misc.println("Invalid direction input"); } if (objectX == oldObjectX && objectY == oldObjectY && oldFace != face) { ReplaceObject2(objectX, objectY, doorID, face, 10); } else { misc.println("Error: cannot find door or face's are the same"); } }
and it would open every door to the correct face if used correctly in a switch.
anyway, this method, sadly, doesnt work. it only prints out "Error: cannot find door or face's are the same", i am simply asking anyone who knows, if they could fix it please, i will give credits in the release
I just noticed something. You say the next thing:
int oldObjectX = server.objectHandler.ObjectX[doorID];
but in my server the doorID equals the objectModelId, so more than 1 door have the same doorID. This will probably help you out.
Just remove that last if statement and see if the code works at all!
It often helps to write a debugline, try putting:
as the first line in the method.Code:System.out.println("position :" + position);
It'll most likely give you an insight in where it goes wrong, and why.
You had stuff that wasn't needed tbh lol. Also, that objecthandler class is pointless.Code:public void openDoor(int doorID, int objectX, int objectY, String position) { int face = 0; if (position.equalsIgnoreCase("east")) { face = -1; } else if (position.equalsIgnoreCase("west")) { face = -3; } else if (position.equalsIgnoreCase("south")) { face = -2; } else if (position.equalsIgnoreCase("north")) { face = 0; } if (face > -3 { System.err.println("Invalid direction input:" +face+"."); } else { ReplaceObject2(objectX, objectY, doorID, face, 10); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |