Showing posts with label inventory. Show all posts
Showing posts with label inventory. Show all posts

Saturday, April 11, 2015

Buy and sell

Small update
I added the sell counterpart to the shop!



Thursday, April 9, 2015

Working on the shop

Hello,

I'm working on shops, that will be used by the player to buy and sell stuff.

It's probable that in the first release of the game there will only a shop, that will let buy some of the already implemented dresses.

In the future, I tought that some jobs might give you items instead of money that could be used for something or sold in shops (basic example: cutting woods will give you log, you can use them to craft shit or just sell them in a shop)

At the moment shop support only buying but in these days I'll add the sell part.

In the image you can see the test shop.
As you can see is pretty similar to the normal inventory but has an additional column.

For the first release shops will be pretty basics:

  •  items don't deplete, you can buy as much as you want (as long you have the money)
  • you can buy one item at a time, for dresses it might be fine but if in the future I'll add collectable items, there will be a need to buy items in bulk.





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.


Thursday, April 2, 2015

Working on the inventory system

Ahoy, yarrr.
Why the pirate sounds, you might ask.
Well, yes, as you probably was thinking, the reason for that is totally random.


Anyway, I'm now working on a inventory system.
It's not the first time I try to model a item system and I remember that I always struggled to that.
But this time seems to be going in an interesting way.
All thanks a post I've found in some forum were people were talking about how to make a inventory system.

Well, I show you how it's now (it's a bit crude but it's just to show how the interaction goes).

1. The inventory will show both the player and the slave inventory.

2.Clicking on an item will open a context menu which can have 1 or more actions. For example: Equip, Use, Sell... In the example here bra is a dress and so can be equipped.

3. Selecting Equip will move the item to the girl inventory and equip it (as you can see by the subtle white under the top)



Now, for the technical part. How the Inventory system actually work.
Earlier I said I read the post. That post actually kinda opened my mind.
One of the people told to just make a base class Item and then subclass to make more specialized items.
E.g. Item -> EdibleItem -> Cake

That's was my idea at first, but then someone wrote something like this:
Instead of subclassing you should think an Item as a set of feature.
BOOM. That blow my mind.

Long story short, items in game are substantially just a named container for action you can do with them.
For example the bra we have seen in the images is an Item named bra, which contains an action named Equip. The Equip action when called move the item to the slave inventory and equip it.

This let me attach behaviour to the object freely.
Next thing I'm gonna do is to create some kind of store in the game and add a Sellable action for the items.


Okay, that's to much for one post, so see you next time YAAAARRR