- Joined
- Jan 1, 2011
- Messages
- 1,528
So I've begun learning jass, and it isn't half bad. I'd like to post my first ever function here to maybe get some tips of how to improve it. So here it is.
JASS:
library SUA
function SUA takes unit u, integer ut returns nothing
local integer i=LoadInteger(udg_Upgrade,ut,0)
local integer ui=GetUnitUserData(u)
local boolean b=LoadBoolean(udg_Lamp,ut,0)
if ut=='h005' then
call UnitAddAbilityBJ('A001',u)
else
if i>=0 then
call GroupAddUnitSimple(u,udg_Transferers)
call EnableTrigger(gg_trg_Transfer_Periodic)
else
set i=LoadInteger(udg_Factory,ut,0)
if i>=0 then
call GroupAddUnitSimple(u,udg_FactoryGroup)
call EnableTrigger(gg_trg_Factories)
else
set i=LoadInteger(udg_Mind,ut,0)
if i>=0 then
call GroupAddUnitSimple(u,udg_MindGroup)
call EnableTrigger(gg_trg_Mind_Control)
else
if b==true then
call GroupAddUnitSimple( udg_Unit1, udg_LampGroup )
call EnableTrigger(gg_trg_Lamps)
set udg_HasSight[ui] = false
call DestroyFogModifier(udg_LampSight[ui])
call RemoveDestructable(udg_LampDestructible[ui])
call TriggerExecute( gg_trg_Lamps )
endif
endif
endif
endif
endif
endfunction
endlibrary