- Joined
- Oct 9, 2015
- Messages
- 721
Hey everyone, it's me (again). I would like to know if there's a way I can obtain the value of a unit's Sight Range? Thanks a lot in advance!
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.
Unit-types are integers in JASS. You can store the unit-type into an integer using Custom script and use that as the parent key for the hashtable.I can handle hashtables but I could't find a way to store data on unit-type
I don't understand, what it does ?You can write sight-range at compile time, and access the same constant in runtime. See Cokemonkey11 / dragons / source / wurst / systems / Units.wurst — Bitbucket
I'm using this after creating the hashtable:Unit-types are integers in JASS. You can store the unit-type into an integer using Custom script and use that as the parent key for the hashtable.
storing values

Events


Map initialization

Conditions

Actions


-------- PEASANT --------


Set UnitType = Peasant


Custom script: set udg_TempInteger = udg_UnitType


Hashtable - Save 800 as 0 of TempInteger in STESYS_Hash


-------- PEASANT --------
Untitled Trigger 001

Events


Unit - A unit Is issued an order targeting a point

Conditions


(Unit-type of (Triggering unit)) Equal to Peasant

Actions


Set STESYS_TempUnit1 = (Triggering unit)


Set UnitType = (Unit-type of STESYS_TempUnit1)


Custom script: set udg_TempInteger = udg_UnitType


Set TempInteger2 = (Load 0 of TempInteger in STESYS_Hash)


Game - Display to Player Group - Player 1 (Red) the text: (String(TempInteger2))
hash

Events


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set STESYS_Hash = (Last created hashtable)
storing values

Events


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set STESYS_Hash = (Last created hashtable)


-------- PEASANT --------


Set UnitType = Peasant


Custom script: set udg_TempInteger = udg_UnitType


Hashtable - Save 800 as 0 of TempInteger in STESYS_Hash


-------- PEASANT --------
actions

Events


Unit - A unit Is issued an order targeting a point

Conditions

Actions


Set STESYS_TempUnit1 = (Triggering unit)


Set UnitType = (Unit-type of STESYS_TempUnit1)


Custom script: set udg_TempInteger = udg_UnitType


Set STSYS_TempInteger = (Load 0 of TempInteger in STESYS_Hash)


Game - Display to Player Group - Player 1 (Red) the text: (String(STESYS_TempInteger))
MapInit

Eventsp


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set Hash = (Last created hashtable)


Set UnitType = Peasant


Custom script: set udg_Integer = udg_UnitType


Hashtable - Save 500 as 0 of Integer in Hash
PointOrder

Events


Unit - A unit Is issued an order targeting a point

Conditions

Actions


Set UnitType = (Unit-type of (Triggering unit))


Custom script: set udg_Integer = udg_UnitType


Game - Display to (All players) the text: (String((Load 0 of Integer from Hash)))
