Thread: Special not working on npcs.

Results 1 to 3 of 3
  1. #1 Special not working on npcs. 
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    i did this snippet [Only registered and activated users can see links. ]

    on how to convert process into events, but now any spec done on npc doesn't work

    i removed
    Code:
    		if((clickNpcType > 0) && NPCHandler.npcs[npcClickIndex] != null) {			
    			if(goodDistance(getX(), getY(), NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY(), 1)) {
    				if(clickNpcType == 1) {
    					turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
    					NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
    					getActions().firstClickNpc(npcType);
    				}
    				if(clickNpcType == 2) {
    					turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
    					NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
    					getActions().secondClickNpc(npcType);
    				}
    				if(clickNpcType == 3) {
    					turnPlayerTo(NPCHandler.npcs[npcClickIndex].getX(), NPCHandler.npcs[npcClickIndex].getY());
    					NPCHandler.npcs[npcClickIndex].facePlayer(playerId);
    					getActions().thirdClickNpc(npcType);
    				}
    			}
    		}
    and added this under
    Code:
    clickNpcType = 1;
    Code:
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if((c.clickNpcType == 1) && NPCHandler.npcs[c.npcClickIndex] != null) {			
    							if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
    								c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
    								NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
    								c.getActions().firstClickNpc(c.npcType);
    								container.stop();
    							}
    						}
    						if(c.clickNpcType == 0 || c.clickNpcType > 1) 
    							container.stop();
    					}
    					@Override
    					public void stop() {
    						c.clickNpcType = 0;
    					}
    				}, 1);
    this under
    Code:
    clickNpcType = 2;
    Code:
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if((c.clickNpcType == 2) && NPCHandler.npcs[c.npcClickIndex] != null) {			
    							if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
    								c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
    								NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
    								c.getActions().secondClickNpc(c.npcType);
    								container.stop();
    							}
    						}
    						if(c.clickNpcType < 2 || c.clickNpcType > 2) 
    							container.stop();
    					}
    					@Override
    					public void stop() {
    						c.clickNpcType = 0;
    					}
    				}, 1);
    and this under
    Code:
    clickNpcType = 3;
    Code:
    				CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    					@Override
    					public void execute(CycleEventContainer container) {
    						if((c.clickNpcType == 3) && NPCHandler.npcs[c.npcClickIndex] != null) {			
    							if(c.goodDistance(c.getX(), c.getY(), NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY(), 1)) {
    								c.turnPlayerTo(NPCHandler.npcs[c.npcClickIndex].getX(), NPCHandler.npcs[c.npcClickIndex].getY());
    								NPCHandler.npcs[c.npcClickIndex].facePlayer(c.playerId);
    								c.getActions().thirdClickNpc(c.npcType);
    								container.stop();
    							}
    						}
    						if(c.clickNpcType < 3) 
    							container.stop();
    					}
    					@Override
    					public void stop() {
    						c.clickNpcType = 0;
    					}
    				}, 1);

    the clicknpctype 2 works when i spec say a level higher than my self and the attack option comes up as second because the npc level is higher the spec works but say im level 126 and trying to spec a rock crabs level 13 i would be the first option clicknpctype 1.... and it doesn't spec....just prints out this error

    Code:
    [2/11/01 2:20 AM]: java.lang.ArrayIndexOutOfBoundsException: 262
    [2/11/01 2:20 AM]:      at server.model.players.CombatAssistant.activateSpecial(
    CombatAssistant.java:2793)
    [2/11/01 2:20 AM]:      at server.model.players.CombatAssistant.attackNpc(Combat
    Assistant.java:208)
    [2/11/01 2:20 AM]:      at server.model.players.Client.process(Client.java:800)
    [2/11/01 2:20 AM]:      at server.model.players.PlayerHandler.process(PlayerHand
    ler.java:137)
    [2/11/01 2:20 AM]:      at server.Server.main(Server.java:165)
    here's line 2793
    Code:
    if(Server.playerHandler.players[i] == null && c.playerIndex > 0) {
    			return;
    		}
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,108
    Thanks given
    2,402
    Thanks received
    2,825
    Rep Power
    4604
    Post all of the lines up to process
    Reply With Quote  
     

  3. #3  
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    Quote Originally Posted by Gohan View Post
    Post all of the lines up to process
    fixed by my friend

    if anybody else gets this error here's what you do

    replace:
    Code:
    if(Server.npcHandler.npcs[i] == null && c.npcIndex > 0) {
    			return;
    		}
    		if(Server.playerHandler.players[i] == null && c.playerIndex > 0) {
    			return;
    		}
    with:
    Code:
    		if(Server.npcHandler.npcs[i] == null && Server.playerHandler.players[i] == null) {
    			return;
    		}
    [Only registered and activated users can see links. ]
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 12
    Last Post: 11-24-2016, 04:28 PM
  2. [PI] Special Attack VS NPCS
    By Bigger specz in forum Help
    Replies: 7
    Last Post: 10-28-2011, 11:27 PM
  3. [PI]GMaul special on NPCs?
    By Nirvana in forum Help
    Replies: 15
    Last Post: 08-20-2011, 01:49 AM
  4. Replies: 7
    Last Post: 05-30-2011, 09:01 AM
  5. Delta special fix on npcs?
    By TheRedArmy in forum Help
    Replies: 5
    Last Post: 01-09-2010, 09:39 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •