• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Simple Item Table System v1.00

- This system allows you to customize your loot for each unit-type !
- Useful for RPGs or loot-based games !


External Instructions
- Open World Editor - File - Preferences... - General Tab - Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Item Table System folder.
- YOU'RE DONE !


  • IT Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_IT_Hashtable = InitHashtable()
      • -------- /////////// --------
      • -------- IT_UnitDrop = The Unit-type --------
      • -------- IT_ItemList = list of items that IT_UnitDrop will drop --------
      • -------- IT_ItemCount = total count of IT_ItemList --------
      • -------- REMEMBER: Each time you have done set variables per unit-type, run the IT Save <gen> trigger to register the unit-type inside the system --------
      • -------- /////////// --------
      • -------- CONFIGURABLES --------
      • -------- /////////// --------
      • Set IT_UnitDrop = Peasant
      • Set IT_ItemList[1] = Claws of Attack +15
      • Set IT_ItemList[2] = Crown of Kings +5
      • Set IT_ItemList[3] = Kelen's Dagger of Escape
      • Set IT_ItemCount = 3
      • Trigger - Run IT Save <gen> (ignoring conditions)
      • Set IT_UnitDrop = Footman
      • Set IT_ItemList[1] = Mask of Death
      • Set IT_ItemList[2] = Orb of Frost
      • Set IT_ItemList[3] = Ring of Protection +5
      • Set IT_ItemList[4] = Tome of Power
      • Set IT_ItemList[5] = Blood Key
      • Set IT_ItemCount = 5
      • Trigger - Run IT Save <gen> (ignoring conditions)
      • Set IT_UnitDrop = Rifleman
      • Set IT_ItemList[1] = Ghost Key
      • Set IT_ItemList[2] = Moon Key
      • Set IT_ItemCount = 2
      • Trigger - Run IT Save <gen> (ignoring conditions)
      • -------- /////////// --------
      • -------- END OF CONFIGURABLES --------
  • IT Save
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_IT_Key = udg_IT_UnitDrop
      • Hashtable - Save IT_ItemCount as 0 of IT_Key in IT_Hashtable
      • For each (Integer LoopingInteger) from 1 to IT_ItemCount, do (Actions)
        • Loop - Actions
          • Custom script: set udg_TempInt = udg_IT_ItemList[udg_LoopingInteger]
          • Hashtable - Save TempInt as LoopingInteger of IT_Key in IT_Hashtable
  • IT Event
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_IT_Key = GetUnitTypeId(udg_TempUnit)
      • Custom script: set udg_TempItemType = LoadInteger(udg_IT_Hashtable, udg_IT_Key, 1)
      • Custom script: if udg_TempItemType != null then
      • Set IT_ItemCount = (Load 0 of IT_Key from IT_Hashtable)
      • For each (Integer LoopingInteger) from 1 to IT_ItemCount, do (Actions)
        • Loop - Actions
          • Custom script: set udg_IT_ItemList[udg_LoopingInteger] = LoadInteger(udg_IT_Hashtable, udg_IT_Key, udg_LoopingInteger)
      • Set TempLoc = (Position of TempUnit)
      • Item - Create IT_ItemList[(Random integer number between 1 and IT_ItemCount)] at TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: endif
-


v1.0
- Initial release


Keywords:
simple, item, table, system, loot, rpg, defskull, hashtable, set.
Contents

Just another Warcraft III map (Map)

Reviews
Approved Suggested changes: Add drop chance Add support for more than one drop on death You don't need to set itemcount in setup, loop until array index == null Then store the last index that wasn't null No need to load all item types into...

Moderator

M

Moderator

Reviewed by Maker, Simple Item Table System v1.00, 14th Jan 2013

Approved

Suggested changes:
  • Add drop chance
  • Add support for more than one drop on death
  • You don't need to set itemcount in setup, loop until array index == null
    Then store the last index that wasn't null
  • No need to load all item types into an array in the death trigger. Use random(1, ItemCount) as a key
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
ok using a hashtable to store the different item drops is good but you dont need to save the dropping unit into an array, you can use some underused stat like food prodused to represent that unit, for example set footman's food produced to 1, peasant to 2 etc store the items in a hashtable then when a unit dies this will either create an item or be null depending on weather the food produced value of the unit is linked to items or not
 
I suggest not using food related things as most maps seem to use food in some way or another... And anyway, he already uses UnitTypeID which is unique for each unit type so why bother using other things that can potentially cause conflicts?

Also I don't see a part that saves a unit into an array... maybe you mistook the part that saves the Unit Type (GUI) into a temporary variable as saving units into an array?

As for the system, well its pretty nice and simple... not as much functions as my system but hey this is GUI... though like Maggy said, being able to process more than one drop per unit is a really good (and maybe needed) addition to this... :)
 
Top