- Joined
- Dec 3, 2018
- Messages
- 905
I'm making an array which must store 20 item types. Every time a unit buys an item, that item is stored in the array. I'm noob at arrays, can some1 pls show me how to do it.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Setup

Events


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set VariableSet ItemHashtable = (Last created hashtable)
Acquire Item

Events


Unit - A unit Acquires an item

Conditions

Actions


Set VariableSet Total = (Load 0 of (Key (Triggering unit).) from ItemHashtable.)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




Total Less than 20



Then - Actions




Set VariableSet Total = (Total + 1)




Hashtable - Save Total as 0 of (Key (Triggering unit).) in ItemHashtable.




Set VariableSet ItemType = (Item-type of (Item being manipulated))




Custom script: set udg_Item = udg_ItemType




Hashtable - Save Item as Total of (Key (Triggering unit).) in ItemHashtable.



Else - Actions
Load Item Type

Events


Unit - A unit Starts the effect of an ability

Conditions

Actions


Set VariableSet Item = (Load 5 of (Key (Triggering unit).) from ItemHashtable.)


Custom script: set udg_ItemType = udg_Item


Item - Create ItemType at (Position of (Triggering unit))
Item Type Array

Events


Map initialization

Conditions

Actions


Set VariableSet Items[1] = Claws of Attack +15


Set VariableSet Items[2] = Crown of Kings +5


Set VariableSet Items[3] = Kelen's Dagger of Escape


Set VariableSet Items[4] = Mask of Death


Set VariableSet Items[5] = Orb of Frost
Untitled Trigger 001

Events


Unit - A unit Acquires an item

Conditions


ItemCount Less than 20

Actions


Set VariableSet ItemCount = (ItemCount + 1)


Set VariableSet ItemType[ItemCount] = (Item-type of (Item being manipulated))
Untitled Trigger 001

Events


Unit - A unit Sells an item (from shop)

Conditions


ItemCount Less than 20

Actions


Set VariableSet ItemCount = (ItemCount + 1)


Set VariableSet ItemType[ItemCount] = (Item-type of (Sold Item))
