Author Topic: Coding Request: Stacking Items  (Read 1317 times)

So, I'm making a health restoring device that's aim is for you to be able to carry more than one, in only one item slot. Maybe even having x? in the Icon image indicating how many are stacking. But I'm at a loss or coding when trying to tackle this so I need help here.

Or is this Imposable?

Impossible?
no - definately possible.
The actual scripting to keep track of count is not that hard.  when the item is picked up, set %client.Tools[%toolNumber]Count=<whateverCountYouWant>

then when the player uses the item:
%client.Tools[%toolNumber]Count --;
if  (%client.Tools[%toolNumber]Count < 1)
  ... drop the item
else
   equip the item again

but im not sure how you would update the icon to display a number.

How bout like a bottom print that tells you how many you have?

Code: [Select]
commandToClient(%obj.client,'bottomPrint',"\c6:Device Amount: \c3" @ %obj.getDeviceAmount() @ "%", 3);
This? Except where it says device put the name of your object.


I'm not sure, just basing it off something i made, but i don't think GetDeviceamount is a function. maybe this?
Code: [Select]
%client.Tools[%toolNumber]Count --;
from what Red_Guy posted.

How bout like a bottom print that tells you how many you have?

Or you could limit it to say, 5 items at a time, and make 5 diffrent item icons with the corresponding numbers at the bottom.

But there's still the problem, "How to change Icon Images"

But there's still the problem, "How to change Icon Images"
Not really.
messageClient(%client,'MsgItemPickup',"",%slot,%item);

Ok, well. I still don't know where I should put this code...

Not really.
messageClient(%client,'MsgItemPickup',"",%slot,%item);

Im interested in doing the same for one of my  own mods - so how would you accomplish this?

for instance - set stuff up so the player can pick up 5 hammers.  when the pickup the 2nd hammer, it puts a "2" on the player's icon, or the description. 
How would you do that?

Im interested in doing the same for one of my  own mods - so how would you accomplish this?

for instance - set stuff up so the player can pick up 5 hammers.  when the pickup the 2nd hammer, it puts a "2" on the player's icon, or the description.
How would you do that?
Make a bunch of items with different icons. Alternatively mod the client's tools GUI to have a counter.

To make is count how many you have in your inventory slot, couldn't you just make like, 10 prints, all numbered from 1-10. Then every time you pick up a new pack. It changes the slot image to the next increasing number. And vice versa for using them. Right?

Make a bunch of items with different icons. Alternatively mod the client's tools GUI to have a counter.
Horribly inefficent with all the datablocks needed - but yes that would work.