Monday, April 6, 2015

Added EventSteps for item related things

Hello after creating the basic inventory system I had to add a way to interact with it during events.

In particular, who writes events, at the moment need two things in particular:


  • Add/Remove items
  • Equip/Unequip items

Those action had been traduced to 4 event step:
  • AddItem
  • RemoveItem
  • Equip
  • Unequip
In game items are defined using an xml file, for each item there's a creationId. That id is used when you need to create the item itself.
All but the Unequip event step require as input parameter the creationId of an item.

Let's see:

<AddItem>ChinaDress</AddItem>
Will add the item defined in the xml with id ChinaDress to the player inventory

<Equip>ChinaDress</Equip>
Will remove the item from the player inventory, move it to the slave inventory and equip it.

<Unequip>Shirt</Unequip>
Since the ChinaDress item is equipped on the shirt slot, calling this event step will unequip it (ie. remove it from slave inventory and put it back in player inventory)

And finally:
<RemoveItem>ChinaDress</RemoveItem>
Will remove the item from the player inventory.


But why the equip doesn't take the item id as parameter?
I find it strange that someone would like to remove exactly a specified item (anyway this is possible using expression).
A more common case (actually the only I had) is that I need to remove all dress or only a couple of them, doing that using item id is practically impossible.

Bonus info:

The current slots for dress are:
  • Shirt
  • Trousers
  • Bra
  • Panties
An equippable item can occupy 1 or more slot.


No comments:

Post a Comment