Thread: Help with Dialogues.

Results 1 to 5 of 5
  1. #1 Help with Dialogues. 
    Registered Member MadZ's Avatar
    Join Date
    Dec 2009
    Posts
    143
    Thanks given
    0
    Thanks received
    3
    Rep Power
    16
    Hello, I'm using Hyperion for a learning experience to understand real programming conventions, mySQL, etc.

    I was wondering if someone could explain to me how Dialogues work on Hyperion.

    I was looking through it and are having trouble understanding it.

    Here is the Dialogue.

    Code:
    <dialogue>
    		<id>0</id>
    		<type>NPC</type>
    		<lines>
    		   <string>Do you seek passage to holy Entrana? If do you must </string>
    		   <string>leave your weaponry and armour behind. This is</string>
    		   <string>Saradomin's will.</string>
    		</lines>
    		<emotion>DEFAULT</emotion>
    		<nextDialougeId>
    			<int>1</int>
    		</nextDialougeId>
          </dialogue>
    	  <dialogue>
    		<id>1</id>
    		<type>OPTION</type>
    		<lines>
    		   <string>No, not right now.</string>
    		   <string>Yes, okay. I'm ready to go.</string>
    		</lines>
    		<nextDialougeId>
    			<int>-1</int>
    			<int>2</int>
    		</nextDialougeId>
          </dialogue>
    	  <dialogue>
    		<id>2</id>
    		<type>PLAYER</type>
    		<lines>
    		   <string>Yes, okay. I'm ready to go.</string>
    		</lines>
    		<emotion>DEFAULT</emotion>
    		<nextDialougeId>
    			<int>3</int>
    		</nextDialougeId>
          </dialogue>
    	  <dialogue>
    		<id>3</id>
    		<type>NPC</type>
    		<lines>
    		   <string>Very well. One moment please.</string>
    		</lines>
    		<emotion>DEFAULT</emotion>
    		<nextDialougeId>
    			<int>4</int>
    		</nextDialougeId>
          </dialogue>
    I do understand there are 2 options, however I don't understand how the server understands when you click an option, it will obey that option. For example,

    Code:
    Where would you like to go?
    
    Home
    Train
    Pk
    Where is the method that tells it to go there? I'm just very confused.

    I did see this, but it didn't help me much.

    Code:
    private void option2(final Player player, Packet packet) {
    		int id = packet.getLEShortA();
    		if(id < 0 || id >= Constants.MAX_NPCS) {
    			return;
    		}
    		final NPC npc = (NPC) World.getWorld().getNPCs().get(id);
    		if(npc == null) {
    			return;
    		}
    		player.getActionSender().sendCloseInterface();
    		System.out.println("NPC Option 2: " + npc.getDefinition().getName() + " " + npc.getDefinition().getId());
    		final FishingSpot spot = FishingSpot.getSpot(npc.getDefinition().getId(), 2);
    		if(spot == null) {
    			player.setInteractingEntity(npc);
    		} else {
    			player.face(npc.getLocation());
    		}
    - Renegade
    [SBD="- Renegade"] Failure to play iCraig.[/SBD]
    Reply With Quote  
     

  2. #2  
    Registered Member MadZ's Avatar
    Join Date
    Dec 2009
    Posts
    143
    Thanks given
    0
    Thanks received
    3
    Rep Power
    16
    Bump.
    [SBD="- Renegade"] Failure to play iCraig.[/SBD]
    Reply With Quote  
     

  3. #3  
    Registered Member MadZ's Avatar
    Join Date
    Dec 2009
    Posts
    143
    Thanks given
    0
    Thanks received
    3
    Rep Power
    16
    Bump.
    [SBD="- Renegade"] Failure to play iCraig.[/SBD]
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Feb 2009
    Age
    27
    Posts
    2,861
    Thanks given
    127
    Thanks received
    226
    Rep Power
    700
    Code:
    	  <dialogue>
    		<id>1</id>
    		<type>OPTION</type>
    		<lines>
    		   <string>No, not right now.</string>
    		   <string>Yes, okay. I'm ready to go.</string>
    		</lines>
    		<nextDialougeId>
    			<int>-1</int>
    			<int>2</int>
    		</nextDialougeId>
          </dialogue>
    Study that. If the they click the first option, it gives them dialogue -1 (no dialogue), if they click the second one, it gives them dialogue ID 2.
    Reply With Quote  
     

  5. #5  
    Registered Member MadZ's Avatar
    Join Date
    Dec 2009
    Posts
    143
    Thanks given
    0
    Thanks received
    3
    Rep Power
    16
    That makes sense.
    [SBD="- Renegade"] Failure to play iCraig.[/SBD]
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •