Spell Air Strike

Exide

I am amazingly focused right now!
Reaction score
448
I decided to make a little spell, called Air Strike.
I haven't seen anyone like this before, and I hope there are none (there probably are, though..)

Anyways.. It's a tiny spell which calls for an air strike.

GUI - Yes.
MUI - Maybe. :p
Leakless - Sort of.
Fun - Yup! :thup:
Overkill - Hell yes.

First of all the important stuff, namely screenshots!

ASScreen1.jpg


ASScreen2.jpg


ASScreen3.jpg

Secondly, the -not so important- stuff, namely the faulty triggers:

Code:
Call Air Strike
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to Air Strike 
    Actions
        If ((Level of Air Strike  for Hero) Equal to 1) then do (Set NumberOfStrikes = 4) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 2) then do (Set NumberOfStrikes = 6) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 3) then do (Set NumberOfStrikes = 8) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 1) then do (Set StrikeDamage = 100.00) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 2) then do (Set StrikeDamage = 125.00) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 3) then do (Set StrikeDamage = 150.00) else do (Do nothing)
        Set AirStrikeLoc = (Target point of ability being cast)
        Set JetFighterSpawn = (AirStrikeLoc offset by 2500.00 towards (Random angle) degrees)
        Set JFLeaveLoc = (AirStrikeLoc offset by 2500.00 towards (Angle from JetFighterSpawn to AirStrikeLoc) degrees)
        Unit - Create 1 Jet Fighter for (Owner of (Triggering unit)) at JetFighterSpawn facing 270.00 degrees
        Set JetFighter = (Last created unit)
        Unit - Add a 10.00 second Generic expiration timer to JetFighter
        Unit - Order JetFighter to Move To AirStrikeLoc
        Trigger - Turn on AS Check Distance <gen>

Code:
AS Check Distance
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Set JetFighterLoc = (Position of JetFighter)
        Wait until ((Distance between AirStrikeLoc and JetFighterLoc) Less than or equal to 420.00), checking every 0.10 seconds
        Unit - Order JetFighter to Move To JFLeaveLoc
        Custom script:   call RemoveLocation(udg_JetFighterSpawn)
        Custom script:   call RemoveLocation(udg_JetFighterLoc)
        Wait 0.25 game-time seconds
        For each (Integer A) from 1 to NumberOfStrikes, do (Actions)
            Loop - Actions
                Set specloc = (AirStrikeLoc offset by (Random real number between 1.00 and 350.00) towards (Random angle) degrees)
                Special Effect - Create a special effect at specloc using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
                Set SpecialFX = (Last created special effect)
                Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
                Unit - Cause JetFighter to damage circular area after 0.00 seconds of radius 125.00 at specloc, dealing StrikeDamage damage of attack type Chaos and damage type Fire
                Custom script:   call RemoveLocation(udg_specloc)
                Wait 0.20 game-time seconds
        Trigger - Turn off (This trigger)
        Custom script:   call RemoveLocation(udg_AirStrikeLoc)

Code:
Call Air Strike MUI
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to Air Strike 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Counter Less than or equal to 99
            Then - Actions
                Set Counter = (Counter + 1)
            Else - Actions
                Set Counter = 1
        If ((Level of Air Strike  for (Triggering unit)) Equal to 1) then do (Set NOS[Counter] = 4) else do (Do nothing)
        If ((Level of Air Strike  for (Triggering unit)) Equal to 2) then do (Set NOS[Counter] = 6) else do (Do nothing)
        If ((Level of Air Strike  for (Triggering unit)) Equal to 3) then do (Set NOS[Counter] = 8) else do (Do nothing)
        If ((Level of Air Strike  for (Triggering unit)) Equal to 1) then do (Set SD[Counter] = 100.00) else do (Do nothing)
        If ((Level of Air Strike  for (Triggering unit)) Equal to 2) then do (Set SD[Counter] = 125.00) else do (Do nothing)
        If ((Level of Air Strike  for (Triggering unit)) Equal to 3) then do (Set SD[Counter] = 150.00) else do (Do nothing)
        Set ASL[Counter] = (Target point of ability being cast)
        Set JFS[Counter] = (ASL[Counter] offset by 2500.00 towards (Random angle) degrees)
        Set JFLL[Counter] = (ASL[Counter] offset by 2500.00 towards (Angle from JFS[Counter] to ASL[Counter]) degrees)
        Unit - Create 1 Jet Fighter for (Owner of (Triggering unit)) at JFS[Counter] facing 270.00 degrees
        Set JF[Counter] = (Last created unit)
        Unit - Change color of JF[Counter] to (Color of Neutral Hostile)
        Unit - Add a 10.00 second Generic expiration timer to JF[Counter]
        Unit - Order JF[Counter] to Move To ASL[Counter]
        Unit - Set the custom value of JF[Counter] to Counter
        Unit Group - Add JF[Counter] to TempGroup

Code:
AS Check Distance MUI
    Events
        Time - Every 0.50 seconds of game time
    Conditions
        (Number of units in TempGroup) Greater than 0
    Actions
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Set TempInt = (Custom value of (Picked unit))
                Set JFL[TempInt] = (Position of JF[TempInt])
                Wait until ((Distance between ASL[TempInt] and JFL[TempInt]) Less than or equal to 420.00), checking every 0.10 seconds
                Unit - Order JF[TempInt] to Move To JFLL[TempInt]
                Custom script:   call RemoveLocation(udg_JFS[udg_TempInt])
                Custom script:   call RemoveLocation(udg_JFL[udg_TempInt])
                Custom script:   call RemoveLocation(udg_JFLL[udg_TempInt])
                For each (Integer A) from 1 to NOS[TempInt], do (Actions)
                    Loop - Actions
                        Set sl[TempInt] = (ASL[TempInt] offset by (Random real number between 1.00 and 350.00) towards (Random angle) degrees)
                        Special Effect - Create a special effect at sl[TempInt] using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
                        Set SpecialFX = (Last created special effect)
                        Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
                        Unit - Cause JF[TempInt] to damage circular area after 0.00 seconds of radius 125.00 at sl[TempInt], dealing SD[TempInt] damage of attack type Chaos and damage type Fire
                        Custom script:   call RemoveLocation(udg_sl[udg_TempInt])
                Custom script:   call RemoveLocation(udg_ASL[udg_TempInt])

JASS:

function Trig_Call_Air_Strike_MUI_JASS_Conditions takes nothing returns boolean
    return ( ( GetSpellAbilityId() == &#039;A000&#039; ) )
endfunction

function Trig_Call_Air_Strike_MUI_JASS_Actions takes nothing returns nothing

    if ( udg_Counter &lt;= 99 ) then
        set udg_Counter = ( udg_Counter + 1 )
    else
        set udg_Counter = 1
    endif

    set udg_NOS[udg_Counter] = ( 2 + GetUnitAbilityLevelSwapped(&#039;A000&#039;, GetTriggerUnit()) )
    set udg_SD[udg_Counter] = ( 75.00 + ( 25.00 * I2R(GetUnitAbilityLevelSwapped(&#039;A000&#039;, GetTriggerUnit())) ) )
        
    set udg_ASL[udg_Counter] = GetSpellTargetLoc()
    set udg_JFS[udg_Counter] = PolarProjectionBJ(udg_ASL[udg_Counter], 2500.00, GetRandomDirectionDeg())
    set udg_JFLL[udg_Counter] = PolarProjectionBJ(udg_ASL[udg_Counter], 2500.00, AngleBetweenPoints(udg_JFS[udg_Counter], udg_ASL[udg_Counter]))
    
    call CreateNUnitsAtLoc( 1, &#039;h001&#039;, GetOwningPlayer(GetTriggerUnit()), udg_JFS[udg_Counter], 270.00 )
    set udg_JetFighter = GetLastCreatedUnit()
    call SetUnitColor( udg_JetFighter, GetPlayerColor(Player(PLAYER_NEUTRAL_AGGRESSIVE)) )
    call UnitApplyTimedLife( udg_JetFighter, &#039;BTLF&#039;, 10.00  )
    call IssuePointOrderLoc( udg_JetFighter, &quot;move&quot;, udg_ASL[udg_Counter] )
    call SetUnitUserData( udg_JetFighter, udg_Counter )
    call GroupAddUnitSimple( udg_JetFighter, udg_TempGroup )
endfunction

//===========================================================================
function InitTrig_Call_Air_Strike_MUI_JASS takes nothing returns nothing
    local trigger gg_trg_Call_Air_Strike_MUI_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Call_Air_Strike_MUI_JASS, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_Call_Air_Strike_MUI_JASS, Condition( function Trig_Call_Air_Strike_MUI_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_Call_Air_Strike_MUI_JASS, function Trig_Call_Air_Strike_MUI_JASS_Actions )
endfunction


JASS:

function Trig_AS_Check_Distance_MUI_JASS_Conditions takes nothing returns boolean
    return ( ( CountUnitsInGroup(udg_TempGroup) &gt; 0 ) )
endfunction

function Trig_AS_Check_Distance_MUI_JASS_Func001Func003001 takes nothing returns boolean
    return ( DistanceBetweenPoints(udg_ASL[udg_TempInt], udg_JFL[udg_TempInt]) &lt;= 420.00 )
endfunction

function GroupFunction takes nothing returns nothing
    local integer loopnr = 0

    set udg_TempInt = GetUnitUserData(GetEnumUnit())
    set udg_JFL[udg_TempInt] = GetUnitLoc(GetEnumUnit())
    
    loop
        exitwhen ( Trig_AS_Check_Distance_MUI_JASS_Func001Func003001() )
        call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
    endloop
    
    call IssuePointOrderLoc( GetEnumUnit(), &quot;move&quot;, udg_JFLL[udg_TempInt] )
    call RemoveLocation(udg_JFS[udg_TempInt])
    call RemoveLocation(udg_JFL[udg_TempInt])
    call RemoveLocation(udg_JFLL[udg_TempInt])
    
    loop
        exitwhen loopnr &gt; udg_NOS[udg_TempInt]
        set udg_sl[udg_TempInt] = PolarProjectionBJ(udg_ASL[udg_TempInt], GetRandomReal(1.00, 350.00), GetRandomDirectionDeg())
        set udg_SpecialFX = AddSpecialEffectLoc( &quot;Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl&quot;, udg_sl[udg_TempInt] )
        call TriggerExecute( gg_trg_Special_Effect_Destruction )
        call UnitDamagePointLoc( GetEnumUnit(), 0.50, 125.00, udg_sl[udg_TempInt], udg_SD[udg_TempInt], ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
        call RemoveLocation(udg_sl[udg_TempInt])
        set loopnr = loopnr + 1
    endloop
    
    call RemoveLocation(udg_ASL[udg_TempInt])
endfunction

function Trig_AS_Check_Distance_MUI_JASS_Actions takes nothing returns nothing
    call ForGroupBJ( udg_TempGroup, function GroupFunction )
endfunction

//===========================================================================
function InitTrig_AS_Check_Distance_MUI_JASS takes nothing returns nothing
    local trigger gg_trg_AS_Check_Distance_MUI_JASS = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_AS_Check_Distance_MUI_JASS, 0.50 )
    call TriggerAddCondition( gg_trg_AS_Check_Distance_MUI_JASS, Condition( function Trig_AS_Check_Distance_MUI_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_AS_Check_Distance_MUI_JASS, function Trig_AS_Check_Distance_MUI_JASS_Actions )
endfunction


Special Effect Destruction:
JASS:

function Trig_Special_Effect_Destruction_Actions takes nothing returns nothing
    local effect tempEffect
    set tempEffect = udg_SpecialFX
    call PolledWait( 5.00 )
    set udg_SpecialFX = tempEffect
    call DestroyEffect( udg_SpecialFX )
endfunction

//===========================================================================
function InitTrig_Special_Effect_Destruction takes nothing returns nothing
    local trigger gg_trg_Special_Effect_Destruction = CreateTrigger(  )
    call DisableTrigger( gg_trg_Special_Effect_Destruction )
    call TriggerAddAction( gg_trg_Special_Effect_Destruction, function Trig_Special_Effect_Destruction_Actions )
endfunction

Thirdly, the map - attached! :thup:
EDIT: Added a newer version of the map, with JASS triggers.
 

Attachments

  • [Spell] Air Strike Spell.w3x
    27.8 KB · Views: 280

vypur85

Hibernate
Reaction score
803
Hmmm....

Code:
=Wait until ((Distance between ASL[TempInt] and JFL[TempInt]) Less than or equal to 420.00), checking every 0.10 seconds

Seems quite inappropriate to use waits in Unit Group loop. Are you sure it worked? (Not tested the map yet :p)

You should post this trigger as well, I think.
Code:
Trigger - Run Special Effect Destruction <gen> (ignoring conditions)
 

Flare

Stops copies me!
Reaction score
662
Looks cool, but this part could be improved a bit
Code:
        If ((Level of Air Strike  for Hero) Equal to 1) then do (Set NumberOfStrikes = 4) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 2) then do (Set NumberOfStrikes = 6) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 3) then do (Set NumberOfStrikes = 8) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 1) then do (Set StrikeDamage = 100.00) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 2) then do (Set StrikeDamage = 125.00) else do (Do nothing)
        If ((Level of Air Strike  for Hero) Equal to 3) then do (Set StrikeDamage = 150.00) else do (Do nothing)

Set NumberOfStrikes = 2 + (2 * Level of Ability for Unit)
Set StrikeDamage = 75 + (25 * Level of Ability for Unit)

And I'm curious as to why you need an arrayed variable for the dummy unit - you're able to refer to it via Picked Unit in the periodic trigger anyway, and if it was for improved efficiency, a non-arrayed variable would work just fine
 

Exide

I am amazingly focused right now!
Reaction score
448
Thanks for the replies. :)
I haven't optimized the triggers or even tried to. I was just happy it worked casting several spells at the same time. :p

EDIT:
I optimized the spells and added a JASS version, I also uploaded the new version of the map.
 

Exide

I am amazingly focused right now!
Reaction score
448
I would just get rid of the JASS version. It's just converted straight from GUI.

It is converted, yes. With some BJ's removed and other tweaks.
JASS code is much easier to copy into your map, if you're interested in having the spell.


Well not exactly he removed most of the BJs but thats not a very big difference and change:
JASS:
( 2 + GetUnitAbilityLevelSwapped(&#039;A000&#039;, GetTriggerUnit()) )

to:
JASS:
( 2 + GetUnitAbilityLevel(GetTriggerUnit(), &#039;A000&#039;) )

Same goes with the others.

Btw, nice spell good job.:thup:

I actually changed that and some other things as well, in the update for this map. -But I couldn't get some stuff to work so I never bothered posting it. :p
And thanks. =)
 

Flare

Stops copies me!
Reaction score
662
JASS code is much easier to copy into your map, if you're interested in having the spell.

It doesn't automatically copy the global vars (unless you're using global blocks that are in the same 'trigger')

And if you want to keep the JASS version, you really need to get rid of all the bad BJ's (there's GroupAddUnitSimple somewhere in there which is a stupid BJ)
 

Exide

I am amazingly focused right now!
Reaction score
448
It doesn't automatically copy the global vars (unless you're using global blocks that are in the same 'trigger')

And if you want to keep the JASS version, you really need to get rid of all the bad BJ's (there's GroupAddUnitSimple somewhere in there which is a stupid BJ)

I'm keeping the JASS triggers, and there's nothing you can do about it. :thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top