Spellpack Lightning Blast, Earth Shock, Energize, Enchant Lightning

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:
JASS:
constant function Energize_Main_Ability_ID takes nothing returns integer
    return 'A003'  //Raw code of the "Energize" ability
endfunction

constant function Energize_Dummy_Unit_ID takes nothing returns integer
    return 'h002'  //Raw code for the dummy unit used
endfunction

constant function Energize_Dummy_Ability_ID takes nothing returns integer
    return 'A000'  //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,'BTLF',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.
 

lh2705

Just another Helper
Reaction score
111
Okay..
I've added constant functions to all the triggers and I removed the BJs in the Enchant Lightning trigger(forgot to do it).. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top