Stendhal NPC Coding: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>Kymara m remove strange snetence |
imported>Kymara add description setting. remove outdated code line |
||
| Line 95: | Line 95: | ||
}); |
}); |
||
zone.assignRPObjectID(npc); |
|||
// This determines how the NPC will look like. welcomernpc.png is a picture in data/sprites/npc/ |
// This determines how the NPC will look like. welcomernpc.png is a picture in data/sprites/npc/ |
||
npc.setEntityClass("welcomernpc"); |
npc.setEntityClass("welcomernpc"); |
||
// set a description for when a player does 'Look' |
|||
npc.setDescription("You see Mr Healer, he looks a a bit busy at the moment but perhaps he can help you anyway."); |
|||
// Set the initial position to be the first node on the Path you defined above. |
// Set the initial position to be the first node on the Path you defined above. |
||
npc.setPosition(9, 5); |
npc.setPosition(9, 5); |
||
| Line 135: | Line 136: | ||
* setting its class to a PNG image that exists at ''data/sprites/npc'', e.g. <code>npc.setEntityClass("welcomernpc");</code> |
* setting its class to a PNG image that exists at ''data/sprites/npc'', e.g. <code>npc.setEntityClass("welcomernpc");</code> |
||
* setting its outfit with setOutfit method e.g. <code>npc.setOutfit(new Outfit(0, 05, 01, 06, 01));</code>. See [http://stendhalgame.org/hudson/job/stendhal_HEAD/javadoc/games/stendhal/server/entity/Outfit.html Outfit javadoc] |
* setting its outfit with setOutfit method e.g. <code>npc.setOutfit(new Outfit(0, 05, 01, 06, 01));</code>. See [http://stendhalgame.org/hudson/job/stendhal_HEAD/javadoc/games/stendhal/server/entity/Outfit.html Outfit javadoc] |
||
It is nice to set a description for when the player does ''Look''. If you don't set one, it will just say: ''You see [NPC Name].'' |
|||
Finally set its initial position and its HP. Don't worry for your NPC. It can't be attacked nor killed. |
Finally set its initial position and its HP. Don't worry for your NPC. It can't be attacked nor killed. |
||