- Joined
- May 11, 2008
- Messages
- 1,198
Notice: This post contains an old script. skip to the third post to see the current script by myself.
so it's a channeling spell...so i made a trigger for when the channeling starts and a trigger for when it ends.
i also register a specific "main unit" for each player and am using that for a group. what do you think? is this a good setup?
the event registration will happen somewhere else, that's not a problem.
i am not entirely sure about unit groups in general...so mostly i'm wondering if i'm handling the unit group properly...i think it is probably right.
i had another setup before this one which was mostly gui but i think maybe it leaked...it is of course an ultimate ability for only one hero so if it did leak it wouldn't be noticeable...but i wanted to go ahead and fix it anyway.
so how do you think i did? i was doing something like pick all the units in map matching unit is a sapper or something like that. now i'm just adding specific units from variable array to the unitgroup and i'm removing them from the unitgroup when the spell stops channeling.
so it's a channeling spell...so i made a trigger for when the channeling starts and a trigger for when it ends.
i also register a specific "main unit" for each player and am using that for a group. what do you think? is this a good setup?
the event registration will happen somewhere else, that's not a problem.
i am not entirely sure about unit groups in general...so mostly i'm wondering if i'm handling the unit group properly...i think it is probably right.
i had another setup before this one which was mostly gui but i think maybe it leaked...it is of course an ultimate ability for only one hero so if it did leak it wouldn't be noticeable...but i wanted to go ahead and fix it anyway.
so how do you think i did? i was doing something like pick all the units in map matching unit is a sapper or something like that. now i'm just adding specific units from variable array to the unitgroup and i'm removing them from the unitgroup when the spell stops channeling.
JASS:
function Trig_starfall_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00G'
endfunction
function Trig_starfall_slowsapper takes nothing returns nothing
call SetUnitMoveSpeed( GetEnumUnit(), ( GetUnitDefaultMoveSpeed(GetEnumUnit()) - GetRandomReal(50.00, 150.00) ) )
endfunction
function Trig_starfall_Actions takes nothing returns nothing
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[3])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[4])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[5])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[6])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[7])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[8])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[9])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[10])
call GroupAddUnit(udg_starfallgroup, udg_pickedunit[12])
call ForGroup(udg_starfallgroup, function Trig_starfall_slowsapper)
endfunction
//===========================================================================
function InitTrig_starfall takes nothing returns nothing
set gg_trg_starfall = CreateTrigger( )
call TriggerAddCondition( gg_trg_starfall, Condition( function Trig_starfall_Conditions ) )
call TriggerAddAction( gg_trg_starfall, function Trig_starfall_Actions )
endfunction
function Trig_starfall_off_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00G'
endfunction
function Trig_starfall_off_sappernormalspeed takes nothing returns nothing
call SetUnitMoveSpeed( GetEnumUnit(), GetUnitDefaultMoveSpeed(GetEnumUnit()) )
endfunction
function Trig_starfall_off_Actions takes nothing returns nothing
call ForGroup(udg_starfallgroup, function Trig_starfall_off_sappernormalspeed)
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[3])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[4])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[5])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[6])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[7])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[8])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[9])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[10])
call GroupRemoveUnit(udg_starfallgroup, udg_pickedunit[12])
endfunction
//===========================================================================
function InitTrig_starfall_off takes nothing returns nothing
set gg_trg_starfall_off = CreateTrigger( )
call TriggerAddCondition( gg_trg_starfall_off, Condition( function Trig_starfall_off_Conditions ) )
call TriggerAddAction( gg_trg_starfall_off, function Trig_starfall_off_Actions )
endfunction
Last edited: