HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Best method of doing this? (Custom Items)

12-02-2006, 03:07 PM#1
Fulla
Ok, im trying to comeup with the best/most efficient method of creating items like this:

Gold Coin: Generates 1 Gold Per Second

Have to take a few things into consideration:

- Purchasing item
- Transfering item
- Dropping/Selling Item
- Having multiples of same item

How would you do it?
thx
12-02-2006, 03:14 PM#2
shadow1500
Best method would be to use charges + stacking system.
12-02-2006, 03:38 PM#3
Fulla
Ah sorry, I mean the generate gold part?

Would you pick every hero each second and check/count amount of Gold Medallions?

Or as soon as item is acquired begin a timer?
12-02-2006, 03:53 PM#4
Captain Griffen
I'd add the unit to a unit group, then each second check each unit in the group, remove if it doesn't have it and add gold if it does.
12-02-2006, 03:54 PM#5
Taur
err this is for DoD right? I would assume u have an array variable for each hero? so every X seconds run through a loop and check if the hero has a gold coin, if he does add 1xnumber of charges to the players gold. You could also use floating text to display a cool +1 gold thing.
12-02-2006, 04:53 PM#6
The_AwaKening
If it is going to run every second of the game, I would do something different rather than checking all item slots every second. How about setting up a global integer array. Then setup a trigger for unit acquires item and drops item. Set the integer[playernumber] to + or - 1 depending on if it was dropped or picked up. Then you would only need to loop and add integer[playernumber] to gold without having to check item slots.