• 🏆 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!

On increase movement height

Status
Not open for further replies.
Sadly, there isn't a way to retrieve a unit's scale (no such native exists).

However, you should be able to store them in a database structure, saving each unit-type's default scaling value:
  • Scale Database
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ScaleData = Create a hashtable
      • Hashtable - Save 1.5 as (Unit-type of <Footman>) of 0 in ScaleData
      • Hashtable - Save 1 as (Unit-type of <Paladin>) of 0 in ScaleData
      • Hashtable - Save 1.25 as (Unit-type of <Sorceress>) of 0 in ScaleData
Note that this only saves default scales. If you want to save a particular unit's actual scale, you may want to save it based on each unit instead of unit-types. This is important if you have any triggers that adjust scaling, or an ability like bloodlust that affects a unit's scale.

Anyway, you would make the above hashtable only for unit-types that you would actually use for the spell:
the Casting unit would increase its movement height to (scaling value X 15) so the casting unit would have a height of 225 but only in 3 seconds.

If the unit doesn't have the spell, then you don't need to save his default scale since you won't need to ever retrieve it anyway. That way, when you cast the spell, you can simply load what the unit's scale is:
  • Spell
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Your Ability>
    • Actions
      • Set TempScale = Load (Unit-type of (Triggering Unit)) of 0 in ScaleData
Then you would apply the effects using "TempScale" as the scale value.

P.S. These triggers are freehand so sorry if there are mistakes. I am not sure whether the hashtable functions allow you to plug-in "Unit-type of (Triggering Unit)" as a key. If not, then you may need to resort to an odd JASS workaround:
  • Custom script: set udg_TempInt = 'h000'
^That would save the rawcode value under an integer variable "TempInt". Then you can use that as a key. Just replace 'h000' with whatever rawcode your saving into. For example, if you are saving a footman, it would be:
  • Custom script: set udg_TempInt = 'hfoo'
To view the rawcodes of a unit-type, open the object editor and press CTRL+D. The rawcode of a unit should appear in place of their name (or next to their name).
 
Status
Not open for further replies.
Top