- Joined
- Oct 24, 2012
- Messages
- 6,545
hello i was just wondering if this is efficient as can be or if theres something i can change to make it better basically its a unit group tht calls all units and changes there custom value to 2001, 2002, or 2003 with tht it adds or removes it or does nothing its for a minigame ik it works good the way it is now just wanted to know if there is something better and thx to all tht help
JASS:
function GroupCounter_Life_or_Death_Random takes nothing returns nothing
local unit u = GetEnumUnit()
local integer i = GetRandomInt(1, 3)
if ( i == 1) then
call SetUnitColor( u, PLAYER_COLOR_RED)
call UnitRemoveType(u, UNIT_TYPE_UNDEAD)
call UnitAddType(u, UNIT_TYPE_MECHANICAL)
call PauseUnit(u, true)
elseif ( i == 2) then
call SetUnitColor( u, ConvertPlayerColor(12))
call PauseUnit(u, false)
call UnitAddType(u, UNIT_TYPE_UNDEAD)
call UnitRemoveType(u, UNIT_TYPE_MECHANICAL)
elseif ( i == 3) then
call SetUnitColor( u, PLAYER_COLOR_GREEN)
call UnitAddType(u, UNIT_TYPE_UNDEAD)
call UnitRemoveType(u, UNIT_TYPE_MECHANICAL)
call PauseUnit(u, true)
endif
set u = null
endfunction // changing the random units to kill heal or do nothing
function Trig_Life_or_Death_Changing_Actions takes nothing returns nothing
call ForGroup(Life_or_Death_Random_Group, function GroupCounter_Life_or_Death_Random)
endfunction
//===========================================================================
function InitTrig_Life_or_Death_Changing takes nothing returns nothing
set gg_trg_Life_or_Death_Changing = CreateTrigger( )
call DisableTrigger( gg_trg_Life_or_Death_Changing )
call TriggerRegisterTimerEvent( gg_trg_Life_or_Death_Changing, 2.00, true )
call TriggerAddAction( gg_trg_Life_or_Death_Changing, function Trig_Life_or_Death_Changing_Actions )
endfunction
Last edited: