While I /normally/ don't do this I am going to release the basic spec/concept documents that are being used for the dialogue and inventory systems.
I want to know what you think of it =)
Each entity has a map of topic objects, keyed by the topic name:
name: unique topic id for the entity
text - the actual display text for the topic
visible - if the topic is visible or not
action - the lua function to call on the entity script
currentState - the current state of the topic (by default this value is 0)
visitedState - the value 'currentState ' was in when you last chose this topic (by default this value is -1)
showing and hiding topics allows for topics to present themselves or to be finished
when topics are shown, if currentState and visitedState are not equal (by default)
the topic is shown as fully illuminated (not yet visited). When a topic is chosen visitedState is updated
to the value of currentState. If currentState and visited state are equal (after a topic is read) the topic
is displayed slightly greyed to show that the topic has already been visited.
Using the associated setTopicState function you can progress the topic state, when this is done the current
and visited states will differ showing that the topic has new information to display.
if the topic state is changed you should always provide more information on the topic, a best practice is
to add a very short summary of the preceding dialogue as the end-state.
the first topic created should always be the 'hello' topic, this topic is not shown in the topics list
but instead is automatically called when you begin conversation with an entity.
Entities who have no topics or no visible topics cannot be spoken to.
If an entities topics become all invisible during conversation the conversation ends when the next topic
Handling Topic Choices:
When a topic is chosen the system ends the topic choice interface, and calls the associated function on the
entities script, from there it is up to the script code to choreograph the conversation using general logic and
the associated dialogue commands.
Speaking and Expression:
characters can speak via the talk command.
talk(entity,"This is some dialogue.","action");
this makes the character's dialogue appear above them, and they will play the action animation if it exists.
NOTE: perhaps use an acting markup language?
flesh out this system =)
Dialogue Relative ASCII Markup Actions
Script Control Functions:
createTopic(this,"myFather","Did you know my father?",true,"onTopicMyFather");
The game has a list of inventory items
And a pointer to the currently held item if applicable
An inventory item is simply an entity.
While it is possible to place an inventory item in the world, the image differences
between world and inventory usually prohibit this.
in normal operation when an item in world is taken, the Take verb is handled
and the appropriate inventory entity is created and can be placed into the inventory
Inventory items are shown in a rectangular grid in the Inventory menu, if the inventory size
exceeds the viewable space scroll arrows will become apparent at the lower left and right
if a scroll is possible the arrows will be visible in that direction.
Item Self Interaction:
while in the inventory an item can be interacted with.
left clicking an item will show the standard verb radial menu, with such options as
in the default case, use will put them item in your 'hand' where it can be used with other items
or used in the game world.
when an item is in hand you can still see the item in-inventory, but this does not mean you have two.
Item With Item Interaction:
when an item is in hand and the item is clicked on another inventory item, this signals an attempt
to 'combine' the items.
an onUse message is raised on both items,ONLY IF THE ITEMS ARE DIFFERENT, and the opposite respective item is passed.
at the end of this action the hand is emptied, the result of the combine is up to the onUse function, by default nothing happens.
Item With World Interaction:
if an item is clicked on a world entity, an onUse message is raised, and the item is passed to the function,
at the end of this action the hand is emptied, the result of this is up to the onUse event, by default nothing happens.
[topicID](state) //used for speaking about topics