Spellpack Lightning Blast, Earth Shock, Energize, Enchant Lightning

lh2705

Just another Helper
Reaction score
111
Hello :)
It's been a very long time..

My first spellpack I made with GUI and converted to JASS with locals.
The spells are very simple spells, but they look nice :D

1. Lightning Blast - Fires a bolt of lightning from the sky to every unit in the area. Each bolt bounces as well :D
karn1jp8.jpg

JASS:
constant function Lightning_Blast_Rawcode takes nothing returns integer
    return 'A007'  //Raw code of the "Lightning Blast" ability
endfunction

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

constant function Lightning_Blast_Dummy_Ability_Rawcode takes nothing returns integer
    return 'A005'  //Raw code for the "Dummy Lightning Blast" ability
endfunction

constant function Lightning_Blast_AoE_Base takes nothing returns real
    return 250.00  //Base of the Area of Effect value , This value should be (the level 1 AoE value - the increment AoE)
endfunction    //Example , If Level 1 has a 300 AoE and each level increases the AoE by 50, this value should be 250.

constant function Lightning_Blast_AoE_Increment takes nothing returns real
    return 50.00  //Increment of Area of Effect per level
endfunction

function Trig_Lightning_Blast_Locals_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Lightning_Blast_Rawcode()        
endfunction

function Lightning_Blast_Condition takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) > 0
endfunction

function Trig_Lightning_Blast_Locals_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target
    local real TargetX
    local real TargetY
    local unit Dummy
    local location TargetPoint = GetSpellTargetLoc()
    local group TargetGroup = CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(TargetGroup, TargetPoint, Lightning_Blast_AoE_Base() + ( Lightning_Blast_AoE_Increment() * I2R(GetUnitAbilityLevel(Caster, Lightning_Blast_Rawcode())) ),Condition(function Lightning_Blast_Condition))
    loop
        set Target = FirstOfGroup(TargetGroup)
        call GroupRemoveUnit(TargetGroup,Target)
        exitwhen Target == null
        set TargetX = GetUnitX(Target)
        set TargetY = GetUnitY(Target)
        set Dummy = CreateUnit(GetOwningPlayer(Caster), Lightning_Blast_Dummy_Unit_Rawcode(), TargetX, TargetY, 270.)
        call UnitApplyTimedLife( Dummy, 'BTLF', 3. )
        call UnitAddAbility(Dummy, Lightning_Blast_Dummy_Ability_Rawcode())
        call SetUnitAbilityLevel(Dummy, Lightning_Blast_Dummy_Ability_Rawcode(), GetUnitAbilityLevel(Caster, Lightning_Blast_Rawcode()) )
        call IssueTargetOrder(Dummy, "chainlightning", Target)
    endloop
    call DestroyGroup(TargetGroup)
    call RemoveLocation(TargetPoint)
    set Caster = null
    set Target = null
    set Dummy = null
    set TargetPoint = null
    set TargetGroup = null
        
endfunction

//===========================================================================
function InitTrig_Lightning_Blast_Locals takes nothing returns nothing
    set gg_trg_Lightning_Blast_Locals = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Blast_Locals, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Lightning_Blast_Locals, Condition( function Trig_Lightning_Blast_Locals_Conditions ) )
    call TriggerAddAction( gg_trg_Lightning_Blast_Locals, function Trig_Lightning_Blast_Locals_Actions )
endfunction

2. Earth Shock - No Image... Basic Stun and Silence after that.
JASS:
constant function Earth_Shock_Rawcode takes nothing returns integer
    return 'A004'  //Raw code of the "Earth Shock" ability
endfunction

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

constant function Earth_Shock_Dummy_Ability_Rawcode takes nothing returns integer
    return 'A006'  //Raw code for the "Dummy Earth Shock" ability
endfunction

function Trig_Earth_Shock_Locals_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Earth_Shock_Rawcode()
endfunction

function Trig_Earth_Shock_Locals_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local real CasterX = GetUnitX(Caster)
    local real CasterY = GetUnitY(Caster)
    local unit Dummy
    call PolledWait( ( 1.00 + ( 1.00 * I2R(GetUnitAbilityLevel(Caster,Earth_Shock_Rawcode())) ) ) )
    set Dummy = CreateUnit(GetOwningPlayer(Caster),Earth_Shock_Dummy_Unit_Rawcode(),CasterX,CasterY,270.)
    call UnitApplyTimedLife(Dummy,'BTLF',3.)
    call UnitAddAbility(Dummy,Earth_Shock_Dummy_Ability_Rawcode())
    call SetUnitAbilityLevel(Dummy, Earth_Shock_Dummy_Ability_Rawcode(),GetUnitAbilityLevel(Caster,Earth_Shock_Rawcode()))
    call IssuePointOrder(Dummy,"silence",CasterX,CasterY)
    set Caster = null
    set Dummy = null
endfunction

//===========================================================================
function InitTrig_Earth_Shock_Locals takes nothing returns nothing
    set gg_trg_Earth_Shock_Locals = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Earth_Shock_Locals, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Earth_Shock_Locals, Condition( function Trig_Earth_Shock_Locals_Conditions ) )
    call TriggerAddAction( gg_trg_Earth_Shock_Locals, function Trig_Earth_Shock_Locals_Actions )
endfunction

3. Energize - % Chance on attack to charge the shaman up with electrical energy gaining bonus attack speed and movement speed.
karn2gn2.jpg

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 Energize" ability
endfunction

constant function Energize_Triggering_Chance_Base takes nothing returns integer
    return 15  //Base of the chance to trigger value , This value should be (the level 1 % chance to trigger - the increment chance)
endfunction    //Example , If Level 1 has a 20% chance to trigger and each level increases the chance by 5%, this value should be 15.

constant function Energize_Triggering_Chance_Increment takes nothing returns integer
    return 5  //Increment of chance to trigger per level
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) <= ( Energize_Triggering_Chance_Base() + ( Energize_Triggering_Chance_Increment() * 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

JASS:
constant function Energize_Buff_Rawcode takes nothing returns integer
    return 'B000'  //Buff Rawcode of Energize Ability
endfunction

constant function Effect_Model takes nothing returns string
    return "Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl"  //Model path of effect attached
endfunction

constant function Effect_Attachment_Point takes nothing returns string
    return "hand,right"  //Effect attachment point
endfunction

function AbilityCheck takes nothing returns boolean
    return GetUnitAbilityLevel(GetFilterUnit(),Energize_Buff_Rawcode())>0
endfunction

function Trig_EnergizeEfx_Locals_Actions takes nothing returns nothing
    local unit Unit
    local group UnitGroup = CreateGroup()
    call GroupEnumUnitsInRect(UnitGroup,GetWorldBounds(),Condition(function AbilityCheck))
    loop
         set Unit = FirstOfGroup(UnitGroup)
         exitwhen Unit == null
         call DestroyEffect(AddSpecialEffectTarget(Effect_Model(),Unit,Effect_Attachment_Point()))
        call GroupRemoveUnit(UnitGroup, Unit)
    endloop
    call DestroyGroup(UnitGroup)
    set UnitGroup = null
    set Unit = null
endfunction

//===========================================================================
function InitTrig_EnergizeEfx_Locals takes nothing returns nothing
    set gg_trg_EnergizeEfx_Locals = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_EnergizeEfx_Locals, 0.20 )
    call TriggerAddAction( gg_trg_EnergizeEfx_Locals, function Trig_EnergizeEfx_Locals_Actions )
endfunction

4. Enchant Lightning - Have to be honest, not what I had in mind for an Ultimate..Seems too simple..But oh well..Ran out of ideas anyways.. :D
karn3lg5.jpg

JASS:
constant function Enchant_Lightning_Buff_Rawcode takes nothing returns integer
    return 'B001'  //Raw code of the "Enchant Lightning" buff
endfunction

constant function Enchant_Lightning_Dummy_Unit_Rawcode takes nothing returns integer
    return 'h001'  //Raw code of the dummy used
endfunction

constant function Enchant_Lightning_Dummy_Purge_Rawcode takes nothing returns integer
    return 'A009'  //Raw code of the "Dummy Purge" ability
endfunction

constant function Enchant_Lightning_Dummy_Lightning_Rawcode takes nothing returns integer
    return 'A00A'  //Raw code of the "Dummy Purge" ability
endfunction

constant function Enchant_Lightning_Triggering_Chance takes nothing returns integer
    return 50  //% Chance to Trigger Lightning
endfunction

function Trig_Enchant_Lightning_Locals_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(),Enchant_Lightning_Buff_Rawcode())>0
endfunction

function Trig_Enchant_Lightning_Locals_Actions takes nothing returns nothing
    local unit Caster = GetAttacker()
    local real CasterX = GetUnitX(Caster)
    local real CasterY = GetUnitY(Caster)
    local real Angle = GetUnitFacing(Caster)
    local unit Target = GetTriggerUnit()
    local unit Dummy
    local unit Dummy2
    set Dummy = CreateUnit( GetOwningPlayer(Caster),Enchant_Lightning_Dummy_Unit_Rawcode(),CasterX,CasterY,Angle )
    call UnitApplyTimedLife( Dummy, 'BTLF', 2. )
    call UnitAddAbility( Dummy, Enchant_Lightning_Dummy_Purge_Rawcode() )
    call IssueTargetOrder( Dummy,"purge",Target )
    if GetRandomInt(1, 100) <= Enchant_Lightning_Triggering_Chance() then
        set Dummy2 = CreateUnit( GetOwningPlayer(Caster),Enchant_Lightning_Dummy_Unit_Rawcode(),CasterX,CasterY,Angle )
        call UnitApplyTimedLife( Dummy2, 'BTLF', 2. )
        call UnitAddAbility( Dummy2,Enchant_Lightning_Dummy_Lightning_Rawcode() )
        call IssueTargetOrder( Dummy2,"chainlightning",Target )
    endif
    set Caster = null
    set Target = null
    set Dummy = null
    set Dummy2 = null
endfunction

//===========================================================================
function InitTrig_Enchant_Lightning_Locals takes nothing returns nothing
    set gg_trg_Enchant_Lightning_Locals = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Enchant_Lightning_Locals, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Enchant_Lightning_Locals, Condition( function Trig_Enchant_Lightning_Locals_Conditions ) )
    call TriggerAddAction( gg_trg_Enchant_Lightning_Locals, function Trig_Enchant_Lightning_Locals_Actions )
endfunction

Comments are welcome :D

Edit2, Pictures now in spoilers as Flare suggested.
Edit3, All spells done with converted to proper JASS
Edit4, Post updated with codes
Edit5, Forgot to take away the BJs in Enchant Lightning, Constant Functions added into all spells
 

Attachments

  • TheHelperSpellsSubmission-Karn-lh2705.w3x
    48.8 KB · Views: 278

Daskunk

SC2 Forum MVP - TheSkunk #386
Reaction score
186
I think this model:
models_5027_screenshot.jpg

Would go good with it, because of the lightning on this totem poles and axe. ^^ (DL here.)

Looks like a good spellpack, but whats the last one do?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Awesome spells. :D

Fun to play with. But here is the coding fixes:

=========================

Energize:
JASS:
function Trig_Energize_Locals_Conditions takes nothing returns boolean
    return GetUnitAbilityLevelSwapped('A003', GetAttacker()) != 0        
endfunction


GetUnitAbilitlyLevelSwapped is a nonsense function. A fluff function. It is actually a BJ, so you can replace it with this:
JASS:
return GetUnitAbilityLevel(GetAttacker(),'A003') != 0


For this portion, it is the same:
JASS:
function Trig_Energize_Locals_Func003C takes nothing returns boolean
    return GetRandomInt(1, 100) <= ( 15 + ( 5 * GetUnitAbilityLevelSwapped('A003', GetAttacker()) ) )
endfunction


So, you can replace it and it will become:
JASS:
function Trig_Energize_Locals_Func003C takes nothing returns boolean
    return GetRandomInt(1,100) <= (15 + (5 * GetUnitAbilityLevel(GetAttacker(),'A003')))
endfunction


Now, the actions function.
JASS:
function Trig_Energize_Locals_Actions takes nothing returns nothing
    local unit Attacker = GetAttacker()
    local location AttackerLoc = GetUnitLoc(Attacker)
    if ( Trig_Energize_Locals_Func003C() ) then
        call CreateNUnitsAtLoc( 1, 'h002', GetOwningPlayer(GetAttacker()), AttackerLoc, bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
        call UnitAddAbilityBJ( 'A000', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A000', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A003', Attacker) )
        call IssueTargetOrderBJ( GetLastCreatedUnit(), "bloodlust", Attacker )
    else
    endif
    call RemoveLocation (AttackerLoc)
    set Attacker = null
    set AttackerLoc = null
endfunction


Instead of locations, you should use reals, x and y because they are faster and you don't have to remove them or null them.
JASS:
    local real AttackerX = GetUnitX(Attacker)
    local real AttackerY = GetUnitY(Attacker)


This part is also a sign of GUI converted JASS. You can simply inline it:
JASS:
if ( Trig_Energize_Locals_Func003C() ) then

//.... Becomes ....

if GetRandomInt(1,100) <= (15 + (5 * GetUnitAbilityLevel(GetAttacker(),'A003'))) then

//.... Then you can remove the whole Func003C()


Now, you can use "CreateUnit", which is a native:
JASS:
call CreateUnit(GetOwningPlayer(Attacker),'h002',AttackerX,AttackerY,270.)


As you can see below, CreateNUnitsAtLoc is a BJ, and this above function is faster.
JASS:
function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)
    loop
        set count = count - 1
        exitwhen count < 0
        call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction


Now you apply the time life. That BJ is another fluff, but since CreateUnit() doesn't return a bj_lastCreatedUnit(), you must use this:
JASS:
    local unit u
//..... 

       set u = CreateUnit(GetOwningPlayer(Attacker),'h002',AttackerX,AttackerY,270.)
        call UnitApplyTimedLife(u,'BTLF',2.)


Now we'll fix these three BJs:
JASS:
        call UnitAddAbilityBJ( 'A000', GetLastCreatedUnit() )
        call SetUnitAbilityLevelSwapped( 'A000', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A003', Attacker) )
        call IssueTargetOrderBJ( GetLastCreatedUnit(), "bloodlust", Attacker )


We'll remove the BJ and rearrange the arguments in correspondence to the parameter order of the native... And:
JASS:
        call UnitAddAbility(u,'A000')
        call SetUnitAbilityLevel(u, 'A000',GetUnitAbilityLevel(Attacker,'A003'))
        call IssueTargetOrder(u,"bloodlust",Attacker)


Presto. Finally, the leak fixing:
JASS:
set u = null
    set Attacker = null


So, here is the final trigger:
JASS:
function Trig_Energize_Locals_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(),'A003') != 0       
endfunction

function Trig_Energize_Locals_Actions takes nothing returns nothing
    local unit Attacker = GetAttacker()
    local unit u
    local real AttackerX = GetUnitX(Attacker)
    local real AttackerY = GetUnitY(Attacker)
    if GetRandomInt(1,100) <= (15 + (5 * GetUnitAbilityLevel(GetAttacker(),'A003'))) then
        set u = CreateUnit(GetOwningPlayer(Attacker),'h002',AttackerX,AttackerY,270.)
        call UnitApplyTimedLife(u,'BTLF',2.)
        call UnitAddAbility(u,'A000')
        call SetUnitAbilityLevel(u, 'A000',GetUnitAbilityLevel(Attacker,'A003'))
        call IssueTargetOrder(u,"bloodlust",Attacker)
    endif
    set u = null
    set Attacker = 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


I'll update with more later. I have to start my homework. Good luck. :thup:

EDIT: You get the idea... :p
JASS:
function Bool takes nothing returns boolean
    return GetUnitAbilityLevel(GetFilterUnit(),'B000')>0
endfunction

function Trig_EnergizeEfx_Locals_Actions takes nothing returns nothing
    local unit d
    local group Units = CreateGroup()
    call GroupEnumUnitsInRect(Units,GetWorldBounds(),Condition(function Bool))
    loop
         set d = FirstOfGroup(Units)
         exitwhen d == null
         call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",GetEnumUnit(),"hand,right"))
    endloop
    call DestroyGroup(Units)
    set Units = null
    set d = null
endfunction

//===========================================================================
function InitTrig_EnergizeEfx_Locals takes nothing returns nothing
    set gg_trg_EnergizeEfx_Locals = CreateTrigger()
    call TriggerRegisterTimerEventPeriodic( gg_trg_EnergizeEfx_Locals, 0.20 )
    call TriggerAddAction( gg_trg_EnergizeEfx_Locals, function Trig_EnergizeEfx_Locals_Actions )
endfunction


EDIT2: Yeah, I think you get the picture:
JASS:
function Trig_Earth_Shock_Locals_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A004'
endfunction

function Trig_Earth_Shock_Locals_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local real CasterX = GetUnitX(Caster)
    local real CasterY = GetUnitY(Caster)
    local unit u
    call PolledWait(1+(1*I2R(GetUnitAbilityLevel(Caster,'A004'))))
    set u = CreateUnit(GetOwningPlayer(Caster),'h002',CasterX,CasterY,270.)
    call UnitApplyTimedLife(u,'BTLF',3)
    call UnitAddAbility(u,'A006')
    call SetUnitAbilityLevel(u,'A006',GetUnitAbilityLevel(Caster,'A004'))
    call IssuePointOrder(u,"silence",CasterX,CasterY)
    set Caster = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Earth_Shock_Locals takes nothing returns nothing
    set gg_trg_Earth_Shock_Locals = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Earth_Shock_Locals, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Earth_Shock_Locals, Condition( function Trig_Earth_Shock_Locals_Conditions ) )
    call TriggerAddAction( gg_trg_Earth_Shock_Locals, function Trig_Earth_Shock_Locals_Actions )
endfunction


EDIT3: And last but not least:
JASS:
function Trig_Enchant_Lightning_Locals_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(),'B001')>0
endfunction

function Trig_Enchant_Lightning_Locals_Actions takes nothing returns nothing
    local unit Caster = GetAttacker()
    local real x = GetUnitX(Caster)
    local real y = GetUnitY(Caster)
    local unit TargetUnit = GetTriggerUnit()
    local real tx = GetUnitX(TargetUnit)
    local real ty = GetUnitY(TargetUnit)
    local real ang = bj_RADTODEG*Atan2(ty-y,tx-x)
    local unit u = CreateUnit(GetOwningPlayer(Caster),'h002',x,y,ang)
    
    call UnitApplyTimedLife(u,'BTLF',3)
    call UnitAddAbility(u,'A009')
    call IssueTargetOrder(u,"purge",TargetUnit)
    set u = null
    if GetRandomInt(1,100)<=50 then
        set u = CreateUnit(GetOwningPlayer(Caster),'h001',x,y,ang)
        call UnitApplyTimedLife(u,'BTLF',3)
        call UnitAddAbility(u,'A005')
        call SetUnitAbilityLevel(u,'A005',3)
        call IssueTargetOrder(u,"chainlightning",TargetUnit)
    endif
    set Caster = null
    set TargetUnit = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Enchant_Lightning_Locals takes nothing returns nothing
    set gg_trg_Enchant_Lightning_Locals = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Enchant_Lightning_Locals, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Enchant_Lightning_Locals, Condition( function Trig_Enchant_Lightning_Locals_Conditions ) )
    call TriggerAddAction( gg_trg_Enchant_Lightning_Locals, function Trig_Enchant_Lightning_Locals_Actions )
endfunction


!! WARNING !! Keep backups of the triggers because these are not tested !!

EDIT4: Crap... I forgot one.
 

lh2705

Just another Helper
Reaction score
111
Hey PurgeAndFire,

Thanks for all the pointers and the help..
I really appreciate it.

But there is 2 things I don't understand.
For the Energize Effects Trigger,
I don't really understand the calls for the Unit Group part and also the loop. A little confused...

Also, for the Enchant Lightning Trigger,
Wouldn't the first function make the skill become a passive skill?
Because there is no buff needed, cause there is nothing about buffs there..
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
JASS:
    loop
         set d = FirstOfGroup(Units)
         exitwhen d == null
         call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",GetEnumUnit(),"hand,right"))
    endloop


Well, ForGroup() will start it on a new function. Since there isn't really too much content, I think it is easier to just loop through the units.

After grouping the units in the group, "FirstOfGroup()" will find a unit in that group. Then, you add the effect and destroy it to save a line since it is supposed to be in an instance.

d will == null when there are no more units left in the group.

=========================

Because there is no buff needed, cause there is nothing about buffs there..

UnitHasBuffBJ actually isn't a native so it doesn't really retrieve it. My thought is that the units have some sort of dummy ability added to them when they receive a buff. One so that you can register that a buff is on the unit.

Anywho:
JASS:
function UnitHasBuffBJ takes unit whichUnit, integer buffcode returns boolean
    return (GetUnitAbilityLevel(whichUnit, buffcode) > 0)
endfunction


So, I simply inlined the code by doing:
JASS:
function Trig_Enchant_Lightning_Locals_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetAttacker(),'B001')>0
endfunction


I tested the abilities with the new codes a while ago and they seemed to work.

I just didn't do anything to the big lightning trigger because I forgot it. :p
 

lh2705

Just another Helper
Reaction score
111
Ok, I've done the Lightning Blast one myself but there is a problem with 1 line...
ZZZZ..everything I do seems to still cause this syntax error, it doesnt make a difference

Here is the Code Line
JASS:
    call GroupEnumUnitsInRangeOfLoc(TargetGroup, TargetPoint, 250.00 + ( 50.00 * I2R(GetUnitAbilityLevel(Caster, 'A007')) ) ), Condition(function Lightning_Blast_Condition)


I have a feeling its the last part of the condition.
But I don't know how to fix it.
 

lh2705

Just another Helper
Reaction score
111
Hey Uberplayer, I got a question.
What do I do if I want to have 2 conditions needed?
What code do I use?

I noticed the code GetBooleanAnd or something like that was a BJ..
So what do I use?
 

lh2705

Just another Helper
Reaction score
111
Awesome, now my lightning blast works as wanted.

But now, there is a new problem.
It seems whenever energize comes out...There seems to be a message when energize triggers.

Hit Opt Limit for Energize_Efx_Trigger

Something like that.

Something wrong with the efx trigger?
 

Knight7770

Hippopotomonstrosesquiped aliophobia
Reaction score
187
Nice spells :thup: My hero contest is almost over, and I need to get into the habit of judging these things. Here we go...

Joking :D I'm not interested in judging your spells :p

How did you make that lightning effect come from above?
 

lh2705

Just another Helper
Reaction score
111
Whoops! :p
JASS:
    loop
         set d = FirstOfGroup(Units)
         exitwhen d == null
         call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl",GetEnumUnit(),"hand,right"))
        call GroupRemoveUnit(d)
    endloop


Try that... The loop caused the spell to hit the oplimit. ;) The group just kept growing and growing.

Ah thanks for the fix..
But.. again.. there is a new problem..The effect doesn't come out.. :confused:


@Knight
Flying Dummy Casters :D
 

Sim

Forum Administrator
Staff member
Reaction score
534
Post the code in your main post, please. :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