Tinki3
Special Member
- Reaction score
- 418
Nice spellpack
The code could still do with a little spice-up, however.
For example, constant functions should be used in every trigger to make configuration alot easier.
Let's take a look at Energize:
You'll notice that raw values like 'A000' are not present in the code outside of those new constant functions, and instead, have been replaced with the constant function names, with '()' after, to reference each.
That'll make it so much easier for implementers because they don't need to go through the code and change every raw value.
Try and add constant functions to all of your triggers.
The code could still do with a little spice-up, however.
For example, constant functions should be used in every trigger to make configuration alot easier.
Let's take a look at Energize:
JASS:
constant function Energize_Main_Ability_ID takes nothing returns integer
return 039;A003039; //Raw code of the "Energize" ability
endfunction
constant function Energize_Dummy_Unit_ID takes nothing returns integer
return 039;h002039; //Raw code for the dummy unit used
endfunction
constant function Energize_Dummy_Ability_ID takes nothing returns integer
return 039;A000039; //Raw code for the dummy ability used
endfunction
function Trig_Energize_Locals_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(),Energize_Main_Ability_ID) != 0
endfunction
function Trig_Energize_Locals_Actions takes nothing returns nothing
local unit Attacker = GetAttacker()
local real AttackerX = GetUnitX(Attacker)
local real AttackerY = GetUnitY(Attacker)
local unit Dummy
if GetRandomInt(1, 100) <= ( 15 + ( 5 * GetUnitAbilityLevel(GetAttacker(),Energize_Main_Ability_ID) ) ) then
set Dummy = CreateUnit(GetOwningPlayer(Attacker),Energize_Dummy_Unit_ID,AttackerX,AttackerY, 270.)
call UnitApplyTimedLife(Dummy,039;BTLF039;,2.)
call UnitAddAbility(Dummy,Energize_Dummy_Ability_ID)
call SetUnitAbilityLevel(Dummy, Energize_Dummy_Ability_ID,GetUnitAbilityLevel(Attacker,Energize_Main_Ability_ID))
call IssueTargetOrder(Dummy,"bloodlust",Attacker)
endif
set Attacker = null
set Dummy = null
endfunction
//===========================================================================
function InitTrig_Energize_Locals takes nothing returns nothing
set gg_trg_Energize_Locals = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Energize_Locals, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Energize_Locals, Condition( function Trig_Energize_Locals_Conditions ) )
call TriggerAddAction( gg_trg_Energize_Locals, function Trig_Energize_Locals_Actions )
endfunction
You'll notice that raw values like 'A000' are not present in the code outside of those new constant functions, and instead, have been replaced with the constant function names, with '()' after, to reference each.
That'll make it so much easier for implementers because they don't need to go through the code and change every raw value.
Try and add constant functions to all of your triggers.