- Joined
- Dec 14, 2008
- Messages
- 35
Solved
Last edited:
call SetUnitVertexColor(whichUnit, 255, 0, 0, 100)
Thank you for the help +rep to you =)No, the value remains as as percent in JASS.
function BarbarianRage_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local integer count = 20
local unit temp
local group enemies = CreateGroup()
loop
set temp = Group(enemies)
exitwhen count == 0
if IsUnitEnemy(temp, GetOwningPlayer(caster)) then
call SetUnitVertexColor(caster, 255, 0, 0, 100)
set count = count - 1
end if
if count == 0 then
call SetUnitVertexColor(caster, 255, 255, 255, 255)
end if
endloop
// comment: this is just to fix leaks in the spell
call DestroyGroup(enemies, temp)
set caster = null
set enemies = null
set temp = null
set count = null
end function
function InitTrig_BarbarianRage takes nothing returns nothing
set gg_trg_BarbarianRage = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Barbarian_Rage, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Barbarian_Rage, Condition( function Trig_Barbarian_Rage_Conditions ) )
call TriggerAddAction(gg_trigger_BarbarianRage, function BarbarianRage_Actions)
endfunction
call DestroyGroup(enemies, temp)
end function
end if
endfunction
endif
function BarbarianRage_Filter takes nothing returns boolean //boolexpr is faster then if then else in a loop :)
local unit t = GetTriggerUnit()
local unit u = GetFilterUnit()
local boolean ok = GetWidgetLife(u) > .305 and IsUnitEnemy(u,GetOwningPlayer(t))
set t = null
set u = null
return ok
endfunction
function BarbarianRage_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit() //faster too use trigger unit
local integer count = 20
local unit temp
local group enemies = CreateGroup()
call GroupEnumUnitsInRange(enemies,GetUnitX(caster),GetUnitY(caster),"aoe size",Condition(function BarbarianRage_Filter))
//u didnt get units in range replace "aoe size" with how big aoe u wanna pick units in.
loop
set temp = FirstofGroup(enemies)
exitwhen count == 0 or temp == null
call GroupRemoveUnit(enemies,temp)
call SetUnitVertexColor(caster, 255, 0, 0, 100) //**
set count = count - 1
endloop
call SetUnitVertexColor(caster, 255, 255, 255, 255) //**
call DestroyGroup(enemies)
set caster = null
set enemies = null
// set temp = null //no need to null it will be null when u exit then loop
endfunction
function InitTrig_BarbarianRage takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(trig, Condition( function Trig_Barbarian_Rage_Conditions ) )
set trig = null
endfunction
//** = u dont need these the spell gonna be instant so u wont even see it :)
JASS:function BarbarianRage_Filter takes nothing returns boolean //boolexpr is faster then if then else in a loop :) local unit t = GetTriggerUnit() local unit u = GetFilterUnit() local boolean ok = GetWidgetLife(u) > .305 and IsUnitEnemy(u,GetOwningPlayer(t)) set t = null set u = null return ok endfunction function BarbarianRage_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() //faster too use trigger unit local integer count = 20 local unit temp local group enemies = CreateGroup() call GroupEnumUnitsInRange(enemies,GetUnitX(caster),GetUnitY(caster),"aoe size",Condition(function BarbarianRage_Filter)) //u didnt get units in range replace "aoe size" with how big aoe u wanna pick units in. loop set temp = FirstofGroup(enemies) exitwhen count == 0 or temp == null call GroupRemoveUnit(enemies,temp) call SetUnitVertexColor(caster, 255, 0, 0, 100) //** set count = count - 1 endloop call SetUnitVertexColor(caster, 255, 255, 255, 255) //** call DestroyGroup(enemies) set caster = null set enemies = null // set temp = null //no need to null it will be null when u exit then loop endfunction function InitTrig_BarbarianRage takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition(trig, Condition( function Trig_Barbarian_Rage_Conditions ) ) set trig = null endfunction //** = u dont need these the spell gonna be instant so u wont even see it :)