HowToAddMapsServerStendhal: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Chad3f |
imported>Kymara →Adding NPC: updated tyo make you always add to list. pls check xx |
||
| Line 113: | Line 113: | ||
Usually we add NPC to make world more alive and to use them in Quests. It is because of that reason, that is so important that you add NPC on the zone they are. |
Usually we add NPC to make world more alive and to use them in Quests. It is because of that reason, that is so important that you add NPC on the zone they are. |
||
First, you should decide if you're going to use your NPC later in a quest. |
|||
''new SpeakerNPC()'' |
''npcs.add("name",new SpeakerNPC()...)'' creates a new NPC and adds it to a global list so next time you need to get the NPC for participating in a quest, or if you want to teleportto it, you can call it by its ''name'' using ''npcs.get(name)'' |
||
<pre> |
|||
npc=new SpeakerNPC() |
|||
{ |
|||
}; |
|||
npc.setName("name"); |
|||
</pre> |
|||
Notice that in this case, you have to specify the name later in ''npc.setName()'' |
|||
''npcs.add("name",new SpeakerNPC()...)'' creates also a new NPC '''and besides''' adds it to a global list so next time you need to get the NPC for participating in a quest you can call it by its ''name'' using ''npcs.get(name)'' |
|||
<pre> |
<pre> |
||
NPC npc=npcs.add("name",new SpeakerNPC() |
NPC npc=npcs.add("name",new SpeakerNPC() |
||
| Line 137: | Line 125: | ||
In other words, ''new SpeakerNPC()'' creates just a new NPC of the class SpeakerNPC but with ''npcs.add("name",new SpeakerNPC()...)'' you are in fact extending SpeakerNPC to add new functionality. |
In other words, ''new SpeakerNPC()'' creates just a new NPC of the class SpeakerNPC but with ''npcs.add("name",new SpeakerNPC()...)'' you are in fact extending SpeakerNPC to add new functionality. |
||