DpNpc
DpNpc
CREATING DUTCHPIPE "NON PLAYING CHARACTERS"
Building a NPC
DpObject
DpLiving
Building a NPC
You can build a NPC in two ways:
Make a new instance of DpNpc and call methods in it
to set it up. For simple NPCs, this is all that is needed.
For example:
. 'DpNpc.php');
$npc->addId('barkeeper');
$npc->setTitle('barkeeper');
. 'barkeeper_body.gif" width="125" height="200" border="0" alt="" '
. 'align="left" style="margin-right: 15px" />The barkeeper is '
. 'serving free beer!<br />');
By making a custom class that extends on DpNpc.
dpuniverse/npc/barkeeper.php
public function createDpNpc()
{
$this->addId('barkeeper');
$this->setTitle('barkeeper');
. 'barkeeper_body.gif" width="125" height="200" border="0" '
. 'alt="" align="left" style="margin-right: 15px" />The '
. 'barkeeper is serving free beer!<br />');
etc.
}
The class name should be the same as the filename, with the first
letter capitalized.
Note that because of PHP namespace limitations, currently the
classname must be unique in your universe. We plan on supporting
auto-class names.
There are various methods you can call (like setTitle) or define
(like createDpPage) which will be discussed next.
DpObject
DpNpc extends on the DpObject class which implements common object
functionality, so all definable methods and callable methods made
available by DpObject are also available when creating a Npc.
If you haven't done so, you should first read the
DpObject documentation.
DpLiving
Also, DpNpc extends on the DpLiving class, common code for users and
computer generated characters.
If you haven't done so, you should first read the DpLiving
documentation.