Items: Consuming in Steps

Started by Stray, February 23, 2013, 11:23:11 am

Previous topic - Next topic

Stray

I thought about a script, which makes a better way of consuming items.

With this script, it should be possible to consume certain items in steps. For example: A bread is completely consumed after 4 bites. Every use gives back a part of the restored HP/SP.
Instead of 12 HP at once -> 3 + 3 + 3 + 3 -> 4 times usable.
I'm very grateful to you all for your great help.

MOAL

February 23, 2013, 05:07:43 pm #1 Last Edit: February 23, 2013, 05:16:39 pm by MOAL
Just make an item call a common event in the Database where it gives you the next stage of the item up until the final stage. It'll take separate common events per each stage used, but the last one won't need a common event to be called because you just need it to disappear from the inventory like all consumables do. It's way more simple than having a script to do it.

As an example, in the common event, keep the trigger blank and just make it add the next stage item to the inventory. It won't work another way because the item gets used first and then calls the common event, and if you have many of that item, you can't use conditional branches because it'll conflict. If you need a picture of it, here:
Spoiler: ShowHide

Stray

February 24, 2013, 02:12:38 pm #2 Last Edit: February 24, 2013, 02:13:56 pm by Stray
My small problem is, I don't want the item window beeing closed every time an item is consumed.
It also had to be compatible with Blizz-ABS.
I'm very grateful to you all for your great help.

diagostimo

the way I would do it is have a separate item for each stage of its consume, and have a common event that is called when it is consumed, this would probably be better than just using a variable detecting how many times it has been eaten as imagine you have 4 consumes, you consume twice then sell that item or remove it from the inventory in some means or other, when you use a fresh item it will still be on the same consume count, so you could just do it in seperate items ie:

whole bread: when eaten removes 1 of whole bread and gives 3/4 of bread
3/4 of bread: when eaten removes 1 of 3/4 of bread and gives 1/2 of bread
ect
1/4 of bread: when eaten just removes(its fully used)

that way you will have to make more items but its more managable

MOAL

Quote from: Stray on February 24, 2013, 02:12:38 pm
My small problem is, I don't want the item window beeing closed every time an item is consumed.
It also had to be compatible with Blizz-ABS.


Tested and works with hotkeys (direct hotkeys need to be enabled), I don't see why it "wouldn't" work though. It's vanilla features after all. Anyway, you won't need to use from the inventory if using BABS because the hotkeys make access to healing items and such useless to do from the inventory itself.

Stray

February 26, 2013, 02:51:02 pm #5 Last Edit: February 26, 2013, 02:56:31 pm by Stray
I'd like to use the inventory. There aren't enough hotkeys for all the consumable items. Allocating them to the hotkeys everytime would be kind of annoying I think.
I'm very grateful to you all for your great help.

BetaGod

Quote from: MOAL on February 23, 2013, 05:07:43 pm
Just make an item call a common event in the Database where it gives you the next stage of the item up until the final stage. It'll take separate common events per each stage used, but the last one won't need a common event to be called because you just need it to disappear from the inventory like all consumables do. It's way more simple than having a script to do it.

As an example, in the common event, keep the trigger blank and just make it add the next stage item to the inventory. It won't work another way because the item gets used first and then calls the common event, and if you have many of that item, you can't use conditional branches because it'll conflict. If you need a picture of it, here:
Spoiler: ShowHide



Do that and add this as a script call at the end of the common event:

$scene = Scene_Item.new


It is not smooth but works fine  :huh: I'll try to come up with something better in a while..
I am a god in BETA status and therefore, i may contain bugs and such.

Stray

I'm very grateful to you all for your great help.