<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://planeshift.top-ix.org//pswiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Magodra</id>
	<title>PSwiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://planeshift.top-ix.org//pswiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Magodra"/>
	<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php/Special:Contributions/Magodra"/>
	<updated>2026-04-05T22:34:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20223</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20223"/>
		<updated>2014-01-10T23:39:05Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* NPC tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;: &amp;lt;Message&amp;gt;[Narrate|actionmy|action]&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message. A block starting with [ and ending with ] will give a /narrate, /my or /me command. If the block do not start with the npc name it will be a narrate. If it starts with the npc name it will be a /me, and if &#039; follows the npc name it will be a /my.&lt;br /&gt;
&lt;br /&gt;
 Ex: Harnquist: How do you do?[Harnquist looks down!]&lt;br /&gt;
     Harnquist: How do you do?[Harnquist&#039; cat looks at you.]&lt;br /&gt;
     Harnquist: How do you do?[As he finishes talking, you notice clouds darkening on the horizon...]&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Trigger text&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc. The text is the trigger text for the player message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20222</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20222"/>
		<updated>2014-01-10T23:35:19Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* NPC tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;: &amp;lt;Message&amp;gt;[Narrate|actionmy|action]&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
 Ex: Harnquist: How do you do?[Harnquist looks down!]&lt;br /&gt;
     Harnquist: How do you do?[Harnquist&#039; cat looks at you.]&lt;br /&gt;
     Harnquist: How do you do?[As he finishes talking, you notice clouds darkening on the horizon...]&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Trigger text&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc. The text is the trigger text for the player message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20221</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20221"/>
		<updated>2014-01-10T23:34:17Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* NPC tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;: &amp;lt;Message&amp;gt;[Narrate|actionmy|action]&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
 Ex: Harnquist: How do you do?[Harnquist looks down!]&lt;br /&gt;
     Harnquist: How do you do?[Harnquist&#039; cat looks at you.]&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Trigger text&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc. The text is the trigger text for the player message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20220</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20220"/>
		<updated>2014-01-10T22:57:09Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* NPC tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;: &amp;lt;Message&amp;gt;[Narrate|actionmy|action]&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
 Ex: Harnquist: How do you do?[Harnquist looks down!]&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Trigger text&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc. The text is the trigger text for the player message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20219</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20219"/>
		<updated>2014-01-10T22:51:34Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Player tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Trigger text&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc. The text is the trigger text for the player message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20218</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20218"/>
		<updated>2014-01-10T22:51:02Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Player tell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Ex: P: hello&lt;br /&gt;
     P: Yes P: No&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20206</id>
		<title>Custom NPC Dialogue</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20206"/>
		<updated>2014-01-04T21:17:37Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Referencing other NPCs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Custom NPC Dialogues are a subset of [[NPC Dialogues]] / [[Quest Script Operations]] that is include only functions that players can use to script NPCs. Actions that could be exploited to gain money or items is not included.&lt;br /&gt;
&lt;br /&gt;
= Limitation =&lt;br /&gt;
&lt;br /&gt;
== Referencing other NPCs ==&lt;br /&gt;
Custon NPC Dialogues is not allowed to reference other NPCs. The NPC Tell command will be a generic syntax using the keyword NPC instead of the NPC Name. The &amp;quot;&amp;lt;NPC Name&amp;gt;:&amp;lt;message&amp;gt;.&amp;quot; is not allowed. For Custom NPC Dialogues the syntax will be &amp;quot;NPC: &amp;lt;message&amp;gt;.&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 Syntax: NPC: &amp;lt;message&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Ex: NPC:Hello&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
This section contain description and rationales for the limitations that needs to be created.&lt;br /&gt;
&lt;br /&gt;
Possible ways to exploit the quest syntax by players writing their own quests.&lt;br /&gt;
&lt;br /&gt;
The following commands need to be blocked from use, or severely limited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - Give [quantity] [quality] [item]&lt;br /&gt;
** They will be able to spawn any item in the the BD with qualities upto 300/300&lt;br /&gt;
** Preventative action - block access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]complete [quest name] [step x].&lt;br /&gt;
** This will allow players to modify any quest in the game. Exploit as players could do anything they wanted with restarting/modifying/completing any quest in the game.&lt;br /&gt;
** Preventative action - Limit the command to ONLY work with the quest it is written in. This must not be a generic feature as official quests use this cross quest referencing a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]setvariable [variable name] [value]&lt;br /&gt;
** This would allow players to modify any variable in the game, would cause massive problems.&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - doadmincmd [command]&lt;br /&gt;
** This would let the player run GM commands, clearly a massive exploit&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - run script [script name] [script variables]&lt;br /&gt;
** This would let players run any script&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest menu trigger - Player gives [npc name] [value] [items]&lt;br /&gt;
** This would allow players to trick other players into giving almost any item to an npc and they would not be able to recover the item. A player could for example use &amp;quot;Player gives test guard 10000000 tria.&amp;quot;&lt;br /&gt;
** Preventative action - This style of trigger should be removed from use by players. OR it should be modified such that in player written quests all giving by players MUST be MANUAL only, not automatic using the menu clicks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest dialog - referencing other NPCs in quests.&lt;br /&gt;
** Players should not be allowed to reference offical settings NPCs in their quests, this is to avoid players making NPCs saying stupid things which are completely against settings.&lt;br /&gt;
** Preventative action - The only NPC which can be scripted in the player written quest is the NPC which was hired by the player.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20205</id>
		<title>Custom NPC Dialogue</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20205"/>
		<updated>2014-01-04T21:16:04Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Referencing other NPCs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Custom NPC Dialogues are a subset of [[NPC Dialogues]] / [[Quest Script Operations]] that is include only functions that players can use to script NPCs. Actions that could be exploited to gain money or items is not included.&lt;br /&gt;
&lt;br /&gt;
= Limitation =&lt;br /&gt;
&lt;br /&gt;
== Referencing other NPCs ==&lt;br /&gt;
Custon NPC Dialogues is not allowed to reference other NPCs. The NPC Tell command will be a generic syntax using the keyword NPC instead of the NPC Name. The &amp;quot;&amp;lt;NPC Name&amp;gt;:&amp;lt;message&amp;gt;.&amp;quot; is not allowed.&lt;br /&gt;
&lt;br /&gt;
 Ex: NPC:Hello&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
This section contain description and rationales for the limitations that needs to be created.&lt;br /&gt;
&lt;br /&gt;
Possible ways to exploit the quest syntax by players writing their own quests.&lt;br /&gt;
&lt;br /&gt;
The following commands need to be blocked from use, or severely limited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - Give [quantity] [quality] [item]&lt;br /&gt;
** They will be able to spawn any item in the the BD with qualities upto 300/300&lt;br /&gt;
** Preventative action - block access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]complete [quest name] [step x].&lt;br /&gt;
** This will allow players to modify any quest in the game. Exploit as players could do anything they wanted with restarting/modifying/completing any quest in the game.&lt;br /&gt;
** Preventative action - Limit the command to ONLY work with the quest it is written in. This must not be a generic feature as official quests use this cross quest referencing a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]setvariable [variable name] [value]&lt;br /&gt;
** This would allow players to modify any variable in the game, would cause massive problems.&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - doadmincmd [command]&lt;br /&gt;
** This would let the player run GM commands, clearly a massive exploit&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - run script [script name] [script variables]&lt;br /&gt;
** This would let players run any script&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest menu trigger - Player gives [npc name] [value] [items]&lt;br /&gt;
** This would allow players to trick other players into giving almost any item to an npc and they would not be able to recover the item. A player could for example use &amp;quot;Player gives test guard 10000000 tria.&amp;quot;&lt;br /&gt;
** Preventative action - This style of trigger should be removed from use by players. OR it should be modified such that in player written quests all giving by players MUST be MANUAL only, not automatic using the menu clicks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest dialog - referencing other NPCs in quests.&lt;br /&gt;
** Players should not be allowed to reference offical settings NPCs in their quests, this is to avoid players making NPCs saying stupid things which are completely against settings.&lt;br /&gt;
** Preventative action - The only NPC which can be scripted in the player written quest is the NPC which was hired by the player.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20204</id>
		<title>Custom NPC Dialogue</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20204"/>
		<updated>2014-01-04T21:15:48Z</updated>

		<summary type="html">&lt;p&gt;Magodra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Custom NPC Dialogues are a subset of [[NPC Dialogues]] / [[Quest Script Operations]] that is include only functions that players can use to script NPCs. Actions that could be exploited to gain money or items is not included.&lt;br /&gt;
&lt;br /&gt;
= Limitation =&lt;br /&gt;
&lt;br /&gt;
== Referencing other NPCs ==&lt;br /&gt;
Custon NPC Dialogues is not allowed to reference other NPCs. The NPC Tell command will be a generic syntax using the keyword NPC instead of the NPC Name. The &amp;quot;&amp;lt;NPC Name&amp;gt;:&amp;lt;message&amp;gt;&amp;quot; is not allowed.&lt;br /&gt;
&lt;br /&gt;
 Ex: NPC:Hello&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
This section contain description and rationales for the limitations that needs to be created.&lt;br /&gt;
&lt;br /&gt;
Possible ways to exploit the quest syntax by players writing their own quests.&lt;br /&gt;
&lt;br /&gt;
The following commands need to be blocked from use, or severely limited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - Give [quantity] [quality] [item]&lt;br /&gt;
** They will be able to spawn any item in the the BD with qualities upto 300/300&lt;br /&gt;
** Preventative action - block access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]complete [quest name] [step x].&lt;br /&gt;
** This will allow players to modify any quest in the game. Exploit as players could do anything they wanted with restarting/modifying/completing any quest in the game.&lt;br /&gt;
** Preventative action - Limit the command to ONLY work with the quest it is written in. This must not be a generic feature as official quests use this cross quest referencing a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]setvariable [variable name] [value]&lt;br /&gt;
** This would allow players to modify any variable in the game, would cause massive problems.&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - doadmincmd [command]&lt;br /&gt;
** This would let the player run GM commands, clearly a massive exploit&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - run script [script name] [script variables]&lt;br /&gt;
** This would let players run any script&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest menu trigger - Player gives [npc name] [value] [items]&lt;br /&gt;
** This would allow players to trick other players into giving almost any item to an npc and they would not be able to recover the item. A player could for example use &amp;quot;Player gives test guard 10000000 tria.&amp;quot;&lt;br /&gt;
** Preventative action - This style of trigger should be removed from use by players. OR it should be modified such that in player written quests all giving by players MUST be MANUAL only, not automatic using the menu clicks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest dialog - referencing other NPCs in quests.&lt;br /&gt;
** Players should not be allowed to reference offical settings NPCs in their quests, this is to avoid players making NPCs saying stupid things which are completely against settings.&lt;br /&gt;
** Preventative action - The only NPC which can be scripted in the player written quest is the NPC which was hired by the player.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20203</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20203"/>
		<updated>2014-01-04T21:09:37Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Quest Script Operations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests. A subset will be available for [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Response_Operation&amp;diff=20202</id>
		<title>Response Operation</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Response_Operation&amp;diff=20202"/>
		<updated>2014-01-04T20:53:17Z</updated>

		<summary type="html">&lt;p&gt;Magodra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Response Operations =&lt;br /&gt;
&lt;br /&gt;
Response operations are used to script response scripts as part of [[NPC Dialogues]]. They are also build internally in the server from the Quest system through [[Quest Script Operations]].&lt;br /&gt;
== Action ==&lt;br /&gt;
&lt;br /&gt;
This response operations cause an action by the NPC. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of animation&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Action command.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;action anim=&amp;quot;The anim&amp;quot; text=&amp;quot;The action&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action My ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionmy ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action My Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionmypublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionpublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Assign Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations assign a new quest to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|q1&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q2&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q2&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q3&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q4&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q5&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|timeout_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The timeout message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;assign q1=&amp;quot;The Quest&amp;quot; q2=&amp;quot;The Other Quest&amp;quot; timeout_msg=&amp;quot;The Quest timeout message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations complete a quest. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest_id&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;complete quest_id=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest Complete error message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Do Admin Command ==&lt;br /&gt;
&lt;br /&gt;
This response operations run an admin command. In the command string the key words &amp;quot;targetchar&amp;quot; and &amp;quot;sourcenpc&amp;quot; is replaced with target and the NPC talking.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|command&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The admin command to run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;doadmincmd command=&amp;quot;/debugnpc sourcenpc 5&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Faction ==&lt;br /&gt;
&lt;br /&gt;
This response operations adjust the faction. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the faction.&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|The faction value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;faction name=&amp;quot;My Faction&amp;quot; value=&amp;quot;5&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Give Item ==&lt;br /&gt;
&lt;br /&gt;
This response operations give items to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string or integer&lt;br /&gt;
|&lt;br /&gt;
|The name of the item stat or the id of the item stat.&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|1&lt;br /&gt;
|The number of items to give.&lt;br /&gt;
|-&lt;br /&gt;
|quality&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|0&lt;br /&gt;
|The quality of the new item.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;give item=&amp;quot;The Item&amp;quot; count=&amp;quot;2&amp;quot; quality=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guild Award ==&lt;br /&gt;
&lt;br /&gt;
This response operations award a guild Karma Points. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|karma&lt;br /&gt;
|Mandatory&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|Number of Karma Points to award guild.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;guild_award karma=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduce ==&lt;br /&gt;
&lt;br /&gt;
This response operations introduce the player with the NPC. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|Me&lt;br /&gt;
|The character to introduce to the NPC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;introduce name=&amp;quot;The Player&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Money ==&lt;br /&gt;
&lt;br /&gt;
This response operations give money to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|int,int,int,int or int&lt;br /&gt;
|&lt;br /&gt;
|The money to give. Either &amp;quot;Circles, octas, hexas, trias&amp;quot; or just &amp;quot;trias&amp;quot;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;money value=&amp;quot;1,2,3,4&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;money value=&amp;quot;42&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Narrate ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;narrate ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Narrate Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;narratepublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC Cmd ==&lt;br /&gt;
&lt;br /&gt;
This response operations send a command to the NPC Client. The command will trigger NPC responses. See [[Behaviors_and_Reactions#NPC_Cmd_Perception|NPC Cmd Perception]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|cmd&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Use format npccmd:global:&amp;lt;your cmd text&amp;gt; or npccmd:self:&amp;lt;your cmd text&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;npccmd cmd=&amp;quot;npccmd:global:start_riot&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;npccmd cmd=&amp;quot;npccmd:self:open_cage&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Offer Reward ==&lt;br /&gt;
&lt;br /&gt;
This response operations offer items to the player. Either defined by ID or name. If ID is defined that will take precedence over name.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|The ID of the item stat of the item to offer. If id not defined name must be defined.&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the item stat of the item to offer. If name not defined id must be defined.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;offer&amp;gt;&lt;br /&gt;
         &amp;lt;item id=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;item name=&amp;quot;My Item State&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;/offer&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Respond ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player.  This is the same as the [[#Say|Say operation]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;respond text=&amp;quot;Hello&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Run Script ==&lt;br /&gt;
&lt;br /&gt;
This response operations run a script. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|script&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The script&lt;br /&gt;
|-&lt;br /&gt;
|with&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Binding text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;run script=&amp;quot;My Script&amp;quot; with=&amp;quot;My Binding?&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Respond Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player. This is the same as the [[#Respond|Respond operation]] but the respond is public.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;respondpublic text=&amp;quot;Chat message going public&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Say ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player. This is the same as the [[#Respond|Respond operation]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
  Ex:  &amp;lt;say text=&amp;quot;Hello&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Set Variable ==&lt;br /&gt;
&lt;br /&gt;
This response operations set a character variable. Character variables are typically used from scripts.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the variable&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The value of the variable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;setvariable name=&amp;quot;My Variable&amp;quot; value=&amp;quot;My Value&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Train ==&lt;br /&gt;
&lt;br /&gt;
This response operations start training for the player. A confirmation dialog is displayed at the client. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|skill&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Skill name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;train skill=&amp;quot;My Skill&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncomplete Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations Un-complete a quest. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest_id&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;uncomplete quest_id=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest Uncomplete error message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Unset Variable ==&lt;br /&gt;
&lt;br /&gt;
This response operations Un-set a variable. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the variable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;unsetvariable name=&amp;quot;My Variable&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Assigned ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify if a quest is assigned. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestassigned quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is not assigned&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Completed ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify if a quest is complete. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestcompleted quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is not completed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Not Assigned ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify that a quest is not assigned. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestnotassigned quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is assigned&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operation&amp;diff=20201</id>
		<title>Quest Script Operation</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operation&amp;diff=20201"/>
		<updated>2014-01-04T20:52:52Z</updated>

		<summary type="html">&lt;p&gt;Magodra: moved Quest Script Operation to Quest Script Operations: Quest Script Operation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Quest Script Operations]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20200</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20200"/>
		<updated>2014-01-04T20:52:52Z</updated>

		<summary type="html">&lt;p&gt;Magodra: moved Quest Script Operation to Quest Script Operations: Quest Script Operation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20199</id>
		<title>Custom NPC Dialogue</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Custom_NPC_Dialogue&amp;diff=20199"/>
		<updated>2014-01-04T20:47:59Z</updated>

		<summary type="html">&lt;p&gt;Magodra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Custom NPC Dialogues are a subset of [[NPC Dialogues]] / [[Quest Script Operations]] that is include only functions that players can use to script NPCs. Actions that could be exploited to gain money or items is not included.&lt;br /&gt;
&lt;br /&gt;
Possible ways to exploit the quest syntax by players writing their own quests.&lt;br /&gt;
&lt;br /&gt;
The following commands need to be blocked from use, or severely limited.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - Give [quantity] [quality] [item]&lt;br /&gt;
** They will be able to spawn any item in the the BD with qualities upto 300/300&lt;br /&gt;
** Preventative action - block access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]complete [quest name] [step x].&lt;br /&gt;
** This will allow players to modify any quest in the game. Exploit as players could do anything they wanted with restarting/modifying/completing any quest in the game.&lt;br /&gt;
** Preventative action - Limit the command to ONLY work with the quest it is written in. This must not be a generic feature as official quests use this cross quest referencing a lot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - [un]setvariable [variable name] [value]&lt;br /&gt;
** This would allow players to modify any variable in the game, would cause massive problems.&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - doadmincmd [command]&lt;br /&gt;
** This would let the player run GM commands, clearly a massive exploit&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest command - run script [script name] [script variables]&lt;br /&gt;
** This would let players run any script&lt;br /&gt;
** Preventative action - block player access as it is not needed by players.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest menu trigger - Player gives [npc name] [value] [items]&lt;br /&gt;
** This would allow players to trick other players into giving almost any item to an npc and they would not be able to recover the item. A player could for example use &amp;quot;Player gives test guard 10000000 tria.&amp;quot;&lt;br /&gt;
** Preventative action - This style of trigger should be removed from use by players. OR it should be modified such that in player written quests all giving by players MUST be MANUAL only, not automatic using the menu clicks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Quest dialog - referencing other NPCs in quests.&lt;br /&gt;
** Players should not be allowed to reference offical settings NPCs in their quests, this is to avoid players making NPCs saying stupid things which are completely against settings.&lt;br /&gt;
** Preventative action - The only NPC which can be scripted in the player written quest is the NPC which was hired by the player.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20198</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20198"/>
		<updated>2014-01-04T16:07:31Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20197</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20197"/>
		<updated>2014-01-04T16:07:23Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
Ex: Give 1 tria.Give 2 exp.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20196</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20196"/>
		<updated>2014-01-04T16:06:27Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20195</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20195"/>
		<updated>2014-01-04T16:06:17Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]]. Multiple commands can be defined separated with dots &#039;.&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20194</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20194"/>
		<updated>2014-01-04T16:02:09Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Give */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player. If multiple items are listed with or between an offer is made to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20193</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20193"/>
		<updated>2014-01-04T16:00:36Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Give */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give &amp;lt;value&amp;gt; tria|hexa|ocata|circle|exp|faction&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Give items or money to the player.&lt;br /&gt;
&lt;br /&gt;
 Ex: Give 1 Ring of Familiar.&lt;br /&gt;
     Give 3 tria.&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20192</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20192"/>
		<updated>2014-01-04T15:57:38Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Give */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give [&amp;lt;count&amp;gt;] [&amp;lt;quality&amp;gt;] &amp;lt;item&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20191</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20191"/>
		<updated>2014-01-04T15:00:32Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* NPC tell (:) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: &amp;lt;npc&amp;gt;:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NPC respone to a player with a message.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; &amp;lt;count&amp;gt; &amp;lt;quality&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20190</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20190"/>
		<updated>2014-01-04T14:59:57Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Player tell(P:) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: P:&amp;lt;Message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; &amp;lt;count&amp;gt; &amp;lt;quality&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20189</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20189"/>
		<updated>2014-01-04T14:59:14Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* New substep ... */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; &amp;lt;count&amp;gt; &amp;lt;quality&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20188</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20188"/>
		<updated>2014-01-04T14:59:07Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Menu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
 Syntax: Menu:&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; &amp;lt;count&amp;gt; &amp;lt;quality&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20187</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20187"/>
		<updated>2014-01-04T14:58:37Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
 &lt;br /&gt;
 Syntax: Complete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: DoAdminCmd &amp;lt;Admin command&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
 Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Give tria|hexa|ocata|circle|exp|faction &amp;lt;value&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; or &amp;lt;item&amp;gt;&lt;br /&gt;
         Give &amp;lt;item&amp;gt; &amp;lt;count&amp;gt; &amp;lt;quality&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: &lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Uncomplete &amp;lt;quest name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;br /&gt;
&lt;br /&gt;
 Syntax:&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20186</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20186"/>
		<updated>2014-01-04T14:53:29Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Assign Quest */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
 Syntax: Assign Quest &amp;lt;quest&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20185</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20185"/>
		<updated>2014-01-04T14:52:54Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Fire Event (Not completed) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== FireEvent ===&lt;br /&gt;
(Note: Not completed.)&lt;br /&gt;
&lt;br /&gt;
Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20184</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20184"/>
		<updated>2014-01-04T14:51:34Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== Fire Event (Not completed) ===&lt;br /&gt;
&lt;br /&gt;
Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
(Note no space)&lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== SetVariable ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
=== UnsetVariable ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20183</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20183"/>
		<updated>2014-01-04T14:49:14Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Fire Event */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Fire Event (Not completed) ===&lt;br /&gt;
&lt;br /&gt;
Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
(Note no space)&lt;br /&gt;
&lt;br /&gt;
The fire event has no corresponding Response Operation.&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== setvariable ===&lt;br /&gt;
&lt;br /&gt;
=== unsetvariable ===&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20182</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20182"/>
		<updated>2014-01-04T14:46:03Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Fire Event */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Fire Event ===&lt;br /&gt;
&lt;br /&gt;
Syntax: FireEvent &lt;br /&gt;
&lt;br /&gt;
(Note no space)&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== setvariable ===&lt;br /&gt;
&lt;br /&gt;
=== unsetvariable ===&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Response_Operation&amp;diff=20181</id>
		<title>Response Operation</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Response_Operation&amp;diff=20181"/>
		<updated>2014-01-04T14:43:01Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Response Operations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
= Response Operations =&lt;br /&gt;
&lt;br /&gt;
Response operations are used to script response scripts as part of [[NPC Dialogues]]. They are also build internally in the server from the Quest system through [[Quest Script Operation|Quest Script Operations]].&lt;br /&gt;
== Action ==&lt;br /&gt;
&lt;br /&gt;
This response operations cause an action by the NPC. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of animation&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Action command.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;action anim=&amp;quot;The anim&amp;quot; text=&amp;quot;The action&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action My ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionmy ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action My Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionmypublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Action Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;actionpublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Assign Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations assign a new quest to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|q1&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q2&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q2&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q3&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q4&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|q5&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the quest&lt;br /&gt;
|-&lt;br /&gt;
|timeout_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The timeout message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;assign q1=&amp;quot;The Quest&amp;quot; q2=&amp;quot;The Other Quest&amp;quot; timeout_msg=&amp;quot;The Quest timeout message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations complete a quest. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest_id&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;complete quest_id=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest Complete error message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Do Admin Command ==&lt;br /&gt;
&lt;br /&gt;
This response operations run an admin command. In the command string the key words &amp;quot;targetchar&amp;quot; and &amp;quot;sourcenpc&amp;quot; is replaced with target and the NPC talking.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|command&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The admin command to run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;doadmincmd command=&amp;quot;/debugnpc sourcenpc 5&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Faction ==&lt;br /&gt;
&lt;br /&gt;
This response operations adjust the faction. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of the faction.&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|The faction value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;faction name=&amp;quot;My Faction&amp;quot; value=&amp;quot;5&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Give Item ==&lt;br /&gt;
&lt;br /&gt;
This response operations give items to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string or integer&lt;br /&gt;
|&lt;br /&gt;
|The name of the item stat or the id of the item stat.&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|1&lt;br /&gt;
|The number of items to give.&lt;br /&gt;
|-&lt;br /&gt;
|quality&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|0&lt;br /&gt;
|The quality of the new item.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;give item=&amp;quot;The Item&amp;quot; count=&amp;quot;2&amp;quot; quality=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guild Award ==&lt;br /&gt;
&lt;br /&gt;
This response operations award a guild Karma Points. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|karma&lt;br /&gt;
|Mandatory&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|Number of Karma Points to award guild.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;guild_award karma=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduce ==&lt;br /&gt;
&lt;br /&gt;
This response operations introduce the player with the NPC. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|Me&lt;br /&gt;
|The character to introduce to the NPC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;introduce name=&amp;quot;The Player&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Money ==&lt;br /&gt;
&lt;br /&gt;
This response operations give money to the player. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|int,int,int,int or int&lt;br /&gt;
|&lt;br /&gt;
|The money to give. Either &amp;quot;Circles, octas, hexas, trias&amp;quot; or just &amp;quot;trias&amp;quot;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;money value=&amp;quot;1,2,3,4&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;money value=&amp;quot;42&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Narrate ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;narrate ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Narrate Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations . &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;narratepublic ... /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC Cmd ==&lt;br /&gt;
&lt;br /&gt;
This response operations send a command to the NPC Client. The command will trigger NPC responses. See [[Behaviors_and_Reactions#NPC_Cmd_Perception|NPC Cmd Perception]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|cmd&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Use format npccmd:global:&amp;lt;your cmd text&amp;gt; or npccmd:self:&amp;lt;your cmd text&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;npccmd cmd=&amp;quot;npccmd:global:start_riot&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;npccmd cmd=&amp;quot;npccmd:self:open_cage&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Offer Reward ==&lt;br /&gt;
&lt;br /&gt;
This response operations offer items to the player. Either defined by ID or name. If ID is defined that will take precedence over name.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|Optional&lt;br /&gt;
|integer&lt;br /&gt;
|&lt;br /&gt;
|The ID of the item stat of the item to offer. If id not defined name must be defined.&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the item stat of the item to offer. If name not defined id must be defined.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;offer&amp;gt;&lt;br /&gt;
         &amp;lt;item id=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;item name=&amp;quot;My Item State&amp;quot; /&amp;gt;&lt;br /&gt;
       &amp;lt;/offer&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Respond ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player.  This is the same as the [[#Say|Say operation]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;respond text=&amp;quot;Hello&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Run Script ==&lt;br /&gt;
&lt;br /&gt;
This response operations run a script. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|script&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The script&lt;br /&gt;
|-&lt;br /&gt;
|with&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Binding text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;run script=&amp;quot;My Script&amp;quot; with=&amp;quot;My Binding?&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Respond Public ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player. This is the same as the [[#Respond|Respond operation]] but the respond is public.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;respondpublic text=&amp;quot;Chat message going public&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Say ==&lt;br /&gt;
&lt;br /&gt;
This response operations respond with a text to the player. This is the same as the [[#Respond|Respond operation]].&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The chat message to respond with.&lt;br /&gt;
|}&lt;br /&gt;
  Ex:  &amp;lt;say text=&amp;quot;Hello&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Set Variable ==&lt;br /&gt;
&lt;br /&gt;
This response operations set a character variable. Character variables are typically used from scripts.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the variable&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The value of the variable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;setvariable name=&amp;quot;My Variable&amp;quot; value=&amp;quot;My Value&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Train ==&lt;br /&gt;
&lt;br /&gt;
This response operations start training for the player. A confirmation dialog is displayed at the client. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|skill&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Skill name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;train skill=&amp;quot;My Skill&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uncomplete Quest ==&lt;br /&gt;
&lt;br /&gt;
This response operations Un-complete a quest. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest_id&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;uncomplete quest_id=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest Uncomplete error message&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Unset Variable ==&lt;br /&gt;
&lt;br /&gt;
This response operations Un-set a variable. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the variable.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;unsetvariable name=&amp;quot;My Variable&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Assigned ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify if a quest is assigned. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestassigned quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is not assigned&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Completed ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify if a quest is complete. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestcompleted quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is not completed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verify Quest Not Assigned ==&lt;br /&gt;
&lt;br /&gt;
This response operations verify that a quest is not assigned. &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Attribute&lt;br /&gt;
!Required&lt;br /&gt;
!Values/Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|quest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Name of quest.&lt;br /&gt;
|-&lt;br /&gt;
|error_msg&lt;br /&gt;
|Optional&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Error message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex:  &amp;lt;verifyquestnotassigned quest=&amp;quot;The Quest&amp;quot; error_msg=&amp;quot;The Quest is assigned&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20180</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20180"/>
		<updated>2014-01-04T14:37:35Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Commands */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
Commands build [[Response Operation|Response Operations]].&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Fire Event ===&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== setvariable ===&lt;br /&gt;
&lt;br /&gt;
=== unsetvariable ===&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20179</id>
		<title>Quest Script Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Quest_Script_Operations&amp;diff=20179"/>
		<updated>2014-01-04T14:35:47Z</updated>

		<summary type="html">&lt;p&gt;Magodra: Created page with &amp;quot;= Quest Script Operations = Quest script operations are used to script Quests.  == Menu ==  == New substep ... ==  Syntax: ... [NoRepeat]  == NPC tell (&amp;lt;npc&amp;gt;:) == NPC respone ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Quest Script Operations =&lt;br /&gt;
Quest script operations are used to script Quests.&lt;br /&gt;
&lt;br /&gt;
== Menu ==&lt;br /&gt;
&lt;br /&gt;
== New substep ... ==&lt;br /&gt;
&lt;br /&gt;
Syntax: ... [NoRepeat]&lt;br /&gt;
&lt;br /&gt;
== NPC tell (&amp;lt;npc&amp;gt;:) ==&lt;br /&gt;
NPC respone to a player.&lt;br /&gt;
&lt;br /&gt;
== Player tell(P:) ==&lt;br /&gt;
Player tell npc.&lt;br /&gt;
&lt;br /&gt;
== Player ==&lt;br /&gt;
Player action.&lt;br /&gt;
&lt;br /&gt;
== QuestNote ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Commands ==&lt;br /&gt;
&lt;br /&gt;
=== Assign Quest ===&lt;br /&gt;
&lt;br /&gt;
=== Fire Event ===&lt;br /&gt;
&lt;br /&gt;
=== Complete ===&lt;br /&gt;
&lt;br /&gt;
=== Uncomplete ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== setvariable ===&lt;br /&gt;
&lt;br /&gt;
=== unsetvariable ===&lt;br /&gt;
&lt;br /&gt;
=== Give ===&lt;br /&gt;
&lt;br /&gt;
=== NoRepeat===&lt;br /&gt;
&lt;br /&gt;
=== Require ===&lt;br /&gt;
&lt;br /&gt;
=== Run script ===&lt;br /&gt;
&lt;br /&gt;
=== DoAdminCmd ===&lt;br /&gt;
&lt;br /&gt;
=== Introduce ===&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Behavior_Operations&amp;diff=20176</id>
		<title>Behavior Operations</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Behavior_Operations&amp;diff=20176"/>
		<updated>2014-01-01T19:16:08Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Locate Operation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A “Behavior” in NPCClient is a script defined in [[NPC_Behavior_Data_Structures#npcbehave.xml|npcbehave.xml]] to run to make the npc behave a certain way. It is almost like&lt;br /&gt;
a state, for AI designers used to state machine npcs. Example behaviors might include “guard&lt;br /&gt;
patrol”, “wander in forest”, “fight attackers”, “smith an item”. Before we talk about how&lt;br /&gt;
everything fits together we will go over what is possible in npcclient with these detailed behavior&lt;br /&gt;
scripts. The following is a list and reference description of each behavior script operation or&lt;br /&gt;
command you can use. They are put together in sequences called beaviors as will be described later in [[Behaviors_and_Reactions]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assess Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|physical&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The prefix for the physical perception.&lt;br /&gt;
|-&lt;br /&gt;
|magical&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The prefix for the magical perception.&lt;br /&gt;
|-&lt;br /&gt;
|overall&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The perfix for the overall perception.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each of the physical, magical, or overall will be assessed as; &amp;quot;extremely weaker&amp;quot;, &amp;quot;much weaker&amp;quot;, &amp;quot;weaker&amp;quot;, &amp;quot;equal&amp;quot;, &amp;quot;stronger&amp;quot;, &amp;quot;much stronger&amp;quot; or &amp;quot;extremely stronger&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;assess overall=&amp;quot;$target overall&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typical reaction to catch the response to this would be as shown in the example below. $target is used here to make sure the correct assessment is matched to the same target. A npc will&lt;br /&gt;
not react if the target has changed before the response is received.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;react event=&amp;quot;assess equal&amp;quot; type=&amp;quot;$target overall&amp;quot; .../&amp;gt;&lt;br /&gt;
      &amp;lt;react event=&amp;quot;assess weaker&amp;quot; type=&amp;quot;$target overall&amp;quot; .../&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Auto Memorize Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|types&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Comma separated list of types. &amp;quot;all&amp;quot;, can be used to memorize everything to all.&lt;br /&gt;
|-&lt;br /&gt;
|enable&lt;br /&gt;
|bool&lt;br /&gt;
|true&lt;br /&gt;
|Enables or disables the types.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Auto memorize is a way to turn on and off memorizing of perception. This will be memorize without actually needing to react to thees. Related to the [[Behavior_Operations#Share_Memories_Operation|Share Memories Operation]].&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;auto_memorize types=&amp;quot;all&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;auto_memorize types=&amp;quot;Hunting Ground,Marked&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;auto_memorize types=&amp;quot;Marked&amp;quot; enable=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
You can use a reaction without a behavior lists to enable the NPC to receive perceptions to be memorized if enabled.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;react type=&amp;quot;location sensed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Build Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|pickupable&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|If false the building deployed will not be pickupable by the players&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Build a building as specified bye the NPC&#039;s current held building spot as set by the [[Tribe Scripting]] [[Tribe_Scripting#LocateBuildingSpot|locateBuildingSpot]] function. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;build /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Busy Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Mark a NPC as busy. This will cancle the [[Behavior_Operations#Idle_Operation|Idle Operation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;busy /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cast Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|spell&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the spell to cast.&lt;br /&gt;
|-&lt;br /&gt;
|k&lt;br /&gt;
|float&lt;br /&gt;
|1.0&lt;br /&gt;
|The kFactor to use when casting the spell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Cast a spell on the current selected target.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;cast spell=&amp;quot;Flame Strike&amp;quot; k=&amp;quot;3.0&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Change Brain Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|brain&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the brain to load.&lt;br /&gt;
|-&lt;br /&gt;
|brain&lt;br /&gt;
|reload&lt;br /&gt;
|&lt;br /&gt;
|Reload the standard NPC the brain stored in the sc_npc_definition table.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Change the brain of the current selected target.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;change_brain brain=&amp;quot;Charmed&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Chase Operation ==&lt;br /&gt;
(Net load: 3, CPU Load 3)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to use for the chase.&lt;br /&gt;
|-&lt;br /&gt;
|adaptiv_vel_script&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|A [[NPCClient math script]] used to adjust the adaptivVelocityScale. Additional variables defined for this script is &amp;quot;Distance&amp;quot; to the target of the chase and &amp;quot;AdaptivVelScale&amp;quot; that is the value used to adjust velocity. 1.1 will increase the velocity by 10%.&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|nearest_actor,nearest_npc,nearest_player,owner,target&lt;br /&gt;
|&lt;br /&gt;
|nearest_* is the nearest entity of that type. target is current target.&lt;br /&gt;
|-&lt;br /&gt;
|range&lt;br /&gt;
|float&lt;br /&gt;
|2.0&lt;br /&gt;
|The range to search for target of the chase.&lt;br /&gt;
|-&lt;br /&gt;
|chase_range&lt;br /&gt;
|float&lt;br /&gt;
| -1&lt;br /&gt;
|The range at where the chase should give up and issue a &amp;quot;&amp;lt;target&amp;gt; out of chase&amp;quot; perception. -1 is default to disable the max range check.&lt;br /&gt;
|-&lt;br /&gt;
|offset&lt;br /&gt;
|float&lt;br /&gt;
|0.5&lt;br /&gt;
|The distance to stop before the target of the chase. [[NPC Variables]] will be replaced. Expressions will be resolved. See [[Behavior_Offset|Offset]] for more details.&lt;br /&gt;
|-&lt;br /&gt;
|offset_angle&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|Size of the arc used to distribute the chase when approaching the target. The angle is in degrees.&lt;br /&gt;
|-&lt;br /&gt;
|vel&lt;br /&gt;
|float,$WALK,$RUN&lt;br /&gt;
|Default is to use the velocity from the behavior.&lt;br /&gt;
|The velocity to use when chasing.&lt;br /&gt;
|-&lt;br /&gt;
|ang_vel&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|0 is to use the default from the behavior.&lt;br /&gt;
|-&lt;br /&gt;
|collision&lt;br /&gt;
|string&lt;br /&gt;
|collision&lt;br /&gt;
|The name of the perception to be used when a collision perception is to be fired.&lt;br /&gt;
|-&lt;br /&gt;
|out_of_bounds&lt;br /&gt;
|string&lt;br /&gt;
|out of bounds&lt;br /&gt;
|The name of the perception to be used when a out of bounds perception is to be fired.&lt;br /&gt;
|-&lt;br /&gt;
|in_bounds&lt;br /&gt;
|string&lt;br /&gt;
|in bounds&lt;br /&gt;
|The name of the perception to be used when a in bound perception is to be fired.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Chasing a player is one example where both turning and moving at the same time are required to&lt;br /&gt;
give a realistic effect to the behavior. We have &amp;lt;move&amp;gt; and &amp;lt;rotate&amp;gt; but this one does them&lt;br /&gt;
together and intelligently to follow a targeted player or entity. Normally, this will be used to get&lt;br /&gt;
npc’s to chase after players if players run away during a fight.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;chase type=&amp;quot;enemy&amp;quot; anim=&amp;quot;walk&amp;quot; range=”2” /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the npc will play the animation called “walk” while moving and turning as&lt;br /&gt;
appropriate to reduce his range to his most hated enemy. Of course, he is limited by his speed and&lt;br /&gt;
if the player can run faster than he can chase, he will never catch the player. An &amp;quot;&amp;lt;target&amp;gt; out of chase&amp;quot; perception&lt;br /&gt;
will be fired in this case.&lt;br /&gt;
&lt;br /&gt;
The “type” attribute of the operation can be either “enemy” as shown here, “owner” to follow the&lt;br /&gt;
NPC’s owner around, or “nearest” to chase after the nearest player at the time the operation was&lt;br /&gt;
initiated. This operation will continue until interrupted by another behavior or until the distance to&lt;br /&gt;
the target from the npc is less than the range specified. (2 is the default if no range is specified.)&lt;br /&gt;
This operation sends DR messages whenever it turns or changes course, plus the DR messages to&lt;br /&gt;
start the forward motion and animation, and to stop them. The CPU load is somewhat heavy&lt;br /&gt;
because CD must be performed as the npc is chasing, since his path is not predetermined.&lt;br /&gt;
&lt;br /&gt;
== Circle Operation ==&lt;br /&gt;
(Net load: 3, CPU Load: 2)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to use for the operation.&lt;br /&gt;
|-&lt;br /&gt;
|radius&lt;br /&gt;
|float&lt;br /&gt;
|Mandatory, no default value&lt;br /&gt;
|Radius to move NPC around with.&lt;br /&gt;
|-&lt;br /&gt;
|angle&lt;br /&gt;
|float&lt;br /&gt;
|2PI&lt;br /&gt;
|The angle to move. Calculated if 0 and duration not 0.&lt;br /&gt;
|-&lt;br /&gt;
|duration&lt;br /&gt;
|float&lt;br /&gt;
|0&lt;br /&gt;
|The duration to move in circle. Calculated if 0. &lt;br /&gt;
|-&lt;br /&gt;
|ang_vel&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|The angular velocity to use when moving in the circle. Calculated if 0.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Moving the NPC around in a circle. The following example will move the npc around using the velocity defined in the behavior in one complete circle in 10 sec.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;circle anim=&amp;quot;walk&amp;quot; radius=”2” duration=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Control Operation ==&lt;br /&gt;
(Net load: 3, CPU Load: 2)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Take control of an player an move with the player.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;control /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Copy_Locate Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|source&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory, no default value&lt;br /&gt;
|The source locate to copy from.&lt;br /&gt;
|-&lt;br /&gt;
|destination&lt;br /&gt;
|float&lt;br /&gt;
|Mandatory, no default value&lt;br /&gt;
|The destination locate to copy to.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy one locate from source to destination. Built in function like Wander and Navigate use the Active locate.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;locate obj=&amp;quot;some thing&amp;quot; destination=&amp;quot;SpecialPlace&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;copy_locate source=&amp;quot;SpecialPlace&amp;quot; destination=&amp;quot;Active&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debug Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|level&lt;br /&gt;
|int&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The level of debug to turn on for current NPC.&lt;br /&gt;
|-&lt;br /&gt;
|exclusive&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Will set on exclusive logging for this NPC.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Turn on and of debug printouts on the server console. Used for debuging of script operations. Level 1-4 Only the biggest events, 5-9 Medium number of events, 10-15 and more is maximum output.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;debug level=”2” /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Dequip Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|slot&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The slot to dequip an move back into inventory.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Dequip an item held by the NPC in the given slot.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;dequip slot=&amp;quot;righthand&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Drop Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|slot&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The slot from which the item is to be dropped.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation allows an NPC to drop an item he has in inventory on the ground.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;drop slot=&amp;quot;lefthand&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Eat Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|resource&lt;br /&gt;
|string,tribe:wealth&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The resource to reward the tribe when eating.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Simple simulation that the tribe would gain things like flesh from eating at a dead entity withing a range of 1.0. The tribe wealth resource would be read from the wealt_resource_name field in the [[NPC_Behavior_Data_Structures#tribes#tribes|tribes]] table.&lt;br /&gt;
 &lt;br /&gt;
  Ex: &amp;lt;eat resource=&amp;quot;tribe:wealth&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;eat resource=&amp;quot;Flesh&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Emote Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|cmd&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The emote cmd to be used as defined in the emote.xml file. Including leading /.&lt;br /&gt;
|}&lt;br /&gt;
This operation allows an NPC to do an emotion.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;emote cmd=&amp;quot;/greet&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Equip Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the item to equip&lt;br /&gt;
|-&lt;br /&gt;
|slot&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The sloot to dquip the item in&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|int&lt;br /&gt;
|1&lt;br /&gt;
|The number of items to equip. Will be forced to at least 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Equip one item from inventory into the given slot.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;equip item=&amp;quot;Sword&amp;quot; slot=&amp;quot;righthand&amp;quot; count=&amp;quot;1&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Hate List Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|delta&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|Add delta to hate list.&lt;br /&gt;
|-&lt;br /&gt;
|absolute&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|Set the hate value.&lt;br /&gt;
|-&lt;br /&gt;
|max&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|Hate should have a max value&lt;br /&gt;
|-&lt;br /&gt;
|min&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|Hate should have a min value&lt;br /&gt;
|-&lt;br /&gt;
|perception&lt;br /&gt;
|bool&lt;br /&gt;
|false&lt;br /&gt;
|Use perception instead of target to find target. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Adjust the hate list for an npc. The current target or perception target is the target entry for the adjustment.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;hate_list delta=&amp;quot;0.5&amp;quot; max=&amp;quot;10.0&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;locate obj=&amp;quot;perception&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;hate_list absolute=&amp;quot;5.0&amp;quot; /&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
      Is equvivalent with:&lt;br /&gt;
  &lt;br /&gt;
      &amp;lt;hate_list perception=&amp;quot;yes&amp;quot; absolute=&amp;quot;5.0&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Idle Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Mark a NPC as idle. This operation cancle the [[Behavior_Operations#Busy_Operation|Busy operation]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;idle /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Invisible Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No parameters.&lt;br /&gt;
&lt;br /&gt;
This operation makes the NPC invisible through the toggle visibility command. See [[Behavior_Operations#Visible_Operation|Visible Operation]].&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;invisible /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Locate Operation ==&lt;br /&gt;
(Net load: 0, CPU Load 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|obj&lt;br /&gt;
|See table below.&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The object to locate. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|failure&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|A perception to fire if fails to locate the given obj.&lt;br /&gt;
|-&lt;br /&gt;
|static&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|For location the search could be made static. Se description for more details.&lt;br /&gt;
|-&lt;br /&gt;
|range&lt;br /&gt;
|float&lt;br /&gt;
| -1&lt;br /&gt;
|The maximum range to locate within. -1 represents infinite.&lt;br /&gt;
|-&lt;br /&gt;
|random&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|If true a random return within the radius will be made. Otherwise the nearest entry will be returned.&lt;br /&gt;
|-&lt;br /&gt;
|outside_region&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set this to true if the locate operation should consider entities outside region as well if a region is defined. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|invisible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set this to true if the locate operation should consider invisible objects&lt;br /&gt;
|-&lt;br /&gt;
|invincible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set this to true if the locate operation should consider invincible objects.&lt;br /&gt;
|-&lt;br /&gt;
|destination&lt;br /&gt;
|string&lt;br /&gt;
|Active&lt;br /&gt;
|Set the destination [[NPC locate location]]. [[NPC Variables]] will be replaced.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Obj can be one of the following:&lt;br /&gt;
{|&lt;br /&gt;
!obj&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;string&amp;gt;&lt;br /&gt;
|Locate a location. This is the default if none of the following obj types is matched.&lt;br /&gt;
|-&lt;br /&gt;
|actor&lt;br /&gt;
|Located nearest actor&lt;br /&gt;
|-&lt;br /&gt;
|building_spot&lt;br /&gt;
|Locate a building spot from the npc&#039;s building spot.&lt;br /&gt;
|-&lt;br /&gt;
|dead&lt;br /&gt;
|Nearest dead actor&lt;br /&gt;
|-&lt;br /&gt;
|entity:name:&amp;lt;name&amp;gt;&lt;br /&gt;
|Entity with given name&lt;br /&gt;
|-&lt;br /&gt;
|entity:pid:&amp;lt;pid&amp;gt;&lt;br /&gt;
|Entity with given pid&lt;br /&gt;
|-&lt;br /&gt;
|friend&lt;br /&gt;
|Nearest visible friend (NPC)&lt;br /&gt;
|-&lt;br /&gt;
|local_region&lt;br /&gt;
|Locate region in current sector.&lt;br /&gt;
|-&lt;br /&gt;
|ownbuffer&lt;br /&gt;
|Locate the own buffer.&lt;br /&gt;
|-&lt;br /&gt;
|owner&lt;br /&gt;
|Locate the owner, if this NPC is owned (Pets and stuff)&lt;br /&gt;
|-&lt;br /&gt;
|perception&lt;br /&gt;
|The location of the last received perception.&lt;br /&gt;
|-&lt;br /&gt;
|player&lt;br /&gt;
|Nearest player&lt;br /&gt;
|-&lt;br /&gt;
|point&lt;br /&gt;
|Random point&lt;br /&gt;
|-&lt;br /&gt;
|region&lt;br /&gt;
|Locate a random point within the region of the NPC.&lt;br /&gt;
|-&lt;br /&gt;
|self&lt;br /&gt;
|Locate your self&lt;br /&gt;
|-&lt;br /&gt;
|spawn&lt;br /&gt;
|Spawn location of the npc.&lt;br /&gt;
|-&lt;br /&gt;
|target&lt;br /&gt;
|Locate a target. The target will be the most hated from the NPC [[hate list]].&lt;br /&gt;
|-&lt;br /&gt;
|tribe:home&lt;br /&gt;
|Locate the npcs [[Tribes|tribe]] home place.&lt;br /&gt;
|-&lt;br /&gt;
|tribe:memory:string&lt;br /&gt;
|Locate something from the [[Tribes]] memory. See the [[Behavior_Operations#ShareMemories_Operation|ShareMemories]] and [[Behavior_Operations#Memorize_Operation|Memorize]] operation.&lt;br /&gt;
|-&lt;br /&gt;
|tribe:resource&lt;br /&gt;
|Locate a resource location from the memory of the [[Tribes|tribe]].&lt;br /&gt;
|-&lt;br /&gt;
|tribe:target&lt;br /&gt;
|Locate the most hated target for this tribe. The target will be the most hated from all the NPCs [[hate list]] in the tribe.&lt;br /&gt;
|-&lt;br /&gt;
|waypoint&lt;br /&gt;
|Will locate a waypoint.&lt;br /&gt;
|-&lt;br /&gt;
|waypoint:group:string&lt;br /&gt;
|Locate a waypoint from a given group&lt;br /&gt;
|-&lt;br /&gt;
|waypoint:name:string&lt;br /&gt;
|Locate a waypoint by name.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation is one of the more flexible and crucial operations in npc scripting. It allows the&lt;br /&gt;
scripter to have his npc “find” a certain thing or type of thing, and remember that location for other&lt;br /&gt;
scripting commands later such as turning, moving or attacking. The operation will store the position&lt;br /&gt;
found in the NPCs as active postion and calcualte the neares waypoint and store that in the active_waypoint.&lt;br /&gt;
For location it is possible to make the first search a static search. So that the first time the npc&lt;br /&gt;
do this operation it could search for a &amp;quot;Baker&amp;quot; location. The next time the operation is used it will&lt;br /&gt;
use the results of the first time even if there might be Bakers closer at that time.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;locate obj=&amp;quot;perception&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;locate obj=&amp;quot;target&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;locate obj=&amp;quot;furnace&amp;quot; range=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;locate obj=&amp;quot;waypoint&amp;quot; failure=&amp;quot;no waypoint found&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example 1 finds the last perception received by the current npc and sets the active target location to&lt;br /&gt;
the location of that perception. This allows npcs who receive “Talk” perceptions to turn to face the&lt;br /&gt;
person talking to them. It allows npcs who have a spell cast on them to turn to face the caster, and&lt;br /&gt;
so on.&lt;br /&gt;
&lt;br /&gt;
Example 2 finds the location of the currently active “enemy” of the NPC, which is the entity with&lt;br /&gt;
the highest score on the NPC’s [[hate list]], and sets that location as the active target location for other&lt;br /&gt;
operations. This allows NPCs to turn to face the person they are attacking, chase attackers who are&lt;br /&gt;
retreating, etc.&lt;br /&gt;
&lt;br /&gt;
Example 3 uses predefined lists of named location types to find the closest one to the npc and sets&lt;br /&gt;
the active target location to the coordinates specified there. This is the most subtle of the 3, and in&lt;br /&gt;
some ways the most powerful so it deserves more discussion. Consider the following pictures:&lt;br /&gt;
&lt;br /&gt;
http://www.planeshift.it/download/docs/npc_pic1.png&lt;br /&gt;
&lt;br /&gt;
Here we have two blacksmith shops with similar items but different layouts. They might be side by&lt;br /&gt;
side or they might be in entirely different cities. LocTypes specify a list of Anvil locations, or a list&lt;br /&gt;
of Furnace locations, as marked by the stars on these pictures. When Example 3 says to locate the&lt;br /&gt;
nearest furnace, an NPC in smithy #1 will find his furnace while the NPC in smithy #2 will find his&lt;br /&gt;
own furnace. They will be able to share one script for moving between these points and acting like&lt;br /&gt;
a real blacksmith in their own location, even though they are in totally different smithy shops.&lt;br /&gt;
&lt;br /&gt;
This will become even more important when we implement player housing and player shops. It&lt;br /&gt;
will be possible with the scripts we have already today for a player to build the blacksmith shop of&lt;br /&gt;
his own design and for him to hire an npc smith to come work in that shop. The Smith NPC he&lt;br /&gt;
hired will be able to “know” how to get around the player’s shop magically.&lt;br /&gt;
&lt;br /&gt;
Something intended to be supported here but not actually implemented yet was the ability to locate&lt;br /&gt;
named objects or entities as well, so an NPC could locate a sword someone dropped on the ground&lt;br /&gt;
and things like this. Better integration with the entity system and perhaps integration with data&lt;br /&gt;
from the maps themselves rather than externally generated lists of points could make this even more&lt;br /&gt;
powerful.&lt;br /&gt;
&lt;br /&gt;
== Loop Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|iterations&lt;br /&gt;
|int&lt;br /&gt;
|0&lt;br /&gt;
|Number of iterations to do in this loop. No iterations attribute or a value of -1 is loop forever.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation allows you to loop a section of your script a certain number of times. This is mostly&lt;br /&gt;
useful for city npcs such as smiths and tavern barkeeps. Behaviors in general will loop if not&lt;br /&gt;
replaced by another behavior, but if you want subloops within the script, this is an easy way to do it.&lt;br /&gt;
&lt;br /&gt;
Ex:&lt;br /&gt;
  &amp;lt;loop iterations=&amp;quot;20&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;locate obj=&amp;quot;fire&amp;quot; range=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;navigate anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;wait anim=&amp;quot;stand&amp;quot; duration=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;locate obj=&amp;quot;anvil&amp;quot; range=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;navigate anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;wait anim=&amp;quot;hammer&amp;quot; duration=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;
  &amp;lt;/loop&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the blacksmith is scripted to walk back and forth between his fire and his anvil 20&lt;br /&gt;
times before moving on to the next operation in his script to act like a blacksmith.&lt;br /&gt;
&lt;br /&gt;
This operation does not affect the network at all and does not have CPU overhead.&lt;br /&gt;
&lt;br /&gt;
== Melee Operation ==&lt;br /&gt;
(Net load: 1, CPU Load: 2)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|seek_range&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|The range to search for new targets in melee&lt;br /&gt;
|-&lt;br /&gt;
|melee_range&lt;br /&gt;
|float[0.5-3.0] &lt;br /&gt;
|3.0&lt;br /&gt;
|The range where melee can be done. Max 3.0 to prevent npc/server conflicts.&lt;br /&gt;
|-&lt;br /&gt;
|stance&lt;br /&gt;
|string&lt;br /&gt;
|normal&lt;br /&gt;
|The stance to use when attacking. [[NPC Variables]] will be replaced. &lt;br /&gt;
|-&lt;br /&gt;
|tribe&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|When set to true the tribe [[hate list]] will be used to select target. If true and NPC not member of a tribe the NPC [[hate list]] will be used as a fall back. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|outside_region&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set to true to fight even outside region if a region is defined. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|invisible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Will melee operation fight invisible entities&lt;br /&gt;
|-&lt;br /&gt;
|invincible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Will melee operation fight invincible entities.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;melee&amp;gt; operation handles starting and ending fights for the NPC. It finds the most hated&lt;br /&gt;
enemy in range and tells the server to attack him. If there is no enemy in range, it finds the nearest&lt;br /&gt;
enemy that it does hate and prepares to chase him.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;melee seek_range=&amp;quot;10&amp;quot; melee_range=&amp;quot;3&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The “melee_range” attribute specifies how far away the enemies can be while still fighting without&lt;br /&gt;
the npc needing to move. 3 meters is the maximum of how far away a player can be to hit the npc&lt;br /&gt;
also, so in most cases this is a good value. The “seek_range” specifies how far around himself the&lt;br /&gt;
npc should look for other enemies if none are found within the melee_range. If there are no&lt;br /&gt;
enemies within the seek_range, the npc starts to calm down and his current behavior (making his&lt;br /&gt;
‘melee’ operation active) is lowered in priority. If an enemy is found within the seek_range, the&lt;br /&gt;
NPC’s active enemy is set to this found person so the &amp;lt;chase type=”enemy”&amp;gt; operation can run&lt;br /&gt;
after him.&lt;br /&gt;
&lt;br /&gt;
This operation’s only network load is informing the server of its melee target and attack mode, and&lt;br /&gt;
switching these occasionally as people die, etc. The CPU load is in periodically (2x per second)&lt;br /&gt;
checking the [[hate list]] for the NPC to make sure the most hated person is being fought. If no one on&lt;br /&gt;
the [[hate list]] is within the melee range, a more expensive operation is done to find any hated people&lt;br /&gt;
within the seek_range, but this operation isn’t performed very often.&lt;br /&gt;
&lt;br /&gt;
See the NPC [[hate list]] for further details about the [[hate list]].&lt;br /&gt;
&lt;br /&gt;
== Memorize Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No Parameters.&lt;br /&gt;
&lt;br /&gt;
This is an operation that only will have effect for tribe members. The NPC will memorize the current perception as a private memory.&lt;br /&gt;
See the [[Behavior_Operations#ShareMemories_Operation|ShareMemories Operation]] for how to make the memories known to other members of the tribe.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;memorize /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Move Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 5) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to use when moving.&lt;br /&gt;
|-&lt;br /&gt;
|duration&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|The duration this move should have. The default is probably no good. &lt;br /&gt;
|-&lt;br /&gt;
|vel&lt;br /&gt;
|float,$WALK,$RUN&lt;br /&gt;
|Default is to use the velocity from the behavior.&lt;br /&gt;
|The velocity to use when moving.&lt;br /&gt;
|-&lt;br /&gt;
|ang_vel&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|By defining a ang_vel the movement will be much like the [[Behavior_Operations#Circle_Operation|Circle Operation]].&lt;br /&gt;
|-&lt;br /&gt;
|collision&lt;br /&gt;
|string&lt;br /&gt;
|collision&lt;br /&gt;
|The name of the perception to be used when a collision perception is to be fired.&lt;br /&gt;
|-&lt;br /&gt;
|out_of_bounds&lt;br /&gt;
|string&lt;br /&gt;
|out of bounds&lt;br /&gt;
|The name of the perception to be used when a out of bounds perception is to be fired.&lt;br /&gt;
|-&lt;br /&gt;
|in_bounds&lt;br /&gt;
|string&lt;br /&gt;
|in bounds&lt;br /&gt;
|The name of the perception to be used when a in bound perception is to be fired.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The most basic behavior operation in npcclient is &amp;lt;move&amp;gt;. It simply tells the npc to move forward&lt;br /&gt;
at a certain speed in the direction he is currently pointing, and to play a named animation while&lt;br /&gt;
doing so.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;move vel=&amp;quot;1&amp;quot; anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;move anim=&amp;quot;walk&amp;quot; vel=&amp;quot;$WALK&amp;quot; out_of_bounds=&amp;quot;move_outside_region&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This operation has no preset end or duration, so it will go until the behavior is preempted by another&lt;br /&gt;
higher priority behavior such as the one to turn, triggered by a collision perception. (See the next&lt;br /&gt;
section for a more detailed explanation of how behaviors pre-empt each other and change&lt;br /&gt;
priorities.)&lt;br /&gt;
&lt;br /&gt;
This operation has low networking overhead since all it does is trigger a single Dead Reckoning&lt;br /&gt;
(DR) update to start the forward motion. It does have CPU overhead during the entire duration of it&lt;br /&gt;
running though, since there is no way for npcclient to know what it might hit along this path. Every&lt;br /&gt;
500msec this operation wakes up and checks its latest movement for collisions, generating a&lt;br /&gt;
perception called “collision” for the behavior script to react to. Also at each 500msec checkpoint,&lt;br /&gt;
it checks the owner NPC’s region setting (such as “sunny meadow” in the example above), and if&lt;br /&gt;
there is a region specifed, the operation checks its current position to make sure the NPC is still “in&lt;br /&gt;
bounds”. If the NPC has made it outside the region in the last half second, it fires a perception&lt;br /&gt;
called “out of bounds”. It will not fire another “out of bounds” perception until an “in bounds”&lt;br /&gt;
perception has been detected.&lt;br /&gt;
&lt;br /&gt;
== MovePath Operation ==&lt;br /&gt;
(Net load: 2, CPU Load: 3) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|path&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the path to use for the movement.&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the animation to use for this movement&lt;br /&gt;
|-&lt;br /&gt;
|direction&lt;br /&gt;
|FORWARD,REVERSE&lt;br /&gt;
|FORWARD&lt;br /&gt;
|The direction to move along the path&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation tell the NPC to move in a predefined path. The path is a named entity in the path network. &lt;br /&gt;
From a start waypoint to and end waypoint with any number of path points in between. The path will either&lt;br /&gt;
be followed in the forward or reverse direction. Upon start of this the npc will be forced to the&lt;br /&gt;
start position of the path. The following example will move the NPC the reverse path to the clock tower.&lt;br /&gt;
  Ex: &amp;lt;movepath path=&amp;quot;Clock Tower&amp;quot; direction=&amp;quot;REVERSE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;behavior &amp;quot;Ring the Clock&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;movepath path=&amp;quot;Clock Tower&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;wait anim=&amp;quot;Ring the Clock&amp;quot; /&amp;gt;&lt;br /&gt;
        &amp;lt;movepath path=&amp;quot;Clock Tower&amp;quot; direction=&amp;quot;REVERSE&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/behavior&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Current implementation will extrapolate on the server and send updates to the client.&lt;br /&gt;
&lt;br /&gt;
The following old description isn&#039;t quite in line with current implementation. Sure it should be possible&lt;br /&gt;
to send the path to the client and do the math there. Suggest to include that as a option to the current&lt;br /&gt;
implementation. With today implementation the movement could be interrupted and it will stop when finished&lt;br /&gt;
with the path. To get the looping behavior either the behavior should be set to looping or a loop should&lt;br /&gt;
be created.&lt;br /&gt;
&lt;br /&gt;
--Start old description:&lt;br /&gt;
&lt;br /&gt;
This operation is another very easy one: &amp;lt;movepath&amp;gt;. It tells the npc to set its preset path to a 3d&lt;br /&gt;
spline specified in another file by name. Each client will take care of playing the right animations&lt;br /&gt;
along the spline as the npc progresses. The intent of this operation was really simply for birds to be&lt;br /&gt;
able to fly through the air as decoration rather than any gameplay reason. Aside from birds, most&lt;br /&gt;
creatures do not follow 3d spline paths in their normal behaviors.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;movepath path=&amp;quot;bird1&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This operation has no present end or duration, and will actually loop if not stopped by another&lt;br /&gt;
behavior.&lt;br /&gt;
&lt;br /&gt;
This operation has almost no network overhead, as the packed bytes of the spline are sent 1 time&lt;br /&gt;
across the network to anyone needing to see this npc, and no other network activity happens until&lt;br /&gt;
the &amp;lt;movepath&amp;gt; operation is interrupted.&lt;br /&gt;
&lt;br /&gt;
This operation also has almost zero CPU overhead, because there is no collision detection and no&lt;br /&gt;
bounds checking on this type of movement. The reasoning is that since predefined paths are being&lt;br /&gt;
followed, it is up to the designer/scripter to ensure that the path goes where they want it to and does&lt;br /&gt;
not hit anything along the way.&lt;br /&gt;
&lt;br /&gt;
--End old description&lt;br /&gt;
&lt;br /&gt;
== MoveTo Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 3) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|x&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|X-coordinate to move to&lt;br /&gt;
|-&lt;br /&gt;
|y&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|Y-coordinate to move to&lt;br /&gt;
|-&lt;br /&gt;
|z&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|Z-coordinate to move to&lt;br /&gt;
|-&lt;br /&gt;
|vel&lt;br /&gt;
|float,$WALK,$RUN&lt;br /&gt;
|Default is to use the velocity from the behavior.&lt;br /&gt;
|The velocity to use when moving.&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the animation to use&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation tells the npc to turn and face a certain point in&lt;br /&gt;
3d space, then move in a straight line to that location at a certain speed. The turn is not animated,&lt;br /&gt;
so if you want an animated turn, you need a &amp;lt;rotate&amp;gt; op in front of this (see below). &amp;lt;moveto&amp;gt; also&lt;br /&gt;
specifies an animation name to play while performing this move.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;moveto x=&amp;quot;-38&amp;quot; y=&amp;quot;0&amp;quot; z=&amp;quot;-169&amp;quot; anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When this operation is executed, the angle necessary to point in the right direction towards this 3d&lt;br /&gt;
coordinate is calculated and the DR message to start the anim, start the movement and set the&lt;br /&gt;
rotation angle so it will look correct is sent. Then the operation calculates the time it will take to&lt;br /&gt;
traverse the distance at the specified speed and suspends itself for that length of time before waking&lt;br /&gt;
up and completing. Thus, this operation has zero processing during these ½ second update&lt;br /&gt;
opportunities. No CD checking is done and no bounds checking is done.&lt;br /&gt;
&lt;br /&gt;
When the operation wakes up a few seconds later, the &amp;lt;moveto&amp;gt; is considered complete, and&lt;br /&gt;
npcclient sends another DR message to stop the movement.&lt;br /&gt;
&lt;br /&gt;
While this operation is very cheap, it is also not very flexible because the coordinates are in the&lt;br /&gt;
NPCType and not in the NPC. Thus any NPC using this NPC Type with this command in it is&lt;br /&gt;
going to have to be willing to move to this exact 3d coordinate.&lt;br /&gt;
&lt;br /&gt;
== Navigate Operation ==&lt;br /&gt;
(Net load: 1, CPU Load 1) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to use in the navigation.&lt;br /&gt;
|-&lt;br /&gt;
|failure&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The perception to fire if the operation fails.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;navigate&amp;gt; operation is a placeholder right now and is simpler than it will be in the future. It is&lt;br /&gt;
designed to work with &amp;lt;locate&amp;gt; and it moves the NPC in a straight line to the target location found&lt;br /&gt;
by the &amp;lt;locate&amp;gt; operation.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;navigate anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The only thing the operation specifies is the animation to play while moving. It works much like&lt;br /&gt;
&amp;lt;moveto&amp;gt; but uses the locate target destination instead of a single fixed location. The only network&lt;br /&gt;
overhead are the Start and Stop DR messages, and the only CPU overhead is calculating how long&lt;br /&gt;
to sleep between starting and stopping.&lt;br /&gt;
&lt;br /&gt;
For more complex movement the [[Behavior_Operations#Wander_Operation|Wander Operation]] should be&lt;br /&gt;
used that will use the path network to navigate. Though if there are no path directly to the location&lt;br /&gt;
to where the NPC should go a combination of Wander and Navigate could be used. Like this example&lt;br /&gt;
where wander is used to navigate using waypoints and navigate is used navigate into the exact&lt;br /&gt;
position of the tavern.&lt;br /&gt;
&lt;br /&gt;
  Ex &amp;lt;locate obj=&amp;quot;tavern&amp;quot; static=&amp;quot;yes&amp;quot; random=&amp;quot;yes&amp;quot; range=&amp;quot;800&amp;quot; &amp;gt; &amp;lt;!-- Locate my favorite tavern --&amp;gt;&lt;br /&gt;
     &amp;lt;wander /&amp;gt; &lt;br /&gt;
     &amp;lt;navigate /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NOP Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
This is a no operation operation. It does absolutely nothing, though each behavior needs to have a set of operations, if nothing else insert this nop operation.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;nop /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Percept Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|event&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The name of the perception event to fire. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|target&lt;br /&gt;
|self,tribe,all,target&lt;br /&gt;
|self&lt;br /&gt;
|The recipient of this perception&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|string&lt;br /&gt;
|(null)&lt;br /&gt;
|The perception type. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|range&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|If set to something greater than 0.0 this perception will only be delivered if within that range.&lt;br /&gt;
|-&lt;br /&gt;
|condition&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|A [[NPCClient math script]] that if set will be evaluated and any non zero return value will cause the perception event to be fired.&lt;br /&gt;
|-&lt;br /&gt;
|failed_event&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The event to percept if the condition fail. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|delayed&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|The amount of time to delay before the perception is fired. [[NPC Variables]] will be replaced.&lt;br /&gt;
|}&lt;br /&gt;
This operation allows an NPC to fire a custom [[Behaviors_and_Reactions#Perceptions|perception]] to himself.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;percept event=&amp;quot;done wandering&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;percept event=&amp;quot;need help&amp;quot; target=&amp;quot;tribe&amp;quot; range=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;percept event=&amp;quot;GoToSleep&amp;quot; condition=&amp;quot;DiurnalNight&amp;quot; delayed=&amp;quot;10&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pickup Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|obj&lt;br /&gt;
|string,perception&lt;br /&gt;
|perception&lt;br /&gt;
|The object to pick up. (Only perception implemented)&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|int&lt;br /&gt;
|1&lt;br /&gt;
|Number of objects to pick up&lt;br /&gt;
|-&lt;br /&gt;
|equip&lt;br /&gt;
|slot&lt;br /&gt;
|&lt;br /&gt;
|name of slot to equip the item in (Not implemented)&lt;br /&gt;
|}&lt;br /&gt;
This operation allows an NPC to pickup an item he finds on the ground, and optionally equip(Not implemented) it if he can use it. Only objects that are pickable will be picked up.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;pickup obj=&amp;quot;perception&amp;quot; count=&amp;quot;2&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;pickup obj=&amp;quot;perception&amp;quot; equip=&amp;quot;righthand&amp;quot; /&amp;gt; (Not Implemented)&lt;br /&gt;
&lt;br /&gt;
== Release Control Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
Release the control of a player.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;release_control /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reproduce Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The tribe member type for this. [[NPC Variables]] will be replaced.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The reproduce operation will spawn the target with the type given. Tribes will use this to create different types of members (See: [[Tribe_Scripting#Select|Select]] statement in [[Tribe Scripting]]).&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;reproduce type=&amp;quot;Warrior&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To make make a copy of your self&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;locate obj=&amp;quot;self&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;reproduce /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resurrect Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No Parameters.&lt;br /&gt;
&lt;br /&gt;
This operation will resurrect a tribe member within the radius of tribe home.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;resurrect /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This operation should be placed in an behavior that will be executed for dead NPCs. The reaction should&lt;br /&gt;
as well have the when_dead flag set.&lt;br /&gt;
 &lt;br /&gt;
  Ex: &amp;lt;behavior name=&amp;quot;Resurrect&amp;quot; completion_decay=&amp;quot;200&amp;quot; growth=&amp;quot;0&amp;quot; initial=&amp;quot;0&amp;quot; when_dead=&amp;quot;yes&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;resurrect/&amp;gt;&lt;br /&gt;
      &amp;lt;/behavior&amp;gt;&lt;br /&gt;
      &amp;lt;react event=&amp;quot;tribe:resurrect&amp;quot;    behavior=&amp;quot;Resurrect&amp;quot;     inactive_only=&amp;quot;yes&amp;quot; when_dead=&amp;quot;yes&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Reward Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|resource&lt;br /&gt;
|string,tribe:wealth&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The resource to reward to the tribe. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|int&lt;br /&gt;
|1&lt;br /&gt;
|The number of resource to reward.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Will reward a tribe with a resource. Using the special &#039;&#039;tribe:wealth&#039;&#039; keyword will result in a lockup in the tribe for whats the wealth resource.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;reward resource=&amp;quot;Gold Ore&amp;quot; count=&amp;quot;2&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;reward resource=&amp;quot;tribe:wealth&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rotate Operation ==&lt;br /&gt;
(Net load: 1, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|See table below.&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The type of rotation operation to perform.&lt;br /&gt;
|-&lt;br /&gt;
|ang_vel&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|Angular velocity in degree. If 0 the NPC default angular velocity will be used.&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to use for the rotation operation&lt;br /&gt;
|-&lt;br /&gt;
|max&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|For inregion and random a range can be defined.&lt;br /&gt;
|-&lt;br /&gt;
|min&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|For inregion and radom a range can be defined.&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|For absolute and relative a value to add in degrees should be given.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Type&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|inregion&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|random&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|absolute&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|relative&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|locatedest&lt;br /&gt;
|Face in the direciton of the last located position.&lt;br /&gt;
|-&lt;br /&gt;
|locaterotation&lt;br /&gt;
|Face in the direction of the last located rotation angle.&lt;br /&gt;
|-&lt;br /&gt;
|target&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation &amp;lt;rotate&amp;gt; can be used to turn to a certain angle, to turn a relative amount, to turn a&lt;br /&gt;
random amount or to turn to face a previously located object. This turn is animated, to give a more&lt;br /&gt;
realistic look.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;rotate type=&amp;quot;random&amp;quot; min=&amp;quot;90&amp;quot; max=&amp;quot;270&amp;quot; anim=&amp;quot;walk&amp;quot; vel=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;rotate type=&amp;quot;locatedest&amp;quot; anim=&amp;quot;walk&amp;quot; vel=&amp;quot;90&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first example here is a random turn of between 90 and 270 degrees from the current heading,&lt;br /&gt;
with an angular velocity of 30 degrees per second, while playing the “walk” animation. 30 degrees&lt;br /&gt;
per second means that the maximum turn of 270 degrees will take the npc 9 seconds.&lt;br /&gt;
&lt;br /&gt;
In the second example, we have already used our &amp;lt;locate&amp;gt; operation to find a point of interest near&lt;br /&gt;
us, and we want to turn to point directly at it. Here a different (faster) angular velocity is specified&lt;br /&gt;
but other angles aren’t necessary because they are implied by the current position of the NPC and&lt;br /&gt;
the located special destination.&lt;br /&gt;
&lt;br /&gt;
This operation requires a DR update to start and stop the rotation, as the only networking overhead.&lt;br /&gt;
CPU overhead is also minimal since npcclient calculates the time required to turn the full amount&lt;br /&gt;
and puts this script to sleep for that many msec until the turn is done, then stops it.&lt;br /&gt;
&lt;br /&gt;
== Script Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the script&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Run a progression script. Target and Actor env is set for the script at the server.&lt;br /&gt;
  Ex: &amp;lt;script name=&amp;quot;my_script&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|name&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the sequence to control&lt;br /&gt;
|-&lt;br /&gt;
|cmd&lt;br /&gt;
|start,stop,loop&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The control of the sequence to issue.&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|int&lt;br /&gt;
|1&lt;br /&gt;
|The number of times to loop the sequence.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sequences are defined in the map file. They can be started, stopped, or played a number of time with the loop command. This allow the NPC to interact with large animation of world objects. This&lt;br /&gt;
could be a winch that should run only when manned, a folding bridge or door that open and close etc.&lt;br /&gt;
  Ex: &amp;lt;sequence name=&amp;quot;winch_up&amp;quot; cmd=&amp;quot;start&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Set Buffer Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|buffer&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the buffer.&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|string&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The value to set for the buffer.&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|npc,tribe&lt;br /&gt;
|npc&lt;br /&gt;
|The type of buffer to set.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Set either a NPC or a Tribe buffer. [[NPC Variables]] $NBUFFER[Buffer] (NPC Buffer) and $TBUFFER[Buffer] (Tribe Buffer) are replaced multiple places with the value of the buffer. &lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;set_buffer buffer=&amp;quot;Building&amp;quot; value=&amp;quot;Small Tent&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Share Memories Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No parameters&lt;br /&gt;
&lt;br /&gt;
This operation will share all private memories of the NPC with the tribe. Private memories is created with the [[Behavior_Operations#Memorize_Operation|Memorize Operation]]. They can be retrived by the [[Behavior_Operations#Locate_Operation|Locate Operation]] using tribe:memory:&amp;quot;memory name&amp;quot;. Memories can also be crated using the [[Behavior_Operations#Auto_Memorize_Operation|Auto Memorize Operation]].&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;share_memories /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sit Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No parameters.&lt;br /&gt;
&lt;br /&gt;
Sit tells the npc to sit down. Use [[Behavior_Operations#Standup_Operation|standup operation]] to stand up again.&lt;br /&gt;
  Ex: &amp;lt;sit /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Standup Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No parameters.&lt;br /&gt;
&lt;br /&gt;
Standup tells the npc to stand up. Use [[Behavior_Operations#Sit_Operation|sit operation]] to sit down again.&lt;br /&gt;
  Ex: &amp;lt;standup /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Talk Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|target&lt;br /&gt;
|boolean&lt;br /&gt;
|true&lt;br /&gt;
|Talk to current target&lt;br /&gt;
|-&lt;br /&gt;
|text&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The string to send&lt;br /&gt;
|-&lt;br /&gt;
|public&lt;br /&gt;
|boolean&lt;br /&gt;
|true&lt;br /&gt;
|Should this talk go to everyone in range, or only the target if public=false.&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|say,me,my,narrate&lt;br /&gt;
|say&lt;br /&gt;
|The type of talk.&lt;br /&gt;
|-&lt;br /&gt;
|command&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|A perception to send to target if it is a NPC. [[NPC Variables]] will be replaced.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If target is false, this will queue a talk command to the server from the NPC. If target is true and a target exists the same talk command will be sent to the server but a &amp;quot;&#039;&#039;command&#039;&#039;&amp;quot; perception will be sent to the&lt;br /&gt;
target as well. The target will than be able to react to this perception.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;talk target=&amp;quot;true&amp;quot; text=&amp;quot;Kneel in front of me.&amp;quot; command=&amp;quot;kneel&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;talk type=&amp;quot;me&amp;quot; text=&amp;quot;is angry&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;talk target=&amp;quot;true&amp;quot; text=&amp;quot;This message is only for you&amp;quot; public=&amp;quot;false&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Teleport Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Teleport the NPC to the current active location.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;teleport /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transfer Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|string,tribe:wealth&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The name of the item to transfer. [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|target&lt;br /&gt;
|tribe&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The target for this transfer.&lt;br /&gt;
|-&lt;br /&gt;
|count&lt;br /&gt;
|int&lt;br /&gt;
|-1&lt;br /&gt;
|Number of items to transfer. -1 is all items. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Transfere a number of item from one NPC to the target. &lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;transfer item=&amp;quot;tribe:wealth&amp;quot; target=&amp;quot;tribe&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example will transfer all of the tribe wealth from the NPC to the tribe.&lt;br /&gt;
&lt;br /&gt;
== Tribe Home Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No Parameters.&lt;br /&gt;
&lt;br /&gt;
Move the tribe home to the last active position of the NPC. This operation will issue a &amp;quot;tribe:home moved&amp;quot; perception to all members of the tribe.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;tribe_home /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tribe Type Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|Change tribe member type.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
No Parameters.&lt;br /&gt;
&lt;br /&gt;
Change the Tribe Member type of the current NPC to the new type.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;tribe_type type=&amp;quot;Queen&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Unbuild Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
Tribe operation.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unbuild a building. The building has to be targeted.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;unbild /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visible Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|}&lt;br /&gt;
No Parameters.&lt;br /&gt;
&lt;br /&gt;
This operation makes the NPC visible if it where invisible. See [[Behavior_Operations#Invisible_Operation|Invisible Operation]].&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;visible /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Wait Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|duration&lt;br /&gt;
|float&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The duration to wait.  [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|random&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|The random duration to wait.  [[NPC Variables]] will be replaced.&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to play while waiting.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This operation makes the NPC wait a specified length of time before progressing to the next&lt;br /&gt;
operation. It will loop an animation during this time also for you, so you can use it for crafting&lt;br /&gt;
actions, guard monitoring, or whatever you need that is a timed animated activity.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;wait duration=&amp;quot;30&amp;quot; anim=&amp;quot;stand&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;wait duration=&amp;quot;$NBUFFER[Sit_Duration]&amp;quot; anim=&amp;quot;sit&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example tells the NPC to play the “stand” animation and do nothing for 30 seconds. This&lt;br /&gt;
requires a network DR message with the specified animation, and another to stop the animation&lt;br /&gt;
when the duration is over. There is almost no CPU required because the script goes to sleep for the&lt;br /&gt;
duration and is woken up automatically at the end.&lt;br /&gt;
&lt;br /&gt;
As with any other scripted operation, this operation can be interrupted if another behavior preempts&lt;br /&gt;
this one from completing. So if an npc is playing the above operation, and just standing there for&lt;br /&gt;
30 seconds, and is attacked by someone, presumably an attack behavior would become top priority&lt;br /&gt;
and the npc would stop waiting and attack back.&lt;br /&gt;
&lt;br /&gt;
This concludes the section on the detailed operations possible with npc scripting today. Now we&lt;br /&gt;
will discuss how these operations work together to define behaviors and how behaviors interact&lt;br /&gt;
with each other.&lt;br /&gt;
&lt;br /&gt;
== Wander Operation ==&lt;br /&gt;
(Net load: 2, CPU Load 1) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|anim&lt;br /&gt;
|string&lt;br /&gt;
|&lt;br /&gt;
|The animation to play while wandering.&lt;br /&gt;
|-&lt;br /&gt;
|vel&lt;br /&gt;
|float&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|random&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Turn on never ending random wandering.&lt;br /&gt;
|-&lt;br /&gt;
|underground&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore underground, set true only wander underground, if set false never wander underground waypoints&lt;br /&gt;
|-&lt;br /&gt;
|underwater&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore underwater, set true only wander underwater, if set false never wander underwater waypoints&lt;br /&gt;
|-&lt;br /&gt;
|private&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore private, set true only wander private, if set false never wander private waypoints&lt;br /&gt;
|-&lt;br /&gt;
|public&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore public, set true only wander public, if set false never wander public waypoints.&lt;br /&gt;
|-&lt;br /&gt;
|city&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore city, set true only wander city, if set false never wander city waypoints.&lt;br /&gt;
|-&lt;br /&gt;
|indoor&lt;br /&gt;
|boolean&lt;br /&gt;
|invalid&lt;br /&gt;
|If not set ignore indoor, set true only wander indoor, set false never wander indoor waypoints.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using random &amp;lt;move&amp;gt; and &amp;lt;rotate&amp;gt; operations works well for creating randomized wandering&lt;br /&gt;
behaviors in open, outdoor spaces and scripters should be using that approach there. However, in tighter, indoor areas like the hydlaa sewers or the dungeon, a more specific type of randomness is required.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;wander&amp;gt; operation makes the npc in question walk between an independently defined set of&lt;br /&gt;
“waypoints”. Each waypoint is a 3d coordinate and a tolerance radius. The radius adds a ‘fuzzy’&lt;br /&gt;
factor so that multiple npcs sharing the same set of waypoints will not all walk to the exact same&lt;br /&gt;
centimeter location. Even in tight locations, a tolerance radius of .5-1m will be a lot better than 0m. Waypoints will be created with the path system available as GM commands.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;wander anim=&amp;quot;walk&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you see, the only thing specified by the wander operation is the animation to play while&lt;br /&gt;
wandering. The NPC starts by walking to the nearest waypoint to its current location, then follows&lt;br /&gt;
the waypoint choices to decide where to go next. This operation will take the NPC to the current active&lt;br /&gt;
waypoint as selected by the last [[Behavior_Operations#Locate_Operation|Locate Operation]].&lt;br /&gt;
&lt;br /&gt;
Each waypoint have a set off properties. It can be marked as indoor,underground,underwater,private,public, or city.&lt;br /&gt;
If the wander operations in specified with the indoor flag set to true only waypoints with the indoor attribute set to true will be used when wandering. Changing&lt;br /&gt;
waypoint attributes can be done by the GM command /path (TBD, Not impemented yet, has to be done in DB for now).&#039;&lt;br /&gt;
&lt;br /&gt;
Each waypoint is connected with a [[Sc_waypoint_linksTable|path]]. The path has a set of properites like TELEPORT, NO_WANDER, ONEWAY.&lt;br /&gt;
&lt;br /&gt;
This operation is very light on the network because it is all straight-line navigation between known,&lt;br /&gt;
preset points. There is 1 DR update per point hit by the npc. It is also quite light on CPU power&lt;br /&gt;
requirements because the points are known, which means no collision detection has to be done.&lt;br /&gt;
&lt;br /&gt;
One tricky thing about this is that normally non-horizontal walking is accomplished on the client&lt;br /&gt;
with collision detection with the ground/stairs. In order to get the most accurate-looking result on&lt;br /&gt;
the client, the client DOES do collision detection on these npcs. However, npcclient does simple&lt;br /&gt;
linear interpolation between the starting and ending y-coordinates of the 2 waypoints as an&lt;br /&gt;
approximation. Thus the server and client will not have the identical y-coordinate in all cases. This&lt;br /&gt;
should almost never be noticeable, though.&lt;br /&gt;
&lt;br /&gt;
== Watch Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0) &lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|nearest_actor,nearest_npc,nearest_player,owner,target&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The type of watch to do.&lt;br /&gt;
|-&lt;br /&gt;
|range&lt;br /&gt;
|float&lt;br /&gt;
|0.0&lt;br /&gt;
|The watch range. A perception will be generated when watched entity move out of range.&lt;br /&gt;
|-&lt;br /&gt;
|invisible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set to true to watch invisible entities.&lt;br /&gt;
|-&lt;br /&gt;
|invincible&lt;br /&gt;
|boolean&lt;br /&gt;
|false&lt;br /&gt;
|Set to true to watch invincible entities.&lt;br /&gt;
|-&lt;br /&gt;
|search_range&lt;br /&gt;
|float&lt;br /&gt;
|2.0&lt;br /&gt;
|When watching nearest, this range set the limit for how fare that entity can be.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Watch over nearby entities. The &amp;quot;nearest out of range&amp;quot;,&amp;quot;owner out of range&amp;quot;, or &amp;quot;target out of range&amp;quot; perception will be generated when the watched entity move out of range.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;behavior name=&amp;quot;Watch&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;watch type=&amp;quot;owner&amp;quot; range=&amp;quot;3.0&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/behavior&amp;gt;&lt;br /&gt;
      &amp;lt;react event=&amp;quot;owner out of range&amp;quot;   behavior=&amp;quot;follow_chase&amp;quot;  /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example the NPC will watch the owner. If the owner move out of the watch range 3.0 the &amp;quot;owner out of range&amp;quot; perception will be fired and the new follow_chase behavior will start.&lt;br /&gt;
&lt;br /&gt;
== Work Operation ==&lt;br /&gt;
(Net load: 0, CPU Load: 0)&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Parameter&lt;br /&gt;
!Type&lt;br /&gt;
!Default&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|type&lt;br /&gt;
|dig,fish,harvest&lt;br /&gt;
|Mandatory&lt;br /&gt;
|The type of work to do&lt;br /&gt;
|-&lt;br /&gt;
|resource&lt;br /&gt;
|string,tribe:wealth&lt;br /&gt;
|Mandatory&lt;br /&gt;
|Resource to work for or by using the keyword tribe:wealth look up in the tribe to find the resource.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Order an NPC to start digging for a resource. The keyword &amp;quot;tribe:wealth&amp;quot; will cause the resource to be looked up in the wealth_resource_nic field in the [[NPC_Behavior_Data_Structures#tribes|tribes]] table if the NPC is part of a tribe.&lt;br /&gt;
&lt;br /&gt;
  Ex: &amp;lt;work type=&amp;quot;dig&amp;quot; resource=&amp;quot;tribe:wealth&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;work type=&amp;quot;dig&amp;quot; resource=&amp;quot;Gold Ore&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:NPCClient Design]] [[Category:NPCClient Scripting]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20175</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20175"/>
		<updated>2013-12-30T23:35:51Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Message Sequence Script Hire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB. Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Script Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
== Start ==&lt;br /&gt;
Player -&amp;gt; Client: Select context menu script&lt;br /&gt;
Client -\\ Server : psHiredNPCScriptMessage&lt;br /&gt;
activate Server&lt;br /&gt;
note right: &amp;quot;Request script&amp;quot;&lt;br /&gt;
Client //- Server : psHiredNPCScriptMessage&lt;br /&gt;
deactivate Server&lt;br /&gt;
note right: &amp;quot;Request Reply with script&amp;quot;&lt;br /&gt;
Player &amp;lt;- Client : Display Script Dialog&lt;br /&gt;
== Set Work Location ==&lt;br /&gt;
Player -&amp;gt; Client: Push work location&lt;br /&gt;
Client -\\ Server : psHiredNPCScriptMessage&lt;br /&gt;
note right: &amp;quot;Work Location&amp;quot;&lt;br /&gt;
activate Server&lt;br /&gt;
Server -&amp;gt; Server : Get Current Location&lt;br /&gt;
Server -\\ NPCClient : CheckWorkLocation&lt;br /&gt;
note right&lt;br /&gt;
  Verify that location is close to a waypoint&lt;br /&gt;
  and that a path from location to waypoint&lt;br /&gt;
  can be found.&lt;br /&gt;
end note&lt;br /&gt;
activate NPCClient&lt;br /&gt;
Server //-- NPCClient&lt;br /&gt;
deactivate NPCClient&lt;br /&gt;
Client //- Server :  psHiredNPCScriptMessage&lt;br /&gt;
note right: &amp;quot;Result from location verification&amp;quot;&lt;br /&gt;
deactivate Server &lt;br /&gt;
== Script ==&lt;br /&gt;
Player -&amp;gt; Client: Edit script&lt;br /&gt;
Player -&amp;gt; Client: Push Validate&lt;br /&gt;
Client -\\ Server : psHiredNPCScriptMessage&lt;br /&gt;
note right: &amp;quot;Validate script&amp;quot;&lt;br /&gt;
activate Server&lt;br /&gt;
Client //- Server : psHiredNPCScriptMessage&lt;br /&gt;
deactivate Server&lt;br /&gt;
note right: &amp;quot;Validate Reply&amp;quot;&lt;br /&gt;
Player &amp;lt;- Client : Update Script Dialog&lt;br /&gt;
== Confirm ==&lt;br /&gt;
Player -&amp;gt; Client: Push Confirm&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whats going on inside the server.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   -guild : bool&lt;br /&gt;
   -script : csString&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20174</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20174"/>
		<updated>2013-12-30T23:23:17Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Message Sequence Confirm Hire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB. Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Script Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select context menu script&lt;br /&gt;
Client -\\ Server : psHiredNPCScriptMessage&lt;br /&gt;
activate Server&lt;br /&gt;
note right: &amp;quot;Request script&amp;quot;&lt;br /&gt;
Client //- Server : psHiredNPCScriptMessage&lt;br /&gt;
deactivate Server&lt;br /&gt;
note right: &amp;quot;Request Reply with script&amp;quot;&lt;br /&gt;
Player &amp;lt;- Client : Display Script Dialog&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whats going on inside the server.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   -guild : bool&lt;br /&gt;
   -script : csString&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20173</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20173"/>
		<updated>2013-12-30T14:05:37Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Classes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB. Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whats going on inside the server.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   -guild : bool&lt;br /&gt;
   -script : csString&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20172</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20172"/>
		<updated>2013-12-30T12:51:10Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB. Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whats going on inside the server.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20171</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20171"/>
		<updated>2013-12-30T12:21:19Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Internal Sequence Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whats going on inside the server.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20170</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20170"/>
		<updated>2013-12-30T12:20:13Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Sequence Diagrams */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequences ===&lt;br /&gt;
&lt;br /&gt;
Sequence diagrams with focus on the messages going between the different programs.&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Start Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
==== Message Sequence Confirm Hire ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Internal Sequence Diagrams ===&lt;br /&gt;
Sequence diagrams showing whas going on inside each program.&lt;br /&gt;
&lt;br /&gt;
==== Server Start Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Confirm Hire Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Server Script Hired NPC Sequence ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20169</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20169"/>
		<updated>2013-12-30T12:14:02Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Message Sequence Hire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Start Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Confirm Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Script Hired NPC Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20168</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20168"/>
		<updated>2013-12-30T12:13:05Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Message Sequence Hire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, Database&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Confirm Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
participant Client&lt;br /&gt;
participant Server&lt;br /&gt;
participant NPCClient&lt;br /&gt;
database Database&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Script Hired NPC Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20167</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20167"/>
		<updated>2013-12-30T11:33:19Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Server Confirm Hire Sequence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Script Hired NPC Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
participant HireManager&lt;br /&gt;
participant HireSession&lt;br /&gt;
database Database&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20166</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20166"/>
		<updated>2013-12-30T11:30:09Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Server Confirm Hire Sequence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
activate HireManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : VerifyPendingHireConfigured&lt;br /&gt;
HireManager -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireManager -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
deactivate HireManager&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20165</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20165"/>
		<updated>2013-12-30T11:20:12Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Server Confirm Hire Sequence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
HireManager -&amp;gt; HireSession : HireConfirmed&lt;br /&gt;
activate HireSession&lt;br /&gt;
HireSession -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager&lt;br /&gt;
participant NpcManager&lt;br /&gt;
database Database&lt;br /&gt;
EntityManager -&amp;gt; Database : Copy of master NPC&lt;br /&gt;
EntityManager -&amp;gt; NpcManager : NewNPCNotify&lt;br /&gt;
NpcManager -\\ Network : psNewNPCCreatedMessage&lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
HireSession &amp;lt;-- EntityManager : hiredNPC&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireSession -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireSession -&amp;gt; NpcManager  : QueueHiredNPCCmd&lt;br /&gt;
note right: TBD what information is needed to the NPC Client here.&lt;br /&gt;
NpcManager -\\ Network : psNPCCommandsMessage&lt;br /&gt;
deactivate HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20164</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20164"/>
		<updated>2013-12-30T11:12:21Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Message Sequence Hire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Server -\\ NPCClient : psNewNPCCreatedMessage&lt;br /&gt;
NPCClient -&amp;gt; Database : sc_npc_definition&lt;br /&gt;
note right: Update NPC definition with record for new NPC.&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
HireManager -&amp;gt; HireSession : HireConfirmed&lt;br /&gt;
activate HireSession&lt;br /&gt;
HireSession -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager &lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
HireSession &amp;lt;-- EntityManager : hiredNPC&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireSession -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireSession -&amp;gt; NpcManager  : QueueHiredNPCCmd&lt;br /&gt;
note right: TBD what information is needed to the NPC Client here.&lt;br /&gt;
NpcManager -\\ Network : psNPCCommandsMessage&lt;br /&gt;
deactivate HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20163</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20163"/>
		<updated>2013-12-30T11:07:55Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Server Confirm Hire Sequence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
HireManager -&amp;gt; HireSession : HireConfirmed&lt;br /&gt;
activate HireSession&lt;br /&gt;
HireSession -&amp;gt; EntityManager : CreateHiredNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager &lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
HireSession &amp;lt;-- EntityManager : hiredNPC&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireSession -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireSession -&amp;gt; NpcManager  : QueueHiredNPCCmd&lt;br /&gt;
note right: TBD what information is needed to the NPC Client here.&lt;br /&gt;
NpcManager -\\ Network : psNPCCommandsMessage&lt;br /&gt;
deactivate HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20162</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20162"/>
		<updated>2013-12-29T16:44:39Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Alternative 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class npc_hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of npc_hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; npc_hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
HireManager -&amp;gt; HireSession : HireConfirmed&lt;br /&gt;
activate HireSession&lt;br /&gt;
HireSession -&amp;gt; EntityManager : CloneNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager &lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
HireSession &amp;lt;-- EntityManager : hiredNPC&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireSession -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireSession -&amp;gt; NpcManager  : QueueHiredNPCCmd&lt;br /&gt;
note right: TBD what information is needed to the NPC Client here.&lt;br /&gt;
NpcManager -\\ Network : psNPCCommandsMessage&lt;br /&gt;
deactivate HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
	<entry>
		<id>https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20161</id>
		<title>Scriptable Entities Design</title>
		<link rel="alternate" type="text/html" href="https://planeshift.top-ix.org//pswiki/index.php?title=Scriptable_Entities_Design&amp;diff=20161"/>
		<updated>2013-12-28T22:51:45Z</updated>

		<summary type="html">&lt;p&gt;Magodra: /* Sequence Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This desing realize the [[Scriptable Entities]] functionality.&lt;br /&gt;
&lt;br /&gt;
= Player Use Cases =&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hiring Player: --&amp;gt; (Hire NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Define Locations)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Script Hired NPC)&lt;br /&gt;
:Hiring Player: --&amp;gt; (Release NPC)&lt;br /&gt;
:Player: --&amp;gt; (Interact with Hired NPC\nNPC Dialogues)&lt;br /&gt;
:Player: --&amp;gt; (Buy Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
== Hire NPC ==&lt;br /&gt;
Player can hire a NPC to do work for either the player or his guild. &lt;br /&gt;
&lt;br /&gt;
To limit the number of Hired NPCs each player will only be able to hire at most one NPC. Guild might be allowed to hire more NPCs.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC that hires out NPCs&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select working hours&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select type of NPC to hire&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Hiring&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Activate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Target NPC that hires out NPCs ====&lt;br /&gt;
Player target an NPC that hires out other NPCs.&lt;br /&gt;
&lt;br /&gt;
==== Select working hours ====&lt;br /&gt;
Through [[NPC Dialogues|NPC Dialogues]] the player can start a hiring process. The player will need to select if a night or day assignment is needed.&lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Working day&lt;br /&gt;
* Working night&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*Player: I would like to hire a NPC.&lt;br /&gt;
*NPC: Would you like to hire for day or night?&lt;br /&gt;
*Player: For day work.&lt;br /&gt;
&lt;br /&gt;
==== Select type of NPC to hire ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player can select type of NPC to hire. Merchant Player will only be available if the player meet a set of requirements Example: Level in crafting. &lt;br /&gt;
&lt;br /&gt;
Choices available:&lt;br /&gt;
* Guard&lt;br /&gt;
* Merchant Player&lt;br /&gt;
* Merchant Guild&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: Would you like a guard or a merchant?&lt;br /&gt;
*Player: I would like to have a guard.&lt;br /&gt;
&lt;br /&gt;
==== Confirm Hiring ====&lt;br /&gt;
&lt;br /&gt;
Through [[NPC Dialogues]] the player should confirm that he would like to hire.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example NPC dialogue:&lt;br /&gt;
*NPC: You can get one of my guard for 100 trias a day?&lt;br /&gt;
*Player: I accept the conditions.&lt;br /&gt;
&lt;br /&gt;
==== Activate Hired NPC ====&lt;br /&gt;
&lt;br /&gt;
After hire is confirmed a NPC will be spawned and assigned to the hiring player. The hired NPC will than start to follow the player.&lt;br /&gt;
&lt;br /&gt;
== Define Locations ==&lt;br /&gt;
Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.&lt;br /&gt;
&lt;br /&gt;
Using the /location command enabling players to define locations for Scripting Hired NPCs. Might need some kind of association so that when character/guild is deleted the location is deleted as well.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to location&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Define new location&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Hired NPC ==&lt;br /&gt;
Hired NPCs can be scripted. User open the [[Script Hired NPC Dialog]] to enter new scripts for the NPC.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired NPC Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Work Location&amp;quot;&lt;br /&gt;
--&amp;gt; [Guard Service] &amp;quot;Select Guard Locations&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
&amp;quot;Select Work Location&amp;quot; --&amp;gt; [Sell Items] &amp;quot;Select Item Source&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Validate Script&amp;quot;&lt;br /&gt;
if &amp;quot;Valid&amp;quot; then&lt;br /&gt;
   -down-&amp;gt; [true] &amp;quot;Confirm Script&amp;quot;&lt;br /&gt;
   --&amp;gt; &amp;quot;Store and activate script&amp;quot;&lt;br /&gt;
   --&amp;gt; (*)&lt;br /&gt;
else&lt;br /&gt;
   -right-&amp;gt; [false] &amp;quot;Edit Custom Script&amp;quot;&lt;br /&gt;
endif&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Identify Item Source ====&lt;br /&gt;
Select the source of the items to be sold. For Guilds this will be a container the guild dedicate to serve as the storage for the hired merchant.&lt;br /&gt;
&lt;br /&gt;
==== Select Work Location ====&lt;br /&gt;
From a list of locations defined by the Player using the /locate operation a work location can be defined for the Hired NPC.&lt;br /&gt;
&lt;br /&gt;
==== Validate Script ====&lt;br /&gt;
It is important that only valid scripts are given to the server. Need to make sure that the script is correct before script is stored in the db and assigned to the NPC. This validation should identify illegal syntax, validate that the commands are ok for players to use. As an example commands that create new items will not be available for players. See [[Custom NPC Dialogue|Custom NPC Dialogues]] for details.&lt;br /&gt;
&lt;br /&gt;
== Release NPC ==&lt;br /&gt;
A NPC that is no longer needed can be released. This will be done from the [[Script Hired NPC Dialog]].&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Open Script Hired Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Release Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Confirm Release&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Store and deactivate Hired NPC&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interact with Hired NPC ==&lt;br /&gt;
Using the [[NPC Dialogues]] to interact with the NPC. [[Custom NPC Dialogue|Custom NPC Dialogues]] created through the Script Hired NPC process provides the input to the [[NPC Dialogues]] system to provide custom dialogues.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Talk&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform NPC Dialogue&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Bye&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Buy Items ==&lt;br /&gt;
Using the standard interface to buy stuff from NPCs.&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Target NPC&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Select Buy&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Close Buy Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Admin Use Cases =&lt;br /&gt;
In this context admin is defined as setting or rule team members.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Admin: --&amp;gt; (Script NPC that hire out NPCs)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script NPCs that hire out NPCs ==&lt;br /&gt;
&lt;br /&gt;
This activity creates [[NPC Dialogues]] for the NPC that are going to hire out NPCs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; Select NPCs that hire&lt;br /&gt;
--&amp;gt; Create NPC Dialogue\nQuest&lt;br /&gt;
--&amp;gt;(*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Select NPCs that hire ===&lt;br /&gt;
Selection of NPCs are outside scope of this design. That is part of the Setting process.&lt;br /&gt;
&lt;br /&gt;
=== Create NPC Dialogue ===&lt;br /&gt;
&lt;br /&gt;
The [[NPC Dialogues]] will through [[Response Operation|Response Operations]] define the hired NPCs. Each NPC that will hire out other NPCs might be different but they must include steps to:&lt;br /&gt;
&lt;br /&gt;
* Start Hire&lt;br /&gt;
* Confirm Hire&lt;br /&gt;
&lt;br /&gt;
They might include steps to:&lt;br /&gt;
* Select working hours&lt;br /&gt;
* Select type of NPC to hire&lt;br /&gt;
** Guard&lt;br /&gt;
** Merchant Player Items&lt;br /&gt;
** Merchant Guild Items&lt;br /&gt;
* Select experience level&lt;br /&gt;
** Trainee&lt;br /&gt;
** Expert&lt;br /&gt;
&lt;br /&gt;
= Hired NPC Use Cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
:Hired NPC: --&amp;gt; (Guard)&lt;br /&gt;
:Hired NPC: --&amp;gt; (NPC dialogue)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Player Items)&lt;br /&gt;
:Hired NPC: --&amp;gt; (Sell Guild Items)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Guard ==&lt;br /&gt;
Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Go to work&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [Walk interval] &amp;quot;Walk round&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Guard work position&amp;quot;&lt;br /&gt;
--&amp;gt; [End of day] &amp;quot;Go home&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== NPC dialogue ==&lt;br /&gt;
Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.&lt;br /&gt;
&lt;br /&gt;
== Sell Player Items==&lt;br /&gt;
NPC can sell items for the hiring player. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Hiring Players Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sell Guild Items==&lt;br /&gt;
NPC can sell guild items. Using the standard trade front end with the trading character.&lt;br /&gt;
&lt;br /&gt;
=== Activity Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
(*) --&amp;gt; &amp;quot;Player Request Sell Dialog&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Present Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Perform Trade&amp;quot;&lt;br /&gt;
--&amp;gt; &amp;quot;Update Guild Items&amp;quot;&lt;br /&gt;
--&amp;gt; (*)&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
This section will detail some of the activities identified in the Use Cases above. Down to a level that identifies messages between client, server and npc client and some of the sequences in the server as needed.&lt;br /&gt;
&lt;br /&gt;
== Database ==&lt;br /&gt;
To keep track of hired NPCs and store the scripts new elements will be needed in the DB.&lt;br /&gt;
&lt;br /&gt;
Two alternative solutions.&lt;br /&gt;
&lt;br /&gt;
=== Alternative 1 ===&lt;br /&gt;
&lt;br /&gt;
The character relationships record keep track of relationships between characters so extending with a new hired type should cover the need for this system. A new hired_npc_scripts record will be created to store the [[Custom NPC Dialogue|Custom NPC Dialogues]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class character_relationships &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt;{&lt;br /&gt;
   +character_id&lt;br /&gt;
   +related_id&lt;br /&gt;
   +relationship_type&lt;br /&gt;
   +spousename&lt;br /&gt;
}&lt;br /&gt;
note right of character_relationships&lt;br /&gt;
Relationship_type can be:&lt;br /&gt;
*familiar&lt;br /&gt;
*buddy&lt;br /&gt;
*spouse&lt;br /&gt;
*exploration&lt;br /&gt;
*hired (NEW)&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; character_relationships : &amp;gt;&lt;br /&gt;
&lt;br /&gt;
class hired_npc_scripts &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npc_scripts&lt;br /&gt;
NEW record to keep hired npc scripts.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;1&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npc_scripts : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Alternative 2 ===&lt;br /&gt;
&lt;br /&gt;
Creating one new record to keep all information regarding hiring. This will be equivalent to the server side HireSession object. This seams like a cleaner approach than Alternative 1. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class character &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +id&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
class hired_npcs &amp;lt;&amp;lt; (D,orchid) &amp;gt;&amp;gt; {&lt;br /&gt;
   +hired_npc_id : int&lt;br /&gt;
   +owner_id : int&lt;br /&gt;
   +guild : bool&lt;br /&gt;
   +container_item_id : int&lt;br /&gt;
   +working_hours : TBD&lt;br /&gt;
   +work_location : TBD&lt;br /&gt;
   +guard_positions : TBD&lt;br /&gt;
   +script : TEXT&lt;br /&gt;
}&lt;br /&gt;
note right of hired_npcs&lt;br /&gt;
NEW record to keep hired npc information.&lt;br /&gt;
*hired_npc_id points to the NPC that is hired.&lt;br /&gt;
*owner_id points to the player that hired this npc.&lt;br /&gt;
*container_item_id points to the container&lt;br /&gt;
 containing items to be sold.&lt;br /&gt;
*script contain a Custom NPC Dialogue&lt;br /&gt;
end note&lt;br /&gt;
&lt;br /&gt;
character &amp;quot;2&amp;quot; -- &amp;quot;0..n&amp;quot; hired_npcs : &amp;gt;&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== State Diagrams ==&lt;br /&gt;
=== Hire Session States ===&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
[*] --&amp;gt; Hiring : Start Hire&lt;br /&gt;
Hiring --&amp;gt; Hired&lt;br /&gt;
Hired --&amp;gt; [*] : Release&lt;br /&gt;
&lt;br /&gt;
state Hired {&lt;br /&gt;
   [*] --&amp;gt; NotScripted&lt;br /&gt;
   NotScripted --&amp;gt; Scripted : Confirm Script&lt;br /&gt;
   state NotScripted as &amp;quot;Not Scripted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagrams ==&lt;br /&gt;
This section will be started when Use Cases has been agreed.&lt;br /&gt;
&lt;br /&gt;
=== Message Sequence Hire ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Player&lt;br /&gt;
Player -&amp;gt; Client : Context select&lt;br /&gt;
Client -\\ Server : psUserActionMessage&lt;br /&gt;
note right: action = context\nSee Context Menu Design for server details.&lt;br /&gt;
Client //- Server : psGUIInteractMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Context menu&lt;br /&gt;
Player -&amp;gt; Client : Select Talk&lt;br /&gt;
Client -\\ Server : psUserCmdMessage&lt;br /&gt;
note right: command = &amp;quot;/npcmenu&amp;quot;&lt;br /&gt;
Client //- Server : psDialogMenuMessage&lt;br /&gt;
Player &amp;lt;- Client : Display Dialog Menu&lt;br /&gt;
Player -&amp;gt; Client : Select text&lt;br /&gt;
note right: &amp;quot;I would like to hire a NPC&amp;quot;&lt;br /&gt;
Client -// Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Start Hire&lt;br /&gt;
database Database&lt;br /&gt;
note over Player, NPCClient&lt;br /&gt;
  Some more sequences to decide working hour, type of NPC to hire, etc.&lt;br /&gt;
  Using more Dialog Menu Messages and Chat Messages. Server update HireSession. &lt;br /&gt;
end note&lt;br /&gt;
Player -&amp;gt; Client: Select text&lt;br /&gt;
note right: &amp;quot;I confirm hiring&amp;quot;&lt;br /&gt;
Client -\\ Server : psChatMessage&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Server -&amp;gt; Database : hired_npcs&lt;br /&gt;
note right: Update hired_npcs with this new hire.&lt;br /&gt;
Client //- Server : psChatMessage&lt;br /&gt;
Player &amp;lt;- Client: Display chat&lt;br /&gt;
note right: &amp;quot;You hired a NPC&amp;quot;&lt;br /&gt;
Client //- Server : psPersistActor&lt;br /&gt;
note right: Spawn the new Hired NPC&lt;br /&gt;
Player &amp;lt;- Client : Display hired NPC&lt;br /&gt;
Server -// NPCClient : psPersistActor&lt;br /&gt;
Server -// NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right&lt;br /&gt;
   Server assign hired NPC to player.&lt;br /&gt;
   Add information to NPCClient about working location, guard positions etc. as applicable.&lt;br /&gt;
end note&lt;br /&gt;
Server //- NPCClient : psNPCCommandsMessage&lt;br /&gt;
note right: Cmd DRDATA&lt;br /&gt;
Client //- Server : psDRMessage&lt;br /&gt;
Player &amp;lt;- Client: NPC Movement&lt;br /&gt;
note right: Hired NPC moving up to player.&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also [[Context Menu Design]].&lt;br /&gt;
&lt;br /&gt;
=== Server Start Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
This sequence will establish the HireSession object in the HireManager. NetworkHandling is an abstraction of all the network related stuff.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Question to start hiring.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : StartHire&lt;br /&gt;
create HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Server Confirm Hire Sequence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Network&lt;br /&gt;
control NetworkHandling&lt;br /&gt;
Network -\\ NetworkHandling : psChatMessage&lt;br /&gt;
NetworkHandling -&amp;gt; ChatManager : HandleChatMessage&lt;br /&gt;
note right: CHAT_NPC, Confirming hire.&lt;br /&gt;
ChatManager -&amp;gt; ChatManager : CheckNPCResponse&lt;br /&gt;
ChatManager -&amp;gt; NpcResponse : ExecuteScript&lt;br /&gt;
NpcResponse -&amp;gt; HireManager : ConfirmHire&lt;br /&gt;
HireManager -&amp;gt; HireSession : HireConfirmed&lt;br /&gt;
activate HireSession&lt;br /&gt;
HireSession -&amp;gt; EntityManager : CloneNPC&lt;br /&gt;
note right: Spawn a new NPC&lt;br /&gt;
activate EntityManager &lt;br /&gt;
EntityManager -\\ Network : psPersistActor&lt;br /&gt;
HireSession &amp;lt;-- EntityManager : hiredNPC&lt;br /&gt;
deactivate EntityManager&lt;br /&gt;
HireSession -&amp;gt; HireSession : SetHiredNPC&lt;br /&gt;
HireSession -&amp;gt; NpcManager  : QueueHiredNPCCmd&lt;br /&gt;
note right: TBD what information is needed to the NPC Client here.&lt;br /&gt;
NpcManager -\\ Network : psNPCCommandsMessage&lt;br /&gt;
deactivate HireSession&lt;br /&gt;
HireManager -&amp;gt; HireSession : Save&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
class HireManager {&lt;br /&gt;
   +StartHire()&lt;br /&gt;
   +ConfirmHire()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
class HireSession {&lt;br /&gt;
   -state : HireState;&lt;br /&gt;
   -ownerId : PID&lt;br /&gt;
   -hiredNPCId : PID&lt;br /&gt;
   +HireSession(owner:gemActor)&lt;br /&gt;
   +SetHiredNPC(hiredNPC:gemNPCActor)&lt;br /&gt;
   +HireConfirmed()&lt;br /&gt;
   +Save()&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
HireManager &amp;quot;1&amp;quot; *-- &amp;quot;0..n&amp;quot; HireSession : hireSessions&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
ResponseOperation &amp;lt;|-- XXResponseOp&lt;br /&gt;
&lt;br /&gt;
class XXResponseOp{&lt;br /&gt;
}&lt;br /&gt;
note right&lt;br /&gt;
  Number of NEW operations.&lt;br /&gt;
  XX=StartHire,HireWorkingHour,HireNPCType,ConfirmHire,Etc.&lt;br /&gt;
end note&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Utility Functions =&lt;br /&gt;
&lt;br /&gt;
== Admin /hire command ==&lt;br /&gt;
A admin /hire command equivalent to the NPC Dialogues will be created to allow testing and verification. Will also work as a GM tool to manipulate hires.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;uml&amp;gt;&lt;br /&gt;
actor Admin&lt;br /&gt;
Admin -\\ Server : /hire start&lt;br /&gt;
Server -&amp;gt; Server : Start New Hire&lt;br /&gt;
Admin -\\ Server : /hire type &amp;quot;Merchant Guild&amp;quot;&lt;br /&gt;
Server -&amp;gt; Server : Set type for hire session.&lt;br /&gt;
Admin -\\ Server : /hire confirm&lt;br /&gt;
Server -&amp;gt; Server : Confirm Hire&lt;br /&gt;
Admin //- Server : New Hired NPC&lt;br /&gt;
Admin -\\ Server : /hire release&lt;br /&gt;
Server -&amp;gt; Server : Release Hire&lt;br /&gt;
&amp;lt;/uml&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Engine documents]] [[Category:Server Design]]&lt;/div&gt;</summary>
		<author><name>Magodra</name></author>
	</entry>
</feed>