TriggerHappy
...
- Reaction score
- 341
Am i understanding structs wrong or something , arent they just like globals? except you have to create them every new function?
i made a simple trigger using structs.
What else are structs supposed to do?
i made a simple trigger using structs.
JASS:
globals
unit array hero[12]
endglobals
struct test
integer str
integer agi
integer int
string name
endstruct
function herostats takes unit whichUnit returns nothing
local test data = test.create()
local force p = GetForceOfPlayer(GetTriggerPlayer())
set data.str = GetHeroStr(whichUnit, false)
set data.int = GetHeroInt(whichUnit, false)
set data.agi = GetHeroAgi(whichUnit, false)
set data.name = GetUnitName(whichUnit)
call ClearTextMessagesBJ( p )
call DisplayTimedTextToForce( p, 160.00, data.name )
call DisplayTimedTextToForce( p, 160.00, " ")
call DisplayTimedTextToForce( p, 160.00, "|c00FF0000Strength : |r" + I2S(data.str) )
call DisplayTimedTextToForce( p, 160.00, "|c0000E100Agility : |r" + I2S(data.agi) )
call DisplayTimedTextToForce( p, 160.00, "|c000000FFIntellegence : |r" + I2S(data.int) )
endfunction
What else are structs supposed to do?