A Misfiring Trigger

Somatic

You can change this now in User CP.
Reaction score
84
I had a problem with this Trigger. Please do not start comment on its untidyness or not using Vjass and stuff like that.

JASS:
function Trig_Air_ship_Support_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A068' ) ) then
        return false
    endif
    return true
endfunction

function dsadsa_Func001001 takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'h02P' )
endfunction

function dsadsa_Func001002 takes nothing returns boolean
    return ( GetUnitTypeId(GetFilterUnit()) == 'h01E' )
endfunction

function dsadsa_Conditions takes nothing returns boolean
    if ( not GetBooleanOr( dsadsa_Func001001(), dsadsa_Func001002() ) ) then
        return false
    endif
    return true
endfunction

function Contain_Airship takes unit Apache, location Temp_Point returns boolean
    return ( RectContainsUnit(RectFromCenterSizeBJ(Temp_Point, 500.00, 500.00), Apache) == true )
endfunction

function Trig_Air_ship_Support_Actions takes nothing returns nothing
    local unit Gun_Ship_1
    local unit Gun_Ship_2
    local unit Gun_Ship_3
    local unit f
    local real cy
    local real cx
    local location Temp_Point2
    local group Temp_Group = CreateGroup()

    local unit Caster = GetSpellAbilityUnit()
    local location Temp_Point = GetSpellTargetLoc()
    local location Start_Point = PolarProjectionBJ(Temp_Point, 1400.00, GetRandomDirectionDeg())
    local player Players = GetOwningPlayer(Caster)
    set cx = GetLocationX(Temp_Point)
    set cy = GetLocationY(Temp_Point)
    call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(Caster)), ( "|c00808000" + ( "Gunship Operator" + ( "|r" + " : Coordinates Received" ) ) ) )
    if ( Player_Checker(Players) ) then
    call CreateNUnitsAtLoc( 1, 'h02P', Player(0), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_1 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 1 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_1, "move", Temp_Point )
    call CreateNUnitsAtLoc( 1, 'h02P', Player(0), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_2 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 2 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_2, "move", Temp_Point )
    call CreateNUnitsAtLoc( 1, 'h01E', Player(0), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_3 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 3 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_3, "move", Temp_Point )
    call GroupEnumUnitsInRange(Temp_Group, cx, cy, 1000.00, Condition(function dsadsa_Conditions))
    call BJDebugMsg("Gun Ship Grouped")
    else
    call CreateNUnitsAtLoc( 1, 'h02P', Player(6), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_1 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 4 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_1, "move", Temp_Point )
    call CreateNUnitsAtLoc( 1, 'h02P', Player(6), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_2 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 5 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_2, "move", Temp_Point )
    call CreateNUnitsAtLoc( 1, 'h01E', Player(6), Start_Point, bj_UNIT_FACING )
    set Gun_Ship_3 = GetLastCreatedUnit()
    call BJDebugMsg("Gun Ship 6 Reporting")
    call IssuePointOrderLocBJ( Gun_Ship_3, "move", Temp_Point )
    call GroupEnumUnitsInRange(Temp_Group, cx, cy, 1000.00, Condition(function dsadsa_Conditions))
    call BJDebugMsg("Gun Ship Grouped 2")
    endif
    call TriggerSleepAction( 5.00 )
    loop
        call BJDebugMsg("Set Up Gunship")
        set f = FirstOfGroup(Temp_Group)
        exitwhen f == null
        call BJDebugMsg("Reached Location")
        call DisplayTextToForce( GetPlayersAll(), UnitId2StringBJ(GetUnitTypeId(f)) )
        set Temp_Point2 = PolarProjectionBJ(Temp_Point, GetRandomReal(400.00, 600.00), GetRandomDirectionDeg())
        call IssuePointOrderLocBJ( f, "patrol", Temp_Point2 )
        call BJDebugMsg("Issuing Order")
        call RemoveLocation(Temp_Point2)
        call GroupRemoveUnit(Temp_Group,f)
    endloop
    call TriggerSleepAction( 120.00 )
    call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(Caster)), ( "|c00808000" + ( "Gunship Operator" + ( "|r" + " : We're Leaving the rest to You, Good Luck" ) ) ) )
    call IssuePointOrderLocBJ( Gun_Ship_1, "move", GetRectCenter(gg_rct_Gun_Ship_Kill_Zone) )
    call IssuePointOrderLocBJ( Gun_Ship_2, "move", GetRectCenter(gg_rct_Gun_Ship_Kill_Zone) )
    call IssuePointOrderLocBJ( Gun_Ship_3, "move", GetRectCenter(gg_rct_Gun_Ship_Kill_Zone) )
    call TriggerSleepAction( 15.00 )
    call RemoveUnit( Gun_Ship_1 )
    call RemoveUnit( Gun_Ship_2 )
    call RemoveUnit( Gun_Ship_3 )
    call RemoveLocation(Temp_Point)
    call RemoveLocation(Temp_Point2)
    call RemoveLocation(Start_Point)
    call DestroyGroup (Temp_Group)
endfunction

//===========================================================================
function InitTrig_Air_ship_Support takes nothing returns nothing
    set gg_trg_Air_ship_Support = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Air_ship_Support, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Air_ship_Support, Condition( function Trig_Air_ship_Support_Conditions ) )
    call TriggerAddAction( gg_trg_Air_ship_Support, function Trig_Air_ship_Support_Actions )
endfunction


My problem is that on my first cast, it only works till the "Set Up Gunship". My Second Cast works, but when i abuse it thought the third time, it starts to malfunction, as the actions work, it becomes the previous group of Gunships moving, and not the third group, it happends all the way as i start to abuse "thedudeabides" Any way of trouble shooting this problem? :banghead:
 

Builder Bob

Live free or don't
Reaction score
249
Edit: I did a small test in the WE and found out that what I suggested was not the issue, I'll look through the code again and see if I can find anything.

It would be helpful if you specified what the trigger is supposed to do though. So we can know what is not working right.

Edit 2: I noticed that you enumerate every unit within 1000 of Temp_Point, while you create all the units (that I am assuming you want to enumerate), 1400 away from this point. Is this the cause of your problem?
 
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