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