• 🏆 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 Weight System v1.0 [GUI]

- This system will allow item(s) to have its own weight (depends on Item-type).
- This is somehow useful for RPGs, where epic item would be heavy (or light), ahhh use it on your own creativity :)
- MUI and bugless (for now..)
- This system is in GUI !


External Instructions
- File > Preferences > General Tab > Tick on the Automatically create unknown variables while pasting trigger data
- Copy the folder Simple Item Weight System from Trigger Editor

Internal Instructions
- Everything is pretty much explained in the IW Setup trigger


  • IW Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_IW_Hashtable = InitHashtable()
      • Set IW_ItemRegister = True
      • -------- CONFIGURABLES --------
      • -------- IW_ShowImprovement is an option whether you want to show what is currently happening or not --------
      • -------- Default setting is show = True --------
      • -------- Will show these features below: --------
      • -------- Movespeed after acquiring/losing item --------
      • -------- Name of item that is involved --------
      • -------- How much speed is involved by that item --------
      • -------- ----- --------
      • -------- IW_Item sets the item-type which holds the data on increasing/decreasing speed per item --------
      • -------- IW_Value sets how much increase/decrease speed per item-type --------
      • -------- Positive values of IW_Value will decrease movespeed for that item, Negative values of IW_Value will increase movespeed for that item --------
      • -------- #1 ITEM --------
      • Set IW_Item = Amulet of Recall
      • Set IW_Value = 5
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • -------- #2 ITEM --------
      • Set IW_Item = Ancestral Staff
      • Set IW_Value = 15
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • -------- #3 ITEM --------
      • Set IW_Item = Arcanite Shield
      • Set IW_Value = 30
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • -------- #4 ITEM --------
      • Set IW_Item = Bladebane Armor
      • Set IW_Value = 10
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • -------- #5 ITEM --------
      • Set IW_Item = Boots of Speed
      • Set IW_Value = 8
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • -------- #6 ITEM --------
      • Set IW_Item = Ring of the Archmagi
      • Set IW_Value = 2
      • Trigger - Run IW Save <gen> (ignoring conditions)
      • Set IW_ShowImprovement = True
      • -------- END OF CONFIGURABLES --------
      • -------- This will save all current movement speed of unit (not structure - filter) in that map, pre-set units --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Custom script: set udg_IW_Key = GetHandleId(udg_TempUnit)
          • Set IW_CurrentSpeed = (Current movement speed of TempUnit)
          • Hashtable - Save IW_CurrentSpeed as 2 of IW_Key in IW_Hashtable
  • IW Save
    • Events
    • Conditions
    • Actions
      • -------- This is moved here to improve readability of Setup Trigger --------
      • Custom script: set udg_IW_Key = udg_IW_Item
      • Hashtable - Save IW_Value as 0 of IW_Key in IW_Hashtable
      • Hashtable - Save IW_ItemRegister as 1 of IW_Key in IW_Hashtable
  • IW Register
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
    • Actions
      • -------- This trigger will register new unit (not structure - filter) that enters the map, not pre-set units --------
      • -------- You can also filter your dummy units at the Condition --------
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_IW_Key = GetHandleId(udg_TempUnit)
      • Set IW_CurrentSpeed = (Current movement speed of TempUnit)
      • Hashtable - Save IW_CurrentSpeed as 2 of IW_Key in IW_Hashtable
  • IW Clean Data
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • -------- This trigger will clear hashtable data to a unit (Heroes can be revived which is unique, units can't be revived) --------
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_IW_Key = GetHandleId(udg_TempUnit)
      • Hashtable - Clear all child hashtables of child IW_Key in IW_Hashtable
  • IW Acquire
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set TempItemType = (Item-type of (Item being manipulated))
      • Custom script: set udg_IW_Key = udg_TempItemType
      • Set IW_ItemRegister = (Load 1 of IW_Key from IW_Hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IW_ItemRegister Equal to True
        • Then - Actions
          • Set IW_Value = (Load 0 of IW_Key from IW_Hashtable)
          • Custom script: set udg_IW_Key = GetHandleId(udg_TempUnit)
          • Set IW_CurrentSpeed = (Load 2 of IW_Key from IW_Hashtable)
          • Set IW_CurrentSpeed = (IW_CurrentSpeed - (Real(IW_Value)))
          • Unit - Set TempUnit movement speed to IW_CurrentSpeed
          • Hashtable - Save IW_CurrentSpeed as 2 of IW_Key in IW_Hashtable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IW_ShowImprovement Equal to True
            • Then - Actions
              • Floating Text - Create floating text that reads (Your current movement speed is + (|cffffcc00 + ((String((Integer(IW_CurrentSpeed)))) + (|r ( + (|cffffcc00 + ((Name of (Item being manipulated)) + ((|r) + decreases your speed by ) + (|cffffcc00 + ((String(IW_Value)) + |r))))))))) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
            • Else - Actions
        • Else - Actions
  • IW Lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Set TempItemType = (Item-type of (Item being manipulated))
      • Custom script: set udg_IW_Key = udg_TempItemType
      • Set IW_ItemRegister = (Load 1 of IW_Key from IW_Hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IW_ItemRegister Equal to True
        • Then - Actions
          • Set IW_Value = (Load 0 of IW_Key from IW_Hashtable)
          • Custom script: set udg_IW_Key = GetHandleId(udg_TempUnit)
          • Set IW_CurrentSpeed = (Load 2 of IW_Key from IW_Hashtable)
          • Set IW_CurrentSpeed = (IW_CurrentSpeed + (Real(IW_Value)))
          • Unit - Set TempUnit movement speed to IW_CurrentSpeed
          • Hashtable - Save IW_CurrentSpeed as 2 of IW_Key in IW_Hashtable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IW_ShowImprovement Equal to True
            • Then - Actions
              • Floating Text - Create floating text that reads (Your current movement speed is + (|cffffcc00 + ((String((Integer(IW_CurrentSpeed)))) + (|r ( + (|cffffcc00 + ((Name of (Item being manipulated)) + ((|r) + gives back your speed by ) + (|cffffcc00 + ((String(IW_Value)) + |r))))))))) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 2.50 seconds
            • Else - Actions
        • Else - Actions
-


v1.0
- Initial release


Keywords:
simple, item, weight, system, defskull, is, nose, picking, hashtable, rpg, save, load, orpg, slow, item.
Contents

Just another Warcraft III map (Map)

Reviews
11:15, 27th Jul 2012 Magtheridon96: Approved. This could benefit from using a UnitIndexer. Also, it would be nice if you were to cache the floating texts instead of repeating the (Last created floating text) call. Second, the floating texts...

Moderator

M

Moderator

11:15, 27th Jul 2012
Magtheridon96: Approved.

This could benefit from using a UnitIndexer.
Also, it would be nice if you were to cache the floating texts instead of repeating the (Last created floating text) call.

Second, the floating texts should be configurable.
I really like this system though, it's a good idea and could add some realism to a map ;)
 
Okay, my mistake.
Event registry is done /after/ the BJs that create the initial units are executed.

I don't know how I ended up having them run twice in the past ;/
Probably because I manipulated function main or something ;p

Anyway, sorry about the false information.

Still, this would benefit greatly if it used a Unit Indexer for 2 reasons:

1- You need an event that runs for every unit that comes into the map, so if a user adds just one more system that doesn't use a unit indexer, and relies on something like this, it directly becomes a very inefficient method because you're going to have twice the number of trigger evaluations and executions and twice the number of iterations, meaning that a Unit Indexer is already looking way better.
2- You can benefit from a speed gain as you now have the ability to use the unit user data as an index for a movement speed array which you can easily modify
 
Level 1
Joined
Aug 28, 2012
Messages
5
You know, this is so perfect for my map, i am making map for fun dough, but still its perfect, thank you, if i upload it on THW i will definetly mention your name.
 
Top