Thread: NPC Teleport Dialogue Results in Client Freeze-up.

Results 1 to 2 of 2
  1. #1 NPC Dialogue Results in Client Freeze-up. 
    Registered Member DivideByZero's Avatar
    Join Date
    Oct 2014
    Posts
    47
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Hey guys, so I've been messing around with dialogues recently and I'm trying to set-up a NPC that teleports you places, and I've got this code, but every time I click on any of the options in "stage ==1" my client freezes. I've tried re-writting and looking for typos or anything and yes I'm using Eclipse, which is showing no issues. Is it because I've not added the rest of the Options? I.E. the stages for Combat, Minigames, and Other?

    Here's my code.

    Code:
    package com.feather.game.player.dialogues;
    
    import com.feather.Settings;
    import com.feather.cache.parser.NPCDefinitions;
    import com.feather.game.WorldTile;
    import com.feather.game.player.content.Magic;
    
    public class MrEx extends Dialogue {
    
    	private int npcId;
    
    	@Override
    	public void start() {
    		if (Settings.ECONOMY) {
    			player.getPackets().sendGameMessage("Mr.Ex is in no mood to talk to you.");
    			end();
    			return;
    		}
    		npcId = (Integer) parameters[0];
    		sendEntityDialogue(SEND_2_TEXT_CHAT,
    				new String[] { NPCDefinitions.getNPCDefinitions(npcId).name,
    						"Hello, I can teleport you all around DragonFall,",
    						" would you like to?" }, IS_NPC, npcId, 9827);
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		if (stage == -1) {
    			sendEntityDialogue(SEND_1_TEXT_CHAT,
    					new String[] { player.getDisplayName(), "Sure, why not." },
    					IS_PLAYER, player.getIndex(), 9827);
    		stage = 1;	
    		}
    			else if (stage == 1) {
    		sendOptionsDialogue("What kind of teleports are you looking for?", "Skilling",
    				"Combat", "Minigames", "Other");
    	
    		stage = 2;
    		  }
    			else if (stage == 2) {
    		    if (componentId == OPTION_1){ // Skilling
    		stage = 3;
    		sendOptionsDialogue("What would you like train?", "Thieving",
    				"Woodcutting", "Farming", "Agility", "Mining", "Next Page", "Back");
    		
    		stage = 4;
    	    }
    		    else if (stage == 4){
    		if (componentId == OPTION_1) 	// Thieving
    			Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2662, 3305, 0));
    	
    			else if (componentId == OPTION_2){// Woodcutting			
    					stage = 5;
    					sendOptionsDialogue("Where would you like to go?", "Draynor Willows", "Seer's Village Woodcutting");
    					
    				}
    			else if(stage == 5){
    							if (componentId == OPTION_1)
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3086, 3233, 0));
    							
    							else if (componentId == OPTION_2)
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2722, 3461, 0));
    							
    						
    						}
    		}
    			
    		    else if (componentId == OPTION_3){ // Farming
    				 stage = 6;
    					sendOptionsDialogue("Where would you like to go?", "Catherby Farming", " ");					
    				}
    			 else if(stage == 6){
    							if (componentId == OPTION_1){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2815, 3462, 0));
    							}
    							else if (componentId == OPTION_2){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2722, 3461, 0)); // TODO
    							}
    							
    						}
    		}
    			else if (componentId == OPTION_4){ // Agility
    				stage = 7;
    				sendOptionsDialogue("Where would you like to go?", "Barbarian", "Gnome Training");
    				
    			}
    			 else if(stage == 7){
    						if (componentId == OPTION_1){
    							Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0)); // TODO Change coords
    						}
    						else if (componentId == OPTION_2){
    							Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2474, 3437, 0));
    						}
    						
    					}
    					
    				 if(componentId == OPTION_5){ // Mining
    					stage = 6;
    							sendOptionsDialogue("Where would you like to go?", "Desert Camp Mining", "Mining Guild");
    		 	}
    				 if (stage == 6){			
    					 if(componentId == OPTION_1){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3300, 3313, 0));
    							}
    							if(componentId == OPTION_2){
    								Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3038, 9737, 0));
    							}	
    						}			
    }
    
    
    @Override
    public void finish() {
    	
    }
    }
    Thanks for any feedback ^-^
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    59
    Thanks received
    478
    Rep Power
    138
    Code:
    public class MrEx extends Dialogue {
    
    	private int npcId;
    
    	@Override
    	public void start() {
    		npcId = (Integer) parameters[0];
    		sendNPCDialogue(npcId, 9827, "Hello, I can teleport you all around DragonFall,", " would you like to?");
    	}
    
    	@Override
    	public void run(int interfaceId, int componentId) {
    		switch (stage) {
    		case -1:
    			sendPlayerDialogue(9827, "Sure, why not.");
    			stage = 0;
    			break;
    		case 0:
    			sendOptionsDialogue("What kind of teleports are you looking for?", "Skilling", "Combat", "Minigames", "Other");
    			stage = 1;
    			break;
    		case 1:
    			switch (componentId) {
    			case OPTION_1:
    				sendOptionsDialogue("What would you like train?", "Thieving", "Woodcutting", "Farming", "Agility", "Next Page");
    				stage = 2;
    				break;
    			case OPTION_2:
    				break;
    			case OPTION_3:
    				break;
    			case OPTION_4:
    				break;
    			}
    			break;
    		case 2:
    			switch (componentId) {
    			case OPTION_1:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2662, 3305, 0));
    				break;
    			case OPTION_2:
    				sendOptionsDialogue("Where would you like to go?", "Draynor Willows", "Seer's Village Woodcutting");
    				stage = 3;
    				break;
    			case OPTION_3:
    				sendOptionsDialogue("Where would you like to go?", "Catherby Farming", " ");
    				stage = 4;
    				break;
    			case OPTION_4:
    				sendOptionsDialogue("Where would you like to go?", "Barbarian", "Gnome Training");
    				stage = 5;
    				break;
    			case OPTION_5:
    				sendOptionsDialogue("What would you like train?", "Mining", "Back");
    				stage = 6;
    				break;
    			}
    			break;
    		case 3:
    			switch (componentId) {
    			case OPTION_1:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3086, 3233, 0));
    				break;
    			case OPTION_2:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2722, 3461, 0));
    				break;
    			}
    			break;
    		case 4:
    			switch (componentId) {
    			case OPTION_1:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2815, 3462, 0));
    				break;
    			case OPTION_2:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2722, 3461, 0)); // TODO
    				break;
    			}
    			break;
    		case 5:
    			switch (componentId) {
    			case OPTION_1:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3094, 3502, 0)); // TODO
    				break;
    			case OPTION_2:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2474, 3437, 0));
    				break;
    			}
    			break;
    		case 6:
    			switch (componentId) {
    			case OPTION_1:
    				sendOptionsDialogue("Where would you like to go?", "Desert Camp Mining", "Mining Guild");
    				stage = 7;
    				break;
    			case OPTION_2:
    				sendOptionsDialogue("What would you like train?", "Thieving", "Woodcutting", "Farming", "Agility", "Next Page");
    				stage = 2;
    				break;
    			}
    			break;
    		case 7:
    			switch (componentId) {
    			case OPTION_1:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3300, 3313, 0));
    				break;
    			case OPTION_2:
    				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3038, 9737, 0));
    				break;
    			}
    			break;
    		}
    	}
    
    	@Override
    	public void finish() {
    
    	}
    }
    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: 3
    Last Post: 08-13-2009, 12:03 AM
  2. Replies: 3
    Last Post: 07-21-2009, 08:42 PM
  3. Client messing up my Npcs/objects?
    By wtf why me in forum Help
    Replies: 3
    Last Post: 03-30-2009, 07:11 AM
  4. Replies: 11
    Last Post: 02-16-2009, 12:25 PM
  5. Making an NPC teleport you by Option Dialogue
    By Swarfega in forum Tutorials
    Replies: 11
    Last Post: 12-16-2008, 10:59 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
  •