HowToAddMapsServerStendhal: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann No edit summary |
imported>Mort →Adding NPC: This was terribly outdated. I updated it, but it doesn't yet describe the new XML stuff. |
||
Line 150:
''
<pre>
});
</pre>
Line 167 ⟶ 166:
<pre>
SpeakerNPC npc =
protected void createPath() {▼
List<Path.Node> nodes=new LinkedList<Path.Node>();
▲ protected void createPath()
▲ nodes.add(new Path.Node(14,5));
}
protected void createDialog() {
// Lets the NPC reply with "Hallo" when a player greets her
// Lets the NPC reply when a player says "job"
Behaviours.addHelp(this, "Ask me to #heal you and I will help you or ask me #offer and I will show my shop's stuff.");▼
// Lets the NPC reply when a player asks for help
Behaviours.addSeller(this, new Behaviours.SellerBehaviour(shops.get("healing")));▼
▲
Behaviours.addHealer(this, 0);▼
// Makes the NPC sell potions and antidote
Behaviours.addGoodbye(this);▼
// Lets the NPC heal players for free
}
NPCList.get().add(npc);
zone.assignRPObjectID(npc);
// This determines how the NPC will look like.
npc.
npc.set(9, 5);
npc.initHP(100);
zone.add(npc);
</pre>
Just after that it is a good idea to create a path that the NPC will follow on that area.
And then create a dialog. Dialogs and such are explained in Quest sections.
Now simply assign an id to the
* setting its class to a PNG image that exists at ''data/sprites/npc''
* setting its outfit with setOutfit method.
| |||