How do I modify item charges?
The global idea is: unit picks item, item have 5 charges and it grants unit ability, each time ability is used one charge from item is subtracted, and when all charges used item destroys itself.
I'm really at loss in here =[.
You can add charges to an item, Parameters need to be the following:
-the item (more specific the unit which represents the item)
-the link you entered for the charges (a string, usually "Item/(Itemname)" or something)
-the amount (this is a fixed, for example you can handle charges of 0.5 aswell)
Note that the amount is calculated quite counter-intuitive. If you, for example, have an item with 5 charges out of 20 charges maximum, the get charges function returns 15 (it returns the charges that were used already, so it calculates 20 charges max minus 5 charges remaining = 15 charges used)
If you want to add a charge, you need to add -1 charges; if you want to remove a charge, add 1 using the function.
I hope I did understand you correctly, you know, how to get a consumable item with charges already, correct?
If you want this item not useable by itself but only via the unit ability, set the charges used to 0, so using the item will not deplete the charge (I did not test this, though)
How do I modify item charges? The global idea is: unit picks item, item have 5 charges and it grants unit ability, each time ability is used one charge from item is subtracted, and when all charges used item destroys itself. I'm really at loss in here =[.
Shameless bump.
Bump!
Gonna bump this again, still havn't found a solution. Can anyone confirm if this is even possible?
There are some trigger functions:
UnitGetChargeUsed(unit,link);
UnitAddChargeUsed(unit,link,amount);
You can add charges to an item, Parameters need to be the following:
-the item (more specific the unit which represents the item)
-the link you entered for the charges (a string, usually "Item/(Itemname)" or something)
-the amount (this is a fixed, for example you can handle charges of 0.5 aswell)
Note that the amount is calculated quite counter-intuitive. If you, for example, have an item with 5 charges out of 20 charges maximum, the get charges function returns 15 (it returns the charges that were used already, so it calculates 20 charges max minus 5 charges remaining = 15 charges used)
If you want to add a charge, you need to add -1 charges; if you want to remove a charge, add 1 using the function.
I hope I did understand you correctly, you know, how to get a consumable item with charges already, correct? If you want this item not useable by itself but only via the unit ability, set the charges used to 0, so using the item will not deplete the charge (I did not test this, though)
€ why the hell does the forum cut line breaks?