Jump to content

kuriku

Members
  • Posts

    120
  • Credits

  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Everything posted by kuriku

  1. If you read the GOD patch notes, you can notice this: - There are no R-Grade or higher Kamael exclusive weapons, and all races can freely equip R-Grade weapons. It means no more Ancient Swords and Rapier Swords. The Soulhound will use Magic Swords and the Doombringer will use Big Sword (possibly). Crossbow can be able for all the archers classes. http://www.l2pink.com/lineage2/goddess-of-destruction-korean-pts-patchnotes-lineage-2/
  2. All the Instance that I see in L2j have the method openDoor(). For example, in Dark Cloud Mansion or Crystal Caverns. I've just copied the method and I don't know why I have this error if the method identical.
  3. Song of Purification has two slots on activated. When you buff yourself with song of purification or relog, the first effect appears and dissapears. Try without Song of Purification.
  4. I'm making a Custom Instance in Java, and i'm testing different possibilities. But I have a little error when in mi Instance I want to open/close door by java script (when you complete a condition for example). The Instance runs perfectly. When I kill the two MOBs of the first room, spawns the next condition and spawns three aditional MOBs in the other room. The problem is only with doors. Here is the full code: package instances.InstanceTest; import javolution.util.FastList; import javolution.util.FastMap; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; public class InstanceTest extends Quest { //NPCs private static int ENTER = 40000; //Exit Instance Test private static int EXIT = 40001; //Exit Instance Test //Mobs private static int[] MOBTEST = {40002,40003,40004}; //Test MOB for Instance //Doors/Walls private static int DOOR1 = 24230001; //Starting Room private static int DOOR2 = 24230002; //Exit Room //Items private static int REWARD = 57; //Adena // Instance reenter time // default: 86400000ms(24h) private static final int INSTANCEPENALTY = 60000; public InstanceTest(int questId, String name, String descr) { super(questId, name, descr); addStartNpc(ENTER); addTalkId(ENTER); addFirstTalkId(EXIT); addTalkId(EXIT); for (int mob : MOBTEST) addAttackId(mob); for (int mob : MOBTEST) addKillId(mob); } private static class ITestNpc { public L2Npc npc; public boolean isDead = false; } private static class ITestRoom { public FastList<ITestNpc> npcList = new FastList<ITestNpc>(); } private class ITestWorld extends InstanceWorld { public FastMap<String,ITestRoom> rooms = new FastMap<String,ITestRoom>(); public ITestWorld() { } } private static boolean debug = false; private static boolean noRndWalk = true; private static String qn = "InstanceTest"; private static final int INSTANCEID = 1000; private static class teleCoord {int instanceId; int x; int y; int z;} private boolean checkConditions(L2PcInstance player) { if (debug) return true; else { L2Party party = player.getParty(); if (party == null) { player.sendMessage("No estas en Party, por lo tanto no puedes entrar."); return false; } if (party.getLeader() != player) { player.sendMessage("Solo el lider de Party puede decidir entrar en la Instance."); return false; } if (party.getMemberCount() > 2) { player.sendMessage("No hay suficientes miembros en la Party para entrar. Lo minimo son dos personas."); return false; } for (L2PcInstance partyMember : party.getPartyMembers()) { if (partyMember.getLevel() < 78) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); sm.addPcName(partyMember); player.sendPacket(sm); return false; } if (!partyMember.isInsideRadius(player, 1000, true, true)) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return false; } Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID); if (System.currentTimeMillis() < reentertime) { SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); sm.addPcName(partyMember); party.broadcastToPartyMembers(sm); return false; } } return true; } } private void teleportplayer(L2PcInstance player, teleCoord teleto) { player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); player.setInstanceId(teleto.instanceId); player.teleToLocation(teleto.x, teleto.y, teleto.z); return; } protected int enterInstance(L2PcInstance player, String template, teleCoord teleto) { int instanceId = 0; //check for existing instances for this player InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); //existing instance if (world != null) { if (!(world instanceof ITestWorld)) { player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER)); return 0; } teleto.instanceId = world.instanceId; teleportplayer(player,teleto); return instanceId; } //New instance else { if (!checkConditions(player)) return 0; L2Party party = player.getParty(); instanceId = InstanceManager.getInstance().createDynamicInstance(template); world = new ITestWorld(); world.instanceId = instanceId; world.templateId = INSTANCEID; InstanceManager.getInstance().addWorld(world); _log.info("Instance Test: started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); runStartRoomInstanceTest((ITestWorld)world); // teleport players teleto.instanceId = instanceId; if (debug && party == null) { InstanceManager.getInstance().setInstanceTime(player.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY))); world.allowed.add(player.getObjectId()); teleportplayer(player,teleto); } else { for (L2PcInstance partyMember : party.getPartyMembers()) { if (partyMember.getQuestState(qn) == null) newQuestState(partyMember); InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), INSTANCEID, ((System.currentTimeMillis() + INSTANCEPENALTY))); teleportplayer(partyMember,teleto); world.allowed.add(partyMember.getObjectId()); } } return instanceId; } } protected void exitInstance(L2PcInstance player, teleCoord tele) { player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); player.setInstanceId(0); player.teleToLocation(tele.x, tele.y, tele.z); } protected void runStartRoomInstanceTest(ITestWorld world) { world.status = 0; ITestRoom StartRoomTest = new ITestRoom(); ITestNpc thisnpc; thisnpc = new ITestNpc(); thisnpc.npc = addSpawn(MOBTEST[0],146817,180335,-6117,0,false,0,false, world.instanceId); StartRoomTest.npcList.add(thisnpc); if (noRndWalk) thisnpc.npc.setIsNoRndWalk(true); thisnpc = new ITestNpc(); thisnpc.npc = addSpawn(MOBTEST[1],146741,180589,-6117,0,false,0,false, world.instanceId); StartRoomTest.npcList.add(thisnpc); if (noRndWalk) thisnpc.npc.setIsNoRndWalk(true); world.rooms.put("StartRoomTest", StartRoomTest); if (debug) _log.info("Instance Test: primera sala iniciada " + world.instanceId); } protected void runHallInstanceTest(ITestWorld world) { spawnHallInstanceTest(world); world.status = 1; InstanceManager.getInstance().getInstance(world.instanceId).getDoor(DOOR1).openMe(); } protected void spawnHallInstanceTest(ITestWorld world) { ITestRoom HallTest = new ITestRoom(); ITestNpc thisnpc; world.rooms.remove("HallTest"); //remove room instance to avoid adding mob every time thisnpc = new ITestNpc(); thisnpc.npc = addSpawn(MOBTEST[0],147217,180112,-6117,0,false,0,false, world.instanceId); if (noRndWalk) thisnpc.npc.setIsNoRndWalk(true); HallTest.npcList.add(thisnpc); thisnpc = new ITestNpc(); thisnpc.npc = addSpawn(MOBTEST[1],147217,180209,-6117,0,false,0,false, world.instanceId); if (noRndWalk) thisnpc.npc.setIsNoRndWalk(true); HallTest.npcList.add(thisnpc); thisnpc = new ITestNpc(); thisnpc.npc = addSpawn(MOBTEST[2],148521,180112,-6117,0,false,0,false, world.instanceId); if (noRndWalk) thisnpc.npc.setIsNoRndWalk(true); HallTest.npcList.add(thisnpc); world.rooms.put("HallTest", HallTest); if (debug) _log.info("Instance Test: Hall Test spawned"); } protected void endInstanceTest(ITestWorld world) { world.status = 2; addSpawn(EXIT,147813,179654,-6117,16383,false,0,false,world.instanceId); world.rooms.clear(); if (debug) _log.info("Instance Test: acabada"); } protected boolean checkKillProgress(L2Npc npc, ITestRoom room) { boolean cont = true; for (ITestNpc npcobj : room.npcList) { if (npcobj.npc == npc) npcobj.isDead = true; if (npcobj.isDead == false) cont = false; } return cont; } @Override public String onKill( L2Npc npc, L2PcInstance player, boolean isPet) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); ITestWorld world; if (tmpworld instanceof ITestWorld) { world = (ITestWorld)tmpworld; if (world.status==0) { if (checkKillProgress(npc, world.rooms.get("StartRoomTest"))) runHallInstanceTest(world); } if (world.status==1) { if (checkKillProgress(npc,world.rooms.get("HallTest"))) endInstanceTest(world); } } return ""; } @Override public String onFirstTalk (L2Npc npc, L2PcInstance player) { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); ITestWorld world; if (tmpworld instanceof ITestWorld) { world = (ITestWorld)tmpworld; if (npc.getNpcId() == EXIT && world.status == 2) { npc.showChatWindow(player); QuestState st = player.getQuestState(qn); if (st == null) st = newQuestState(player); if (st.getQuestItemsCount(REWARD) > 1) st.giveItems(REWARD,7777); } } return ""; } @Override public String onTalk (L2Npc npc, L2PcInstance player) { int npcId = npc.getNpcId(); if (npcId == ENTER) { teleCoord tele = new teleCoord(); tele.x = 146534; tele.y = 180464; tele.z = -6117; enterInstance(player, "InstanceTest.xml", tele); } else { InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); ITestWorld world; if (tmpworld instanceof ITestWorld) world = (ITestWorld)tmpworld; else return ""; if (npcId == EXIT) { teleCoord tele = new teleCoord(); tele.x = 139968; tele.y = 150367; tele.z = -3111; if (world.allowed.contains(player.getObjectId())) { if (debug) _log.info("Instance Test - id " + player.getObjectId() + " removed from allowed player in this Instances."); world.allowed.remove(world.allowed.indexOf(player.getObjectId())); } exitInstance(player,tele); int instanceId = npc.getInstanceId(); Instance instance = InstanceManager.getInstance().getInstance(instanceId); if (instance.getPlayers().isEmpty()) InstanceManager.getInstance().destroyInstance(instanceId); return ""; } } return ""; } public static void main(String[] args) { // now call the constructor (starts up the) new InstanceTest(-1,"InstanceTest",qn); } } And here is the error: C:\Server\gameserver\data\scripts\instances\InstanceTest\InstanceTest.java java.lang.NullPointerException at instances.InstanceTest.InstanceTest.openDoor(InstanceTest.java:87) at instances.InstanceTest.InstanceTest.runHallInstanceTest(InstanceTest. java:244) at instances.InstanceTest.InstanceTest.onKill(InstanceTest.java:312) at com.l2jserver.gameserver.model.quest.Quest.notifyKill(Quest.java:476) at com.l2jserver.gameserver.model.actor.L2Attackable$OnKillNotifyTask.ru n(L2Attackable.java:572) at com.l2jserver.gameserver.ThreadPoolManager$RunnableWrapper.run(Thread PoolManager.java:86) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) java.lang.NullPointerException at instances.InstanceTest.InstanceTest.openDoor(InstanceTest.java:87) at instances.InstanceTest.InstanceTest.runHallInstanceTest(InstanceTest. java:244) at instances.InstanceTest.InstanceTest.onKill(InstanceTest.java:312) at com.l2jserver.gameserver.model.quest.Quest.notifyKill(Quest.java:476) at com.l2jserver.gameserver.model.actor.L2Attackable$OnKillNotifyTask.ru n(L2Attackable.java:572) at com.l2jserver.gameserver.ThreadPoolManager$RunnableWrapper.run(Thread PoolManager.java:86) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Can someone help me to fix this error?
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock