🏆 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!
struct s_unit
unit subject = null
integer data1
integer data2
integer data3
static method create takes unit u returns s_unit
local s_unit su = s_unit.allocate()
set su.subject = u
call SetUnitUserData(u, su)
return su
endmethod
endstruct
Now, whenever you have the value of "s_unit" you can access the unit by substituting "sUnitVar.subject". If you have the value of the unit you can access the struct (and thus the other data values) by using "GetUnitUserData".
To access the other integers within the structure, you'd use: call s_unit( GetUnitUserData( someUnit ) ).data1. You can replace "data1" with "data2" or any other values that are defined within the s_unit struct.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.