Scriptable Entities Design: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Magodra (talk | contribs)
Magodra (talk | contribs)
Line 8: Line 8:
<uml>
<uml>
:Hiring Player: --> (Hire NPC)
:Hiring Player: --> (Hire NPC)
:Hiring Player: --> (Define Locations)
:Hiring Player: --> (Script Hired NPC)
:Hiring Player: --> (Script Hired NPC)
:Hiring Player: --> (Extend Hire)
:Hiring Player: --> (Define Locations)
:Hiring Player: --> (Release NPC)
:Hiring Player: --> (Release NPC)
:Player: --> (Interact with Hired NPC\nNPC Dialogues)
:Player: --> (Interact with Hired NPC\nNPC Dialogues)
:Player: --> (Buy)
:Player: --> (Buy Items)
</uml>
</uml>
== Hire NPC ==
== Hire NPC ==
Line 19: Line 18:
=== Activity Diagram ===
=== Activity Diagram ===


Alternative 1:
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.
Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.
<uml>
<uml>
(*) --> "Target NPC that hires out NPCs"
(*) --> "Target NPC that hires out NPCs"
Line 30: Line 29:
</uml>
</uml>


Alternative 2: Using a dialog to hire.
==== Target NPC that hires out NPCs ====
<uml>
Player target an NPC that hires out other NPCs.
(*) --> "Target NPC"
 
--> "Open Hire Dialog"
==== Select working hours ====
--> "Select Service"
Through [[NPC Dialogue|NPC Dialogues]] the player can start an hiring process. The player will need to select if a night or day assignment is needed.
--> "Select Hiring Period"
 
--> "Select Working Hours"
Choices available:
--> "Confirm Hiring"
* Working day
--> "Pay Hiring Fee"
* Working night
--> "Store and activate Hired NPC"
--> (*)
</uml>


==== Target NPC ====
Example NPC dialogue:
Player target npc either directly through selecting the NPC or indirect through selection of target in the "/hire" command line.
*Player: I would like to hire a NPC.
*NPC: Would you like to hire for day or night?
*Player: For day work.


==== Open Hire Dialog ====
==== Select type of NPC to hire ====
Either using the command "/hire" or selecting the Hire Icon from the [[Context Menu]] (See [[Context Menu Design]]). This open the [[Hire NPC Dialog]]. From the [[Hire NPC Dialog]] the hiring player can do the following:
*Select services
*See the price for hiring
*Determine the length of the Hire
*Create/Edit [[Custom NPC Dialogue|Custom NPC Dialogues]] (See the [[#Script Hired NPC|Script Hired NPC]] use case for details.)


==== Select Service ====
Through [[NPC Dialogue|NPC Dialogues]] the player can select type of NPC to hire.
TODO: Move this to the NPC that hire out NPCs.


Select service needed from a list of services:
Choices available:
*Guard
* Guard
*Sell Hiring Player Items
* Merchant
*Sell Guild Items
*[[Custom NPC Dialogue]]


==== Select Hiring Period ====
Example NPC dialogue:
Selection of hours, days, months or years to hire the NPC.
*NPC: Would you like a guard or a merchant?
*Player: I would like to have a guard.


==== Select Working Hours ====
==== Confirm Hiring ====
Selection of time of day the NPC will start to work and number of hours up to maximum of a scriptable number of hours per day.


==== Select Working Location ====
Through [[NPC Dialogue|NPC Dialogues]] the player should confirm that he would like to hire.
Selection of a location identified by the player through [[#Define Locations]] activity to be the working location for the NPC.


==== Identify Items to Sell ====
TBD: How to identify the items to sell. For hiring players items, the items should be in storage, but probably not all items in storage should be
eligible for selling?


TBD: For Guild Items container items need to be selected as storage. All items in the container could probably be sold, but not all items are of interest for buying?
Example NPC dialogue:
*NPC: You can get one of my guard for 100 trias a day?
*Player: I accept the conditions.


TBD: How should the price be determinded?
==== Activate Hired NPC ====


==== Script Hired NPC ====
After hire is confirmed a NPC is assigned to the hiring player. The hired NPC will than start to follow the player.
Create/Edit [[Custom NPC Dialogue|Custom NPC Dialogues]] (See the [[#Script Hired NPC 2|Script Hired NPC]] use case for details.)


== Script Hired NPC ==
== Script Hired NPC ==

Revision as of 22:16, 24 December 2013

This desing realize the Scriptable Entities functionality.

TODO/TBD List

  • Identify how to select the items to sell (See Identify Items to Sell)
  • Guild items should be through a guild chest or crate. Activities to establish this has to be identified.

Player Use Cases

Hire NPC

Player can hire a NPC to do work for either the player or his guild.

Activity Diagram

Using a NPC that hiring out other NPCs to start the hire. Each activity involving player is performed using NPC Dialogues.

Target NPC that hires out NPCs

Player target an NPC that hires out other NPCs.

Select working hours

Through NPC Dialogues the player can start an hiring process. The player will need to select if a night or day assignment is needed.

Choices available:

  • Working day
  • Working night

Example NPC dialogue:

  • Player: I would like to hire a NPC.
  • NPC: Would you like to hire for day or night?
  • Player: For day work.

Select type of NPC to hire

Through NPC Dialogues the player can select type of NPC to hire.

Choices available:

  • Guard
  • Merchant

Example NPC dialogue:

  • NPC: Would you like a guard or a merchant?
  • Player: I would like to have a guard.

Confirm Hiring

Through NPC Dialogues the player should confirm that he would like to hire.


Example NPC dialogue:

  • NPC: You can get one of my guard for 100 trias a day?
  • Player: I accept the conditions.

Activate Hired NPC

After hire is confirmed a NPC is assigned to the hiring player. The hired NPC will than start to follow the player.

Script Hired NPC

Hired NPCs can be scripted. User open the Hire NPC Dialog to enter new scripts for the NPC.

Activity Diagram

Alternative 1:

Alternative 2:

Validate Script

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 Dialogues for details.

Extend Hire

Opening the Hire NPC Dialog enable the Hiring Player to extend the hire period and pay the extra fee.

Activity Diagram

Define Locations

Enable the Hire to define locations used when scripting their hired NPCs. This would be Work Locations and Guard Locations.

To decide: Should this be implemented through the /location command? Enabling players to define locations, might need some kind of association so that when character/guild is deleted the location is deleted as well.

Activity Diagram

Release NPC

A NPC that is no longer needed can be released. This will be done from the Hire dialog.

Activity Diagram

Interact with Hired NPC

Using the NPC Dialogue to interact with the NPC. Custom NPC Dialogues created through the NPC Hire process provides the input to the NPC Dialogue system to provide custom dialogues.

Activity Diagram

Buy

Using the standard interface to buy stuff from NPCs.

Activity Diagram

Hired NPC Use Cases

Guard

Perform Guard duties. Pre-programmed guard action. Player select working hours, working position, a number of check points and interval for checking thous.

NPC dialogue

Through Quest script syntax with user safe commands enabling custom scripts to be crated for the NPC.

Sell Hiring Players Items

NPC can sell items for the hiring player. Using the standard trade front end with the trading character.

Activity Diagram

Sell Guild Items

NPC can sell guild items. Using the standard trade front end with the trading character.

Activity Diagram

Detailed Design

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.

Sequence Diagrams

This section will be started when Use Cases has been agreed.