• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Help me please

Status
Not open for further replies.
Level 4
Joined
Apr 11, 2007
Messages
97
Hi there!
I wanted to get a "paradrop" trigger so than I thought of the Blizzard
map Bomber Command, since it is the only map that I know that
has paradropping. So I opened the map found the trigger but it was jass.
And I don't know anything about jass o.o So if someone could help me it would be great!

(I take no credit for this code!)
(I will give the one who help me a +rep!)

JASS:
function IsPointInRiver takes location fp_loc returns boolean
    if ( RectContainsLoc(gg_rct_RIVER_1, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_2, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_3, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_4, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_5, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_6, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_7, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_8, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_9, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_10, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_11, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_12, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_13, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_14, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_15, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_16, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_17, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_18, fp_loc) ) then
        return true
    endif
    if ( RectContainsLoc(gg_rct_RIVER_19, fp_loc) ) then
        return true
    endif
    return false
endfunction

function DropAirborne takes integer fp_nPlaneId returns nothing
    local unit uPlane

    local integer nState
    local integer nTick

    local integer nPlaneUnitType
    local integer nPTId

    local integer nAbUT
    local integer nLandUT
    local location locTarget
    local location locTemp
    local location locDrop
    local real rFacing
    local integer nHP

    local unit uAirborne
    local unit uLand

    local player plOriginal
    local player pl
    local real rHeight

    local effect eff

    local location locPlane
    local real rDis
    local real rAngle

    set uPlane = GetPlane( fp_nPlaneId )
    if ( uPlane == null or IsUnitDeadBJ(uPlane) ) then
        return
    endif

    call PlaneFlyFurther( fp_nPlaneId )

    set nPlaneUnitType = GetUnitTypeId( uPlane )
    set nPTId = GetPlaneTypeIndex( nPlaneUnitType )
    if ( nPTId < 0 ) then
        return
    endif

    if ( GetPlaneState(fp_nPlaneId) == udg__PLANESTATE_FLYING ) then
        set nPlaneUnitType = GetUnitTypeId( uPlane )
        set nPTId = GetPlaneTypeIndex( nPlaneUnitType )
        if ( nPTId < 0 ) then
            return
        endif

        set locPlane = GetUnitLoc( uPlane )
        set locTarget = GetPlaneTarget( fp_nPlaneId )
        set rDis = DistanceBetweenPoints( locPlane, locTarget )
        call RemoveLocation( locPlane )

        if ( rDis >= GetPlaneTypeActionRange(nPTId) ) then
            return
        endif
    endif

    set nAbUT = GetPlaneTypeDropperAirborne( nPTId )
    set nLandUT = GetPlaneTypeDropperLandUT( nPTId )

    set locTemp = GetPlaneTarget( fp_nPlaneId )
    set locTarget = Location( GetLocationX(locTemp), GetLocationY(locTemp) )

    set locDrop = GetUnitLoc( uPlane )
    set plOriginal = GetOwningPlayer(uPlane)
    set pl = GetPlayerForcePlayer( plOriginal )
    set uAirborne = CreateUnitAtLoc( pl, nAbUT, locDrop, GetUnitFacing(uPlane) )
    call SetUnitPathing( uAirborne, false )
    call SetUnitColor( uAirborne, GetPlayerColor(plOriginal) )
    set rHeight = GetUnitDefaultFlyHeight( uAirborne )
    call SetUnitFlyHeight( uAirborne, 0, rHeight / 2 )
    
    call TriggerSleepAction(2)

    if ( IsUnitDeadBJ(uAirborne) ) then
        call RemoveLocation( locDrop )
        call RemoveLocation( locTarget )
        return
    endif

    if ( IsPointInRiver(locDrop) ) then
        call RemoveUnit( uAirborne )
        call RemoveLocation( locDrop )
        call RemoveLocation( locTarget )
        return
    endif

    set locDrop = GetUnitLoc( uAirborne )
    set rFacing = GetUnitFacing(uAirborne)
    call RemoveUnit( uAirborne )
    set uLand = CreateUnitAtLoc( plOriginal, nLandUT, locDrop, rFacing )
    call UnitApplyTimedLife( uLand, 'BTLF', GetPlaneTypeDropperLifeDur(nPTId) )
    call RemoveLocation( locDrop )
    //call SetUnitColor( uLand, GetPlayerColor(plOriginal) )
    call IssuePointOrderLoc( uLand, "attack", locTarget )
    call RemoveLocation( locTarget )
endfunction

function DropperAction takes integer fp_nPlaneId returns nothing
    local unit uPlane
    local integer nPlaneUnitType
    local integer nPTId

    local integer nState

    local integer nTick
    local integer nActionTime
    local integer nAbNum
    local integer nInterval

    set uPlane = GetPlane( fp_nPlaneId )
    if ( uPlane == null or IsUnitDeadBJ(uPlane) ) then
        return
    endif

    call PlaneFlyFurther( fp_nPlaneId )

    if ( GetPlaneState(fp_nPlaneId) == udg__PLANESTATE_FLYING ) then
        if ( not PlaneWithinActionRange(fp_nPlaneId) ) then
            return
        endif
    endif

    set nState = GetPlaneState(fp_nPlaneId)
    if ( nState == udg__PLANESTATE_FLYING ) then
        call SetPlaneState( fp_nPlaneId, udg__PLANESTATE_ACTING )
        call SetPlaneActionTick( fp_nPlaneId, 0 )
        call DropAirborne( fp_nPlaneId )
    elseif ( nState == udg__PLANESTATE_ACTING ) then
        if ( CheckPlaneActionTimeExpire(fp_nPlaneId) ) then
            return
        endif

        set nPlaneUnitType = GetUnitTypeId( uPlane )
        set nPTId = GetPlaneTypeIndex( nPlaneUnitType )
        if ( nPTId < 0 ) then
             return
        endif

        set nAbNum = GetPlaneTypeDropperAbNumber( nPTId )
        if ( nAbNum <= 1 ) then
            return
        endif

        set nTick = GetPlaneActionTick( fp_nPlaneId ) + 1
        set nActionTime = GetPlaneTypeActionTime( nPTId )
        set nInterval = ( nActionTime - 1 ) / nAbNum
        if ( ModuloInteger(nTick - 1, nInterval) != 0 or (nTick - 1)/nInterval >= nAbNum ) then
            return
        endif

        call DropAirborne( fp_nPlaneId )
    endif
endfunction

//===========================================================================
function InitTrig_Dropper_Functions takes nothing returns nothing
endfunction
 
Status
Not open for further replies.
Top