[Spell Request] Notd Airstrike

R 3 T R O

New Member
Reaction score
12
Spell Name
CAS (Close Air Support)

Spell Description
This spell is from Notd aftermath. When used the item it marks the area with a green trueshot aura and after 4-5sec 3 planes are flying to the marked area as the jets are near the area they shoot missiles to the marked area and as they are flying away... as the missles hit the floor they causes explosions in a medium sized radius

Extra Notes
I would open a notd map and copy the code but i feel its protected for a reason and its not fair to the maker

This past week I have tried to make my own but It does not work how i want it so i gave up and resorting to you fine people to assist me
This is the last thing i need for my map

THIS BELOW is an example of how notd did their spell but i tryed to use this but it don't work

I will greatly appreciate this help and include rep and Credit!

JASS:

function AirstrikeInbound takes nothing returns nothing
    local unit u
    local integer i = 1
    local trigger t = GetTriggeringTrigger()
    local unit u1 = GetHandleUnit(t,"u1")
    local unit u2 = GetHandleUnit(t,"u2")
    local unit u3 = GetHandleUnit(t,"u3")
    local location exitloc = GetHandleLocation(t,"exitloc")
    local location target = GetHandleLocation(t,"target")
    local real flighttime = GetHandleReal(t,"flighttime")
    local real xt = GetLocationX(target)
    local real yt = GetLocationY(target)
    local real dx = GetUnitX(u1) - xt
    local real dy = GetUnitY(u1) - yt
    local real dx2 = GetUnitX(u2) - xt
    local real dy2 = GetUnitY(u2) - yt
    local group missiles = CreateGroup()
    local boolean docleanup = false
    call PingMinimapEx(xt,yt,2.5,255,0,0,false)
    call IssuePointOrderLoc(u1, "move", exitloc)
    call IssuePointOrder(u2, "move", GetLocationX(exitloc)+150.0, GetLocationY(exitloc)-150.0)
    call IssuePointOrder(u3, "move", GetLocationX(exitloc)-150.0, GetLocationY(exitloc)-150.0)
    if (dx*dx+dy*dy<=3240000.0 or dx2*dx2+dy2*dy2<=3240000.0) then //1800 radius
        call DisableTrigger(t)
        call SetForceAllianceStateBJ( bj_FORCE_PLAYER[9], udg_UnknownEntities, bj_ALLIANCE_ALLIED )
        call GeneralText(5.0, "|cfff3ad00F-22 Pilot|r : Missiles fired." )
        set i = 1
        loop
            exitwhen i > 3
            set u = CreateUnit( Player(9), 'h00C', GetUnitX(GetHandleUnit(t,"u"+I2S(i)))+8.0, GetUnitY(GetHandleUnit(t,"u"+I2S(i)))+8.0 ,0 )
            call IssuePointOrder(u,"attackground",xt,yt)
            call GroupAddUnit(missiles,u)
            set u = CreateUnit( Player(9), 'h00C', GetUnitX(GetHandleUnit(t,"u"+I2S(i)))-8.0, GetUnitY(GetHandleUnit(t,"u"+I2S(i)))-8.0 ,0 )
            call IssuePointOrder(u,"attackground",xt,yt)
            call GroupAddUnit(missiles,u)
            set i = i + 1
        endloop
        call StartSound(gg_snd_RPGMissile)
        call PolledWait(0.25)
        call StartSound(gg_snd_RPGMissile2)
        call DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", xt, yt ))
        call ArtHandler(u1,target,35,1.0,625.0,3.5,1)
        call SetUnitFlyHeight(u1, 1200.00, 200.00)
        call SetUnitFlyHeight(u2, 1200.00, 200.00)
        call SetUnitFlyHeight(u3, 1200.00, 200.00)
        call PolledWait(0.1)
        call EarShockArea(xt,yt,500)
        call ForGroup(missiles,function RemoveUnitAll)
        call PolledWait(0.1)
        set udg_myinteger = 5
        call EnumDestructablesInCircleBJ(500,target,function killtree)
        call SetForceAllianceStateBJ( bj_FORCE_PLAYER[9], udg_UnknownEntities, bj_ALLIANCE_UNALLIED )
        call DestroyGroup(missiles)
        call SetSoundPosition(gg_snd_F22Flight, xt, yt, 0)
        call SetSoundVolume(gg_snd_F22Flight, 127)
        call StartSound(gg_snd_F22Flight)
        call PolledWait(2.5)
        set docleanup = true
    else
        set flighttime = flighttime + 0.5
        call SetHandleReal(t,"flighttime",flighttime)
    endif
    if (flighttime>30.0 or docleanup==true) then
        call RemoveUnit(u1)
        call RemoveUnit(u2)
        call RemoveUnit(u3)
        call RemoveLocation(target)
        call RemoveLocation(exitloc)
        call RemoveUnit( GetHandleUnit(t,"beacon") )
        call DisableTrigger(t)
        call TriggerRemoveAction(t,GetHandleTriggerAction(t,"trigac"))
        call FlushHandleLocals(t)
        call DestroyTrigger(t)
    endif
    set missiles = null
    set t = null
    set u1 = null
    set u2 = null
    set u3 = null
    set exitloc = null
    set target = null
endfunction

function F22RaptorEntry takes real x, real y, integer i, real r1, real r2 returns nothing
    local real r = GetRandomReal(r1,r2)
    local real theta = GetRandomReal(0,6.28)
    local real ux = Clamp(x+r*Cos(theta),GetRectMinX(bj_mapInitialPlayableArea),GetRectMaxX(bj_mapInitialPlayableArea))
    local real uy = Clamp(y+r*Sin(theta),GetRectMinY(bj_mapInitialPlayableArea),GetRectMaxY(bj_mapInitialPlayableArea))
    set udg_F22Raptor[1] = CreateUnit(Player(11),i,ux,uy,theta+3.14)
    set udg_F22Raptor[2] = CreateUnit(Player(11),i,ux,uy,theta+3.14)
    set udg_F22Raptor[3] = CreateUnit(Player(11),i,ux,uy,theta+3.14)
endfunction

function AirstrikeConditions takes nothing returns boolean
    return (GetSpellAbilityId()=='A04J' or GetSpellAbilityId()=='A05H')
endfunction

function Airstrike takes nothing returns nothing
    local integer i = 1
    local location l = GetSpellTargetLoc()
    local real x1 = GetLocationX(l)
    local real y1 = GetLocationY(l)
    local real dx
    local real dy
    local real len
    local trigger t
    local player p = GetOwningPlayer(GetTriggerUnit())
    local unit u
    local real r = GetRandomReal(2800.0,5000.0)
    local real theta = GetRandomReal(0.0,6.28)
    local real ux = Clamp(x1+r*Cos(theta),GetRectMinX(bj_mapInitialPlayableArea),GetRectMaxX(bj_mapInitialPlayableArea))
    local real uy = Clamp(y1+r*Sin(theta),GetRectMinY(bj_mapInitialPlayableArea),GetRectMaxY(bj_mapInitialPlayableArea))
    local unit raptor1 = CreateUnit(Player(11),'h00B',ux,uy,theta+3.14)
    local unit raptor2 = CreateUnit(Player(11),'h00B',ux,uy,theta+3.14)
    local unit raptor3 = CreateUnit(Player(11),'h00B',ux,uy,theta+3.14)
    local real x2 = GetUnitX(raptor1)
    local real y2 = GetUnitY(raptor1)
    call SetCameraQuickPosition(x1,y1)
    call PingMinimapEx(x1, y1, 15.0, 204, 196, 115, false)
    set u = CreateUnit(Player(8),'n00P',x1,y1,0.0) //DangerZone Dummy
    call UnitApplyTimedLife(u,'Bhwd',15.00)
    call StartSound(gg_snd_ALICEBeep)
    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 10.00, "Airstrike inbound at coordinates ( " + I2S(R2I(x1)) + ", " + I2S(R2I(y1)) + " )." )
    loop
        exitwhen i > udg_Players
        call UnitShareVision(raptor1,ConvertedPlayer(udg_Sorted<i>),true)
        call UnitShareVision(raptor2,ConvertedPlayer(udg_Sorted<i>),true)
        call UnitShareVision(raptor3,ConvertedPlayer(udg_Sorted<i>),true)
        set i = i + 1
    endloop
    call StartSound(gg_snd_F22Pilot)
    set dx = x1-x2
    set dy = y1-y2
    set len = SquareRoot(dx*dx+dy*dy+1)
    set t = CreateTrigger()
    call DisableTrigger(t)
    call SetHandleHandle(t,&quot;u1&quot;,raptor1)
    call SetHandleHandle(t,&quot;u2&quot;,raptor2)
    call SetHandleHandle(t,&quot;u3&quot;,raptor3)
    call SetHandleHandle(t,&quot;exitloc&quot;,Location(x1+1200*dx/len,y1+1200*dy/len))
    call SetHandleHandle(t,&quot;target&quot;,l)
    call SetHandleReal(t,&quot;flighttime&quot;, 0.0)
    call SetHandleHandle(t,&quot;beacon&quot;,CreateUnit(p,&#039;e00D&#039;,x1,y1,0.0))
    call SetHandleHandle(t,&quot;trigac&quot;, TriggerAddAction( t, function AirstrikeInbound ))
    call TriggerRegisterTimerEvent(t,0.5,true)
    call EnableTrigger(t)
    set t = null
    set u = null
    set raptor1 = null
    set raptor2 = null
    set raptor3 = null
endfunction

//===========================================================================
function InitTrig_Airstrike takes nothing returns nothing
    set gg_trg_Airstrike = CreateTrigger()
    call TriggerAddCondition( gg_trg_Airstrike, Condition( function AirstrikeConditions ) )
    call TriggerAddAction( gg_trg_Airstrike, function Airstrike )
endfunction</i></i></i>
 

R 3 T R O

New Member
Reaction score
12
Bump.

I Would really appreciate the help. I know it seems like allot but help out a fellow member :)
 

ZugZugZealot

New Member
Reaction score
33
A tip: For code blocks that long, you should stay how it doesn't work.

Anyways, one thing I can tell you that it's majorly lacking, is a trigger event.
JASS:
function InitTrig_Airstrike takes nothing returns nothing
    local integer i = 0 //Added
    set gg_trg_Airstrike = CreateTrigger()
    loop //Added
        exitwhen i &gt; 11 //Added
        call TriggerRegisterPlayerUnitEvent( gg_trg_Airstrike, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null ) //Added
        set i = i + 1 //Added
    endloop //Added
    call TriggerAddCondition( gg_trg_Airstrike, Condition( function AirstrikeConditions ) )
    call TriggerAddAction( gg_trg_Airstrike, function Airstrike )
endfunction


Also, you should avoid dynamic triggers (giving yourself the need to destroy triggers). I'm not sure why they're "bad", I just know that some of the biggies like Vexorian frown upon them. For this case, you could easily replace "[ljass]local trigger t[/ljass]" with "[ljass]local timer t[/ljass]"; replace "[ljass]set t = CreateTrigger()[/ljass]" with "[ljass]set t = CreateTimer()[/ljass]"; and replace "[ljass]call TriggerRegisterTimerEvent(t,0.5,true)[/ljass]" with "[ljass]call TimerStart( call TimerStart( t, 0.50, true, function AirstrikeInbound )[/ljass]"
 
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