• 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.

Mistakes of Converting Jass to Gui ( Original GUI )

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2012
Messages
1,474
I got some triggers which are originally GUI , But converted into JASS . I want them GUI again but I suck at JASS . What mistakes have I done while converting ? Because it seems they never work fine as the originals do :/
+ 2 reps / + Credits

NOTE : IN THE SECOND TRIGGERS COWS AND RABBITS INCLUDED , NVM ABOUT THEM , THEY ARE SIMULIAR TO SHEEPS , CHICKENS AND PIGS!
PLEASE SEE THE OTHER CATEGORIES IN OTHER POST
JASS:
function Trig_Spawned_Animals_and_mercs_Func001Func002Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'opeo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001Func010001 takes nothing returns boolean
    return ( udg_TempInteger == 7 )
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001Func011C takes nothing returns boolean
    if ( not ( CountUnitsInGroup(udg_MercAttackGroup) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001C takes nothing returns boolean
    if ( not ( GetPlayerState(Player(PLAYER_NEUTRAL_AGGRESSIVE), PLAYER_STATE_RESOURCE_FOOD_USED) < 60 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func005001 takes nothing returns boolean
    return ( udg_TempInteger == 7 )
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func006C takes nothing returns boolean
    if ( not ( CountUnitsInGroup(udg_MercAttackGroup) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001C takes nothing returns boolean
    if ( not ( GetPlayerState(Player(10), PLAYER_STATE_RESOURCE_FOOD_USED) < 50 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func005001 takes nothing returns boolean
    return ( udg_TempInteger == 7 )
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func006C takes nothing returns boolean
    if ( not ( CountUnitsInGroup(udg_MercAttackGroup) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002Func007C takes nothing returns boolean
    if ( not ( GetPlayerState(Player(9), PLAYER_STATE_RESOURCE_FOOD_USED) < 50 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func002C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'h008' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func003Func002C takes nothing returns boolean
    if ( not ( udg_TempUnit == null ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func003C takes nothing returns boolean
    if ( not ( udg_AniCount[udg_TempInteger] < udg_AnimalsMaximum ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001Func003Func002C takes nothing returns boolean
    if ( not ( udg_TempUnit == null ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001Func003C takes nothing returns boolean
    if ( not ( udg_AniCount[udg_TempInteger] < udg_AnimalsMaximum ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'npig' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func004Func002C takes nothing returns boolean
    if ( not ( udg_TempUnit == null ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func004C takes nothing returns boolean
    if ( not ( udg_AniCount[udg_TempInteger] < udg_AnimalsMaximum ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008Func004C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'nshe' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001Func008C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTrainedUnit()) == 'nech' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetTrainedUnit(), UNIT_TYPE_UNDEAD) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spawned_Animals_and_mercs_Actions takes nothing returns nothing
    if ( Trig_Spawned_Animals_and_mercs_Func001C() ) then
        set udg_TempPoint = GetUnitRallyPoint(GetTriggerUnit())
        set udg_TempPoint1 = GetUnitLoc(GetTriggerUnit())
        set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint1, 64.00, AngleBetweenPoints(udg_TempPoint1, udg_TempPoint))
        set udg_TempInteger = GetConvertedPlayerId(GetOwningPlayer(GetTrainedUnit()))
        set udg_TempPlayer = GetOwningPlayer(GetTriggerUnit())
        if ( Trig_Spawned_Animals_and_mercs_Func001Func008C() ) then
            call IssueTrainOrderByIdBJ( GetTriggerUnit(), 'nech' )
            call RemoveUnit( GetTrainedUnit() )
            if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func003C() ) then
                call CreateNUnitsAtLoc( 1, 'nech', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint2, bj_UNIT_FACING )
                call GroupAddUnitSimple( GetLastCreatedUnit(), udg_AniChicks[udg_TempInteger] )
                set udg_AniCount[udg_TempInteger] = ( udg_AniCount[udg_TempInteger] + 1 )
                call SetUnitPositionLoc( GetLastCreatedUnit(), udg_TempPoint2 )
                call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_TempPoint )
            else
                set udg_TempUnit = GroupPickRandomUnit(udg_AniChicks[udg_TempInteger])
                if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func003Func002C() ) then
                else
                    set udg_TempPoint3 = GetUnitLoc(udg_TempUnit)
                    call GroupRemoveUnitSimple( udg_TempUnit, udg_AniChicks[udg_TempInteger] )
                    call RemoveUnit( udg_TempUnit )
                    call CreateNUnitsAtLoc( 1, 'n00E', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint3, bj_UNIT_FACING )
                    call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                    call CreateNUnitsAtLoc( 1, 'h00F', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint3, bj_UNIT_FACING )
                    call SetUnitScalePercent( GetLastCreatedUnit(), 30.00, 30.00, 30.00 )
                    call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
                endif
            endif
        else
            if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004C() ) then
                call IssueTrainOrderByIdBJ( GetTriggerUnit(), 'nshe' )
                call RemoveUnit( GetTrainedUnit() )
                if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func004C() ) then
                    call CreateNUnitsAtLoc( 1, 'nshe', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint2, bj_UNIT_FACING )
                    call GroupAddUnitSimple( GetLastCreatedUnit(), udg_AniSheep[udg_TempInteger] )
                    set udg_AniCount[udg_TempInteger] = ( udg_AniCount[udg_TempInteger] + 1 )
                    call SetUnitPositionLoc( GetLastCreatedUnit(), udg_TempPoint2 )
                    call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_TempPoint )
                else
                    set udg_TempUnit = GroupPickRandomUnit(udg_AniSheep[udg_TempInteger])
                    if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func004Func002C() ) then
                    else
                        set udg_TempPoint3 = GetUnitLoc(udg_TempUnit)
                        call GroupRemoveUnitSimple( udg_TempUnit, udg_AniSheep[udg_TempInteger] )
                        call RemoveUnit( udg_TempUnit )
                        call CreateNUnitsAtLoc( 1, 'n00F', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint3, bj_UNIT_FACING )
                        call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                        call CreateNUnitsAtLoc( 1, 'h00F', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint3, bj_UNIT_FACING )
                        call SetUnitScalePercent( GetLastCreatedUnit(), 30.00, 30.00, 30.00 )
                        call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
                    endif
                endif
            else
                if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001C() ) then
                    call IssueTrainOrderByIdBJ( GetTriggerUnit(), 'npig' )
                    call RemoveUnit( GetTrainedUnit() )
                    if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001Func003C() ) then
                        call CreateNUnitsAtLoc( 1, 'npig', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint2, bj_UNIT_FACING )
                        call GroupAddUnitSimple( GetLastCreatedUnit(), udg_AniPigs[udg_TempInteger] )
                        set udg_AniCount[udg_TempInteger] = ( udg_AniCount[udg_TempInteger] + 1 )
                        call SetUnitPositionLoc( GetLastCreatedUnit(), udg_TempPoint2 )
                        call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_TempPoint )
                    else
                        set udg_TempUnit = GroupPickRandomUnit(udg_AniPigs[udg_TempInteger])
                        if ( Trig_Spawned_Animals_and_mercs_Func001Func008Func004Func001Func003Func002C() ) then
                        else
                            set udg_TempPoint3 = GetUnitLoc(udg_TempUnit)
                            call GroupRemoveUnitSimple( udg_TempUnit, udg_AniPigs[udg_TempInteger] )
                            call RemoveUnit( udg_TempUnit )
                            call CreateNUnitsAtLoc( 1, 'n00G', Player(bj_PLAYER_NEUTRAL_VICTIM), udg_TempPoint3, bj_UNIT_FACING )
                            call SetUnitUserData( GetLastCreatedUnit(), udg_TempInteger )
                            call CreateNUnitsAtLoc( 1, 'h00F', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint3, bj_UNIT_FACING )
                            call SetUnitScalePercent( GetLastCreatedUnit(), 30.00, 30.00, 30.00 )
                            call UnitApplyTimedLifeBJ( 1.50, 'BTLF', GetLastCreatedUnit() )
                        endif
                    endif
                else
                endif
            endif
        endif
        call UnitAddAbilityBJ( 'Aeth', GetLastCreatedUnit() )
        call RemoveLocation(udg_TempPoint)
        call RemoveLocation(udg_TempPoint1)
        call RemoveLocation(udg_TempPoint2)
    else
        set udg_TempPlayer = GetOwningPlayer(GetTrainedUnit())
        if ( Trig_Spawned_Animals_and_mercs_Func001Func002C() ) then
            call RemoveUnit( GetTrainedUnit() )
            call IssueTrainOrderByIdBJ( GetTriggerUnit(), 'h008' )
            set udg_TempPoint2 = GetRandomLocInRect(udg_revRect[GetRandomInt(1, 30)])
            // toto ma ostat ake je (jednotky)
            set udg_TempInteger = GetRandomInt(1, 14)
            if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007C() ) then
                call CreateNUnitsAtLoc( 1, udg_mercType[udg_TempInteger], Player(9), udg_TempPoint2, bj_UNIT_FACING )
                call SetUnitColor( GetLastCreatedUnit(), GetPlayerColor(udg_TempPlayer) )
                call RemoveGuardPosition( GetLastCreatedUnit() )
                if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func005001() ) then
                    call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Trappers )
                else
                    call DoNothing(  )
                endif
                if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func006C() ) then
                else
                    set udg_TempInt = GetRandomInt(1, 18)
                    set udg_TempPoint1 = GetRandomLocInRect(udg_wayRect[udg_TempInt])
                    call SetUnitAbilityLevelSwapped( 'A00G', GetLastCreatedUnit(), udg_TempInt )
                    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "attack", udg_TempPoint1 )
                    call CreateNUnitsAtLoc( 1, 'h009', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint2, bj_UNIT_FACING )
                    call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
                endif
            else
                if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001C() ) then
                    call CreateNUnitsAtLoc( 1, udg_mercType[udg_TempInteger], Player(10), udg_TempPoint2, bj_UNIT_FACING )
                    call SetUnitColor( GetLastCreatedUnit(), GetPlayerColor(udg_TempPlayer) )
                    call RemoveGuardPosition( GetLastCreatedUnit() )
                    if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func005001() ) then
                        call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Trappers )
                    else
                        call DoNothing(  )
                    endif
                    if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func006C() ) then
                    else
                        set udg_TempInt = GetRandomInt(1, 18)
                        set udg_TempPoint1 = GetRandomLocInRect(udg_wayRect[udg_TempInt])
                        call SetUnitAbilityLevelSwapped( 'A00G', GetLastCreatedUnit(), udg_TempInt )
                        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "attack", udg_TempPoint1 )
                        call CreateNUnitsAtLoc( 1, 'h009', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint2, bj_UNIT_FACING )
                        call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
                    endif
                else
                    if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001C() ) then
                        call CreateNUnitsAtLoc( 1, 'h000', Player(10), udg_TempPoint2, bj_UNIT_FACING )
                        call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
                        call UnitAddAbilityBJ( 'Afae', GetLastCreatedUnit() )
                        set udg_TempUnit = GetLastCreatedUnit()
                        call CreateNUnitsAtLoc( 1, udg_mercType[udg_TempInteger], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_TempPoint2, bj_UNIT_FACING )
                        call SetUnitColor( GetLastCreatedUnit(), GetPlayerColor(udg_TempPlayer) )
                        call IssueTargetOrderBJ( udg_TempUnit, "faeriefire", GetLastCreatedUnit() )
                        call RemoveGuardPosition( GetLastCreatedUnit() )
                        if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001Func010001() ) then
                            call GroupAddUnitSimple( GetLastCreatedUnit(), udg_Trappers )
                        else
                            call DoNothing(  )
                        endif
                        if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func007Func001Func001Func011C() ) then
                        else
                            set udg_TempInt = GetRandomInt(1, 18)
                            set udg_TempPoint1 = GetRandomLocInRect(udg_wayRect[udg_TempInt])
                            call SetUnitAbilityLevelSwapped( 'A00G', GetLastCreatedUnit(), udg_TempInt )
                            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "attack", udg_TempPoint1 )
                            call CreateNUnitsAtLoc( 1, 'h009', Player(PLAYER_NEUTRAL_PASSIVE), udg_TempPoint2, bj_UNIT_FACING )
                            call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
                        endif
                    else
                        call QuestMessageBJ( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), bj_QUESTMESSAGE_UNITACQUIRED, "TRIGSTR_628" )
                    endif
                endif
            endif
            call RemoveLocation (udg_TempPoint1)
            call RemoveLocation (udg_TempPoint2)
        else
            if ( Trig_Spawned_Animals_and_mercs_Func001Func002Func001C() ) then
                set udg_TempPoint = GetUnitRallyPoint(GetTriggerUnit())
                set udg_TempPoint1 = GetUnitLoc(GetTriggerUnit())
                set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint1, 64.00, AngleBetweenPoints(udg_TempPoint1, udg_TempPoint))
                call RemoveUnit( GetTrainedUnit() )
                call CreateNUnitsAtLoc( 1, 'opeo', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint2, bj_UNIT_FACING )
                call RemoveLocation(udg_TempPoint)
                call RemoveLocation(udg_TempPoint1)
                call RemoveLocation(udg_TempPoint2)
            else
            endif
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Spawned_Animals_and_mercs takes nothing returns nothing
    set gg_trg_Spawned_Animals_and_mercs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spawned_Animals_and_mercs, EVENT_PLAYER_UNIT_TRAIN_FINISH )
    call TriggerAddAction( gg_trg_Spawned_Animals_and_mercs, function Trig_Spawned_Animals_and_mercs_Actions )
endfunction
  • Spawned Animals and mercs
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Unit-type of (Trained unit)) is Undead) Equal to True
        • Then - Actions
          • Set TempPoint = (Rally-Point of (Triggering unit) as a point)
          • Set TempPoint1 = (Position of (Triggering unit))
          • Set TempPoint2 = (TempPoint1 offset by 64.00 towards (Angle from TempPoint1 to TempPoint) degrees)
          • Set TempInteger = (Player number of (Owner of (Trained unit)))
          • Set TempPlayer = (Owner of (Triggering unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Trained unit)) Equal to Chicken
            • Then - Actions
              • Unit - Order (Triggering unit) to train/upgrade to a Chicken
              • Unit - Remove (Trained unit) from the game
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AniCount[TempInteger] Less than AnimalsMaximum
                • Then - Actions
                  • Unit - Create 1 Chicken for Neutral Victim at TempPoint2 facing Default building facing degrees
                  • Unit Group - Add (Last created unit) to AniChicks[TempInteger]
                  • Set AniCount[TempInteger] = (AniCount[TempInteger] + 1)
                  • Unit - Move (Last created unit) instantly to TempPoint2
                  • Unit - Set the custom value of (Last created unit) to TempInteger
                  • Unit - Order (Last created unit) to Move To TempPoint
                • Else - Actions
                  • Set TempUnit = (Random unit from AniChicks[TempInteger])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempUnit Equal to No unit
                    • Then - Actions
                    • Else - Actions
                      • Set TempPoint3 = (Position of TempUnit)
                      • Unit Group - Remove TempUnit from AniChicks[TempInteger]
                      • Unit - Remove TempUnit from the game
                      • Unit - Create 1 Golden Chicken (Level 2) for Neutral Victim at TempPoint3 facing Default building facing degrees
                      • Unit - Set the custom value of (Last created unit) to TempInteger
                      • Unit - Create 1 FeralSpiritEffect for Neutral Passive at TempPoint3 facing Default building facing degrees
                      • Animation - Change (Last created unit)'s size to (30.00%, 30.00%, 30.00%) of its original size
                      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Trained unit)) Equal to Sheep
                • Then - Actions
                  • Unit - Order (Triggering unit) to train/upgrade to a Sheep
                  • Unit - Remove (Trained unit) from the game
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AniCount[TempInteger] Less than AnimalsMaximum
                    • Then - Actions
                      • Unit - Create 1 Sheep for Neutral Victim at TempPoint2 facing Default building facing degrees
                      • Unit Group - Add (Last created unit) to AniSheep[TempInteger]
                      • Set AniCount[TempInteger] = (AniCount[TempInteger] + 1)
                      • Unit - Move (Last created unit) instantly to TempPoint2
                      • Unit - Set the custom value of (Last created unit) to TempInteger
                      • Unit - Order (Last created unit) to Move To TempPoint
                    • Else - Actions
                      • Set TempUnit = (Random unit from AniSheep[TempInteger])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • TempUnit Equal to No unit
                        • Then - Actions
                        • Else - Actions
                          • Set TempPoint3 = (Position of TempUnit)
                          • Unit Group - Remove TempUnit from AniSheep[TempInteger]
                          • Unit - Remove TempUnit from the game
                          • Unit - Create 1 Black Sheep (Level 2) for Neutral Victim at TempPoint3 facing Default building facing degrees
                          • Unit - Set the custom value of (Last created unit) to TempInteger
                          • Unit - Create 1 FeralSpiritEffect for Neutral Passive at TempPoint3 facing Default building facing degrees
                          • Animation - Change (Last created unit)'s size to (30.00%, 30.00%, 30.00%) of its original size
                          • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Trained unit)) Equal to Pig
                    • Then - Actions
                      • Unit - Order (Triggering unit) to train/upgrade to a Pig
                      • Unit - Remove (Trained unit) from the game
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • AniCount[TempInteger] Less than AnimalsMaximum
                        • Then - Actions
                          • Unit - Create 1 Pig for Neutral Victim at TempPoint2 facing Default building facing degrees
                          • Unit Group - Add (Last created unit) to AniPigs[TempInteger]
                          • Set AniCount[TempInteger] = (AniCount[TempInteger] + 1)
                          • Unit - Move (Last created unit) instantly to TempPoint2
                          • Unit - Set the custom value of (Last created unit) to TempInteger
                          • Unit - Order (Last created unit) to Move To TempPoint
                        • Else - Actions
                          • Set TempUnit = (Random unit from AniPigs[TempInteger])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • TempUnit Equal to No unit
                            • Then - Actions
                            • Else - Actions
                              • Set TempPoint3 = (Position of TempUnit)
                              • Unit Group - Remove TempUnit from AniPigs[TempInteger]
                              • Unit - Remove TempUnit from the game
                              • Unit - Create 1 Fat Pig (Level 2) for Neutral Victim at TempPoint3 facing Default building facing degrees
                              • Unit - Set the custom value of (Last created unit) to TempInteger
                              • Unit - Create 1 FeralSpiritEffect for Neutral Passive at TempPoint3 facing Default building facing degrees
                              • Animation - Change (Last created unit)'s size to (30.00%, 30.00%, 30.00%) of its original size
                              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Trained unit)) Equal to Rabbit
                        • Then - Actions
                          • Unit - Order (Triggering unit) to train/upgrade to a Rabbit
                          • Unit - Remove (Trained unit) from the game
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • AniCount[TempInteger] Less than AnimalsMaximum
                            • Then - Actions
                              • Unit - Create 1 Rabbit for Neutral Victim at TempPoint2 facing Default building facing degrees
                              • Unit Group - Add (Last created unit) to AniRabbits[TempInteger]
                              • Set AniCount[TempInteger] = (AniCount[TempInteger] + 1)
                              • Unit - Move (Last created unit) instantly to TempPoint2
                              • Unit - Set the custom value of (Last created unit) to TempInteger
                              • Unit - Order (Last created unit) to Move To TempPoint
                            • Else - Actions
                              • Set TempUnit = (Random unit from AniRabbits[TempInteger])
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • TempUnit Equal to No unit
                                • Then - Actions
                                • Else - Actions
                                  • Set TempPoint3 = (Position of TempUnit)
                                  • Unit Group - Remove TempUnit from AniRabbits[TempInteger]
                                  • Unit - Remove TempUnit from the game
                                  • Unit - Create 1 Green Rabbit (Level 2) for Neutral Victim at TempPoint3 facing Default building facing degrees
                                  • Unit - Set the custom value of (Last created unit) to TempInteger
                                  • Unit - Create 1 FeralSpiritEffect for Neutral Passive at TempPoint3 facing Default building facing degrees
                                  • Animation - Change (Last created unit)'s size to (30.00%, 30.00%, 30.00%) of its original size
                                  • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Trained unit)) Equal to Cow
                            • Then - Actions
                              • Unit - Order (Triggering unit) to train/upgrade to a Cow
                              • Unit - Remove (Trained unit) from the game
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • AniCount[TempInteger] Less than AnimalsMaximum
                                • Then - Actions
                                  • Unit - Create 1 Cow for Neutral Victim at TempPoint2 facing Default building facing degrees
                                  • Unit Group - Add (Last created unit) to AniCows[TempInteger]
                                  • Set AniCount[TempInteger] = (AniCount[TempInteger] + 1)
                                  • Unit - Move (Last created unit) instantly to TempPoint2
                                  • Unit - Set the custom value of (Last created unit) to TempInteger
                                  • Unit - Order (Last created unit) to Move To TempPoint
                                • Else - Actions
                                  • Set TempUnit = (Random unit from AniCows[TempInteger])
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • TempUnit Equal to No unit
                                    • Then - Actions
                                    • Else - Actions
                                      • Set TempPoint3 = (Position of TempUnit)
                                      • Unit Group - Remove TempUnit from AniCows[TempInteger]
                                      • Unit - Remove TempUnit from the game
                                      • Unit - Create 1 Brown Cow ( Level 2 ) for Neutral Victim at TempPoint3 facing Default building facing degrees
                                      • Unit - Set the custom value of (Last created unit) to TempInteger
                                      • Unit - Create 1 FeralSpiritEffect for Neutral Passive at TempPoint3 facing Default building facing degrees
                                      • Animation - Change (Last created unit)'s size to (30.00%, 30.00%, 30.00%) of its original size
                                      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                            • Else - Actions
          • Unit - Add Ghost (Visible) to (Last created unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions
          • Set TempPlayer = (Owner of (Trained unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Trained unit)) Equal to Random Mercenary
            • Then - Actions
              • Unit - Remove (Trained unit) from the game
              • Unit - Order (Triggering unit) to train/upgrade to a Random Mercenary
              • Set TempPoint2 = (Random point in revRect[(Random integer number between 1 and 30)])
              • -------- toto ma ostat ake je (jednotky) --------
              • Set TempInteger = (Random integer number between 1 and 14)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 10 (Light Blue) Food used) Less than 50
                • Then - Actions
                  • Unit - Create 1 mercType[TempInteger] for Player 10 (Light Blue) at TempPoint2 facing Default building facing degrees
                  • Unit - Change color of (Last created unit) to (Color of TempPlayer)
                  • AI - Ignore (Last created unit)'s guard position
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempInteger Equal to 7
                    • Then - Actions
                      • Unit Group - Add (Last created unit) to Trappers
                    • Else - Actions
                      • Do nothing
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in MercAttackGroup) Greater than 0
                    • Then - Actions
                    • Else - Actions
                      • Set TempInt = (Random integer number between 1 and 18)
                      • Set TempPoint1 = (Random point in wayRect[TempInt])
                      • Unit - Set level of RegionWanderer (Neutral Hostile) for (Last created unit) to TempInt
                      • Unit - Order (Last created unit) to Attack-Move To TempPoint1
                      • Unit - Create 1 TeleportEffect for Neutral Passive at TempPoint2 facing Default building facing degrees
                      • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Neutral Hostile Food used) Less than 60
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in MercAttackGroup) Greater than 0
                        • Then - Actions
                        • Else - Actions
                          • Set TempInt = (Random integer number between 1 and 18)
                          • Set TempPoint1 = (Random point in wayRect[TempInt])
                          • Unit - Add RegionWanderer (Neutral Hostile) to (Triggering unit)
                          • Unit - Order (Last created unit) to Attack-Move To TempPoint1
                          • Unit - Create 1 TeleportEffect for Neutral Passive at TempPoint2 facing Default building facing degrees
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                    • Else - Actions
              • Custom script: call RemoveLocation (udg_TempPoint1)
              • Custom script: call RemoveLocation (udg_TempPoint2)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Trained unit)) Equal to Peon
                • Then - Actions
                  • Set TempPoint = (Rally-Point of (Triggering unit) as a point)
                  • Set TempPoint1 = (Position of (Triggering unit))
                  • Set TempPoint2 = (TempPoint1 offset by 64.00 towards (Angle from TempPoint1 to TempPoint) degrees)
                  • Unit - Remove (Trained unit) from the game
                  • Unit - Create 1 Peon for (Owner of (Triggering unit)) at TempPoint2 facing Default building facing degrees
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Custom script: call RemoveLocation(udg_TempPoint1)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                • Else - Actions
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Second Part

JASS:
function Trig_Leaver_Func004Func003A takes nothing returns nothing
    call AdjustPlayerStateBJ( ( GetPlayerState(udg_Leaver, PLAYER_STATE_RESOURCE_GOLD) / CountPlayersInForceBJ(udg_Farmers) ), GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction

function Trig_Leaver_Func004Func005Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_UNDEAD) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Leaver_Func004Func005Func001C takes nothing returns boolean
    if ( not ( GetUnitUserData(GetEnumUnit()) == GetConvertedPlayerId(udg_Leaver) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Leaver_Func004Func005A takes nothing returns nothing
    if ( Trig_Leaver_Func004Func005Func001C() ) then
        if ( Trig_Leaver_Func004Func005Func001Func001C() ) then
            call UnitApplyTimedLifeBJ( 10.00, 'BTLF', GetEnumUnit() )
        else
        endif
    else
    endif
endfunction

function Trig_Leaver_Func004Func007C takes nothing returns boolean
    if ( not ( CountPlayersInForceBJ(udg_Farmers) < 4 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Leaver_Func004C takes nothing returns boolean
    if ( not ( IsPlayerInForce(udg_Leaver, udg_Farmers) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Leaver_Func005Func003A takes nothing returns nothing
    call AdjustPlayerStateBJ( ( GetPlayerState(udg_Leaver, PLAYER_STATE_RESOURCE_GOLD) / CountPlayersInForceBJ(udg_Hunters) ), GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction

function Trig_Leaver_Func005C takes nothing returns boolean
    if ( not ( IsPlayerInForce(udg_Leaver, udg_Hunters) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Leaver_Func008A takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

function Trig_Leaver_Actions takes nothing returns nothing
    call PlaySoundBJ( gg_snd_H01Uther07 )
    set udg_Leaver = GetTriggerPlayer()
    call DisplayTextToForce( GetPlayersAll(), ( ( udg_PlayerColor[GetConvertedPlayerId(udg_Leaver)] + ( GetPlayerName(udg_Leaver) + "|r" ) ) + " has left the game. His buildings are removed. His gold is distributed to others in his team." ) )
    if ( Trig_Leaver_Func004C() ) then
        call GroupRemoveUnitSimple( udg_Hero[GetConvertedPlayerId(udg_Leaver)], udg_FarmerHeroes )
        call ForceRemovePlayerSimple( udg_Leaver, udg_Farmers )
        call ForForce( udg_Farmers, function Trig_Leaver_Func004Func003A )
        set udg_TempGroup2 = GetUnitsOfPlayerAll(Player(bj_PLAYER_NEUTRAL_VICTIM))
        call ForGroupBJ( udg_TempGroup2, function Trig_Leaver_Func004Func005A )
        call DestroyGroup(udg_TempGroup2)
        if ( Trig_Leaver_Func004Func007C() ) then
            set udg_AnimalsMaximum = 300
        else
            set udg_AnimalsMaximum = 200
        endif
    else
    endif
    if ( Trig_Leaver_Func005C() ) then
        call GroupRemoveUnitSimple( udg_Hero[GetConvertedPlayerId(udg_Leaver)], udg_HunterHeroes )
        call ForceRemovePlayerSimple( udg_Leaver, udg_Hunters )
        call ForForce( udg_Hunters, function Trig_Leaver_Func005Func003A )
    else
    endif
    call RemoveUnit( udg_Hero[GetConvertedPlayerId(udg_Leaver)] )
    set udg_TempGroup = GetUnitsInRectOfPlayer(GetPlayableMapRect(), udg_Leaver)
    call ForGroupBJ( udg_TempGroup, function Trig_Leaver_Func008A )
    call DestroyGroup(udg_TempGroup)
    call ConditionalTriggerExecute( gg_trg_UpdateMultiboard )
endfunction

//===========================================================================
function InitTrig_Leaver takes nothing returns nothing
    set gg_trg_Leaver = CreateTrigger(  )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(0) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(1) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(2) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(3) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(4) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(5) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(6) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(7) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(8) )
    call TriggerRegisterPlayerEventLeave( gg_trg_Leaver, Player(11) )
    call TriggerAddAction( gg_trg_Leaver, function Trig_Leaver_Actions )
endfunction
  • Leaver
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
    • Actions
      • Sound - Play H01Uther07 <gen>
      • Set Leaver = (Triggering player)
      • Game - Display to (All players) the text: (((PlayerColor[(Player number of Leaver)] + (Name of Leaver)) + |r) + has left the game. His buildings are removed. His gold is distributed to others in his team.)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Leaver is in Farmers) Equal to True
        • Then - Actions
          • Unit Group - Remove Hero[(Player number of Leaver)] from FarmerHeroes
          • Player Group - Remove Leaver from Farmers
          • Player Group - Pick every player in Farmers and do (Actions)
            • Loop - Actions
              • Player - Add ((Leaver Current gold) / (Number of players in Farmers)) to (Picked player) Current gold
          • Set TempGroup2 = (Units owned by Neutral Victim)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to (Player number of Leaver)
              • ((Unit-type of (Picked unit)) is Undead) Equal to True
            • Then - Actions
              • Unit - Add a 10.00 second Generic expiration timer to (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of players in Farmers) Less than 4
                • Then - Actions
                  • Set AnimalsMaximum = 300
                • Else - Actions
                  • Set AnimalsMaximum = 200
            • Else - Actions
          • Custom script: call DestroyGroup(udg_TempGroup2)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Leaver is in Hunters) Equal to True
        • Then - Actions
          • Unit Group - Remove Hero[(Player number of Leaver)] from HunterHeroes
          • Player Group - Remove Leaver from Hunters
          • Player Group - Pick every player in Hunters and do (Actions)
            • Loop - Actions
              • Player - Add ((Leaver Current gold) / (Number of players in Hunters)) to (Picked player) Current gold
          • Set TempGroup2 = (Units owned by Neutral Victim)
          • Custom script: call DestroyGroup(udg_TempGroup2)
        • Else - Actions
      • Unit - Remove Hero[(Player number of Leaver)] from the game
      • Set TempGroup = (Units owned by Leaver)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Trigger - Run Update Multiboard <gen> (checking conditions)
JASS:
function Trig_Unit_Dies_Func001Func001Func001Func003002003 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) == true )
endfunction

function Trig_Unit_Dies_Func001Func001Func001Func006Func002A takes nothing returns nothing
    call UnitDamageTargetBJ( udg_TempUnit, GetEnumUnit(), 50.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
    call AddHeroXPSwapped( 2, udg_TempUnit2, true )
endfunction

function Trig_Unit_Dies_Func001Func001Func001Func006Func004A takes nothing returns nothing
    call UnitDamageTargetBJ( udg_TempUnit, GetEnumUnit(), 50.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
    call AddHeroXPSwapped( 1, udg_TempUnit2, true )
endfunction

function Trig_Unit_Dies_Func001Func001Func001Func006C takes nothing returns boolean
    if ( not ( udg_Progame == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func001Func001Func013002003 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_UNDEAD) == true )
endfunction

function Trig_Unit_Dies_Func001Func001Func001Func016A takes nothing returns nothing
    call UnitDamageTargetBJ( udg_TempUnit, GetEnumUnit(), 50.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
    call AddHeroXPSwapped( 2, udg_TempUnit2, true )
endfunction

function Trig_Unit_Dies_Func001Func001Func001C takes nothing returns boolean
    if ( not ( GetHeroLevel(GetKillingUnitBJ()) < 4 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetKillingUnitBJ(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func001C takes nothing returns boolean
    if ( not ( udg_Progame == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h00C' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'e003' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func003Func005C takes nothing returns boolean
    if ( not ( udg_BoxTowers[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] > 9 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func003C takes nothing returns boolean
    if ( not ( udg_BoxTowers[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] > 4 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func004C takes nothing returns boolean
    if ( ( GetUnitTypeId(GetDyingUnit()) == 'h00H' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetDyingUnit()) == 'h00I' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetDyingUnit()) == 'h00J' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002C takes nothing returns boolean
    if ( not Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func004C() ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002Func004C takes nothing returns boolean
    if ( not ( IsUnitAliveBJ(udg_Golem[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))]) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func002C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h003' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func003Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func003A takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func003Func001C() ) then
        call KillUnit( GetEnumUnit() )
    else
    endif
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_UNDEAD) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006Func001C takes nothing returns boolean
    if ( not ( GetUnitUserData(GetEnumUnit()) == GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit())) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006A takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006Func001C() ) then
        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006Func001Func001C() ) then
            call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetEnumUnit() )
        else
        endif
    else
    endif
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func010Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func010A takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func010Func001C() ) then
        call UnitDamageTargetBJ( GetKillingUnitBJ(), GetEnumUnit(), 99999.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
    else
    endif
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001Func001Func001C takes nothing returns boolean
    if ( not ( udg_Progame == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_UNDEAD) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001C takes nothing returns boolean
    if ( not ( GetUnitUserData(GetEnumUnit()) == GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit())) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013A takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001C() ) then
        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001Func001C() ) then
            if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013Func001Func001Func001C() ) then
                call UnitApplyTimedLifeBJ( 60.00, 'BTLF', GetEnumUnit() )
            else
                call DisplayTextToForce( GetPlayersAll(), GetUnitName(GetEnumUnit()) )
                call UnitApplyTimedLifeBJ( 15.00, 'BTLF', GetEnumUnit() )
            endif
        else
        endif
    else
    endif
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001C takes nothing returns boolean
    if ( not ( GetKillingUnitBJ() == null ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'n00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func001C takes nothing returns boolean
    if ( not ( GetDestructableTypeId(GetEnumDestructable()) == 'YTpc' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func002C takes nothing returns boolean
    if ( not ( GetDestructableTypeId(GetEnumDestructable()) == 'B000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func003C takes nothing returns boolean
    if ( not ( GetDestructableTypeId(GetEnumDestructable()) == 'B002' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func004C takes nothing returns boolean
    if ( not ( GetDestructableTypeId(GetEnumDestructable()) == 'B001' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003A takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func001C() ) then
        call RemoveUnit( GetDyingUnit() )
        call RemoveDestructable( GetEnumDestructable() )
        call CreateDestructableLoc( 'LTlt', udg_TempPoint2, 270.00, GetRandomReal(0.80, 1.20), GetRandomInt(0, 10) )
    else
    endif
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func002C() ) then
        call RemoveUnit( GetDyingUnit() )
        call RemoveDestructable( GetEnumDestructable() )
        call CreateDestructableLoc( 'ATtr', udg_TempPoint2, 270.00, GetRandomReal(0.80, 0.90), GetRandomInt(0, 10) )
    else
    endif
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func003C() ) then
        call RemoveUnit( GetDyingUnit() )
        call RemoveDestructable( GetEnumDestructable() )
        call CreateDestructableLoc( 'BTtw', udg_TempPoint2, 270.00, GetRandomReal(0.80, 1.20), GetRandomInt(0, 10) )
    else
    endif
    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003Func004C() ) then
        call RemoveUnit( GetDyingUnit() )
        call RemoveDestructable( GetEnumDestructable() )
        call CreateDestructableLoc( 'FTtw', udg_TempPoint2, 270.00, GetRandomReal(0.80, 1.20), GetRandomInt(0, 10) )
    else
    endif
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'efon' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001Func003C takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetDyingUnit()) == 'n000' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001Func006C takes nothing returns boolean
    if ( not ( IsUnitInGroup(GetDyingUnit(), udg_Trappers) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008Func001C takes nothing returns boolean
    if ( not ( IsUnitInGroup(GetDyingUnit(), udg_Mercenaries) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001Func008C takes nothing returns boolean
    if ( not ( IsUnitInGroup(GetDyingUnit(), udg_FarmerHeroes) != true ) ) then
        return false
    endif
    if ( not ( IsUnitInGroup(GetDyingUnit(), udg_HunterHeroes) != true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Func001C takes nothing returns boolean
    if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_UNDEAD) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Unit_Dies_Actions takes nothing returns nothing
    if ( Trig_Unit_Dies_Func001C() ) then
        if ( Trig_Unit_Dies_Func001Func001C() ) then
            if ( Trig_Unit_Dies_Func001Func001Func001C() ) then
                set udg_TempUnit2 = GetKillingUnitBJ()
                call AddHeroXPSwapped( 2, udg_TempUnit2, true )
                set udg_TempPoint1 = GetUnitLoc(GetDyingUnit())
                set udg_TempGroup = GetUnitsInRangeOfLocMatching(64.00, udg_TempPoint1, Condition(function Trig_Unit_Dies_Func001Func001Func001Func013002003))
                call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetKillingUnitBJ()), udg_TempPoint1, bj_UNIT_FACING )
                set udg_TempUnit = GetLastCreatedUnit()
                call ForGroupBJ( udg_TempGroup, function Trig_Unit_Dies_Func001Func001Func001Func016A )
                call RemoveUnit( udg_TempUnit )
                call DestroyGroup(udg_TempGroup)
                call RemoveLocation (udg_TempPoint1)
            else
                set udg_TempUnit2 = GetKillingUnitBJ()
                set udg_TempPoint1 = GetUnitLoc(GetDyingUnit())
                set udg_TempGroup = GetUnitsInRangeOfLocMatching(64.00, udg_TempPoint1, Condition(function Trig_Unit_Dies_Func001Func001Func001Func003002003))
                call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetKillingUnitBJ()), udg_TempPoint1, bj_UNIT_FACING )
                set udg_TempUnit = GetLastCreatedUnit()
                if ( Trig_Unit_Dies_Func001Func001Func001Func006C() ) then
                    call AddHeroXPSwapped( 2, udg_TempUnit2, true )
                    call ForGroupBJ( udg_TempGroup, function Trig_Unit_Dies_Func001Func001Func001Func006Func002A )
                else
                    call AddHeroXPSwapped( 1, udg_TempUnit2, true )
                    call ForGroupBJ( udg_TempGroup, function Trig_Unit_Dies_Func001Func001Func001Func006Func004A )
                endif
                call RemoveUnit( udg_TempUnit )
                call DestroyGroup(udg_TempGroup)
                call RemoveLocation (udg_TempPoint1)
            endif
        else
        endif
        set udg_TempInteger = GetUnitUserData(GetDyingUnit())
        set udg_AniCount[udg_TempInteger] = ( udg_AniCount[udg_TempInteger] - 1 )
        call GroupRemoveUnitSimple( GetDyingUnit(), udg_AniChicks[udg_TempInteger] )
        call GroupRemoveUnitSimple( GetDyingUnit(), udg_AniSheep[udg_TempInteger] )
        call GroupRemoveUnitSimple( GetDyingUnit(), udg_AniPigs[udg_TempInteger] )
    else
        if ( Trig_Unit_Dies_Func001Func008C() ) then
            if ( Trig_Unit_Dies_Func001Func008Func001C() ) then
                call GroupRemoveUnitSimple( GetDyingUnit(), udg_StuckGroup )
                call GroupRemoveUnitSimple( GetDyingUnit(), udg_CalmGroup )
                call GroupRemoveUnitSimple( GetDyingUnit(), udg_OAMercs )
                call GroupRemoveUnitSimple( GetDyingUnit(), udg_Mercenaries )
                if ( Trig_Unit_Dies_Func001Func008Func001Func006C() ) then
                    call GroupRemoveUnitSimple( GetDyingUnit(), udg_Trappers )
                else
                endif
            else
                if ( Trig_Unit_Dies_Func001Func008Func001Func001C() ) then
                    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func001C() ) then
                        call AddHeroXPSwapped( 40, udg_Hero[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))], true )
                    else
                        call AddHeroXPSwapped( 25, udg_Hero[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))], true )
                    endif
                    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002C() ) then
                        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002Func004C() ) then
                            call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())), "TRIGSTR_568" )
                            call PauseUnitBJ( true, udg_Golem[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] )
                            call SetUnitTimeScalePercent( udg_Golem[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))], 0.00 )
                        else
                        endif
                    else
                        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002Func001C() ) then
                            call RemoveUnit( GetDyingUnit() )
                        else
                        endif
                        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002C() ) then
                            set udg_BoxTowers[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] = ( udg_BoxTowers[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] - 1 )
                            set udg_TempPlayer = GetOwningPlayer(GetDyingUnit())
                            if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func003C() ) then
                                call SetPlayerUnitAvailableBJ( 'h00H', false, udg_TempPlayer )
                                if ( Trig_Unit_Dies_Func001Func008Func001Func001Func002Func002Func003Func005C() ) then
                                    call SetPlayerUnitAvailableBJ( 'h00J', true, udg_TempPlayer )
                                    call SetPlayerUnitAvailableBJ( 'h00I', false, udg_TempPlayer )
                                else
                                    call SetPlayerUnitAvailableBJ( 'h00I', true, udg_TempPlayer )
                                    call SetPlayerUnitAvailableBJ( 'h00J', false, udg_TempPlayer )
                                endif
                            else
                                call SetPlayerUnitAvailableBJ( 'h00H', true, udg_TempPlayer )
                                call SetPlayerUnitAvailableBJ( 'h00I', false, udg_TempPlayer )
                                call SetPlayerUnitAvailableBJ( 'h00J', false, udg_TempPlayer )
                            endif
                        else
                        endif
                    endif
                else
                    if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003C() ) then
                        call DisplayTextToForce( GetPlayersAll(), ( udg_PlayerColor[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnitBJ()))] + ( GetPlayerName(GetOwningPlayer(GetKillingUnitBJ())) + ( "|r" + ( " has destroyed " + ( udg_PlayerColor[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] + ( GetPlayerName(GetOwningPlayer(GetDyingUnit())) + ( "|r" + "'s Golem!" ) ) ) ) ) ) ) )
                        call PlaySoundBJ( gg_snd_ClanInvitation )
                        call GroupRemoveUnitSimple( GetDyingUnit(), udg_Golems )
                        call SetPlayerUnitAvailableBJ( 'hatw', true, GetOwningPlayer(GetDyingUnit()) )
                        set udg_TempPlayer = GetOwningPlayer(GetDyingUnit())
                        set udg_GolemAttSpeedTech[GetConvertedPlayerId(udg_TempPlayer)] = 0.00
                        set udg_GolemDamageTech[GetConvertedPlayerId(udg_TempPlayer)] = 0.00
                        set udg_GolemHPTech[GetConvertedPlayerId(udg_TempPlayer)] = 0.00
                        call ConditionalTriggerExecute( gg_trg_EnableLeft )
                        call ConditionalTriggerExecute( gg_trg_EnableRight )
                        call ConditionalTriggerExecute( gg_trg_EnableTorso )
                    else
                        if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001C() ) then
                            set udg_TempPoint2 = GetUnitLoc(GetDyingUnit())
                            call EnumDestructablesInCircleBJ( 100.00, udg_TempPoint2, function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func003A )
                             call RemoveLocation (udg_TempPoint2)
                        else
                            if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001C() ) then
                                if ( Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001C() ) then
                                    call KillUnit( udg_Golem[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))] )
                                    set udg_TempGroup = GetUnitsOfPlayerAll(GetOwningPlayer(GetDyingUnit()))
                                    call ForGroupBJ( udg_TempGroup, function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func003A )
                                    call DestroyGroup(udg_TempGroup)
                                    set udg_TempGroup2 = GetUnitsOfPlayerAll(Player(bj_PLAYER_NEUTRAL_VICTIM))
                                    call ForGroupBJ( udg_TempGroup2, function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func006A )
                                    call DestroyGroup(udg_TempGroup2)
                                else
                                    call UnitDamageTargetBJ( GetKillingUnitBJ(), udg_Golem[GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))], 999999.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
                                    set udg_TempGroup = GetUnitsOfPlayerAll(GetOwningPlayer(GetDyingUnit()))
                                    call ForGroupBJ( udg_TempGroup, function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func010A )
                                    call DestroyGroup(udg_TempGroup)
                                    set udg_TempGroup2 = GetUnitsOfPlayerAll(Player(bj_PLAYER_NEUTRAL_VICTIM))
                                    call ForGroupBJ( udg_TempGroup2, function Trig_Unit_Dies_Func001Func008Func001Func001Func003Func001Func001Func001Func013A )
                                    call DestroyGroup(udg_TempGroup2)
                                endif
                            else
                            endif
                        endif
                    endif
                endif
            endif
        else
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Unit_Dies takes nothing returns nothing
    set gg_trg_Unit_Dies = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Unit_Dies, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Unit_Dies, function Trig_Unit_Dies_Actions )
endfunction
  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) is Undead) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Killing unit) is A Hero) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Hero level of (Killing unit)) Less than 4
                • Then - Actions
                  • Set TempUnit2 = (Killing unit)
                  • Hero - Add 2 experience to TempUnit2, Show level-up graphics
                  • Set TempPoint1 = (Position of (Dying unit))
                  • Set TempGroup = (Units within 64.00 of TempPoint1 matching (((Unit-type of (Matching unit)) is Undead) Equal to True))
                  • Unit - Create 1 DummyCaster for (Owner of (Killing unit)) at TempPoint1 facing Default building facing degrees
                  • Set TempUnit = (Last created unit)
                  • Unit Group - Pick every unit in TempGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause TempUnit to damage (Picked unit), dealing 50.00 damage of attack type Normal and damage type Normal
                      • Hero - Add 2 experience to TempUnit2, Show level-up graphics
                  • Unit - Remove TempUnit from the game
                  • Custom script: call DestroyGroup(udg_TempGroup)
                  • Custom script: call RemoveLocation (udg_TempPoint1)
                • Else - Actions
                  • Set TempUnit2 = (Killing unit)
                  • Set TempPoint1 = (Position of (Dying unit))
                  • Set TempGroup = (Units within 64.00 of TempPoint1 matching (((Unit-type of (Matching unit)) is Undead) Equal to True))
                  • Unit - Create 1 DummyCaster for (Owner of (Killing unit)) at TempPoint1 facing Default building facing degrees
                  • Set TempUnit = (Last created unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Progame Equal to True
                    • Then - Actions
                      • Hero - Add 2 experience to TempUnit2, Show level-up graphics
                      • Unit Group - Pick every unit in TempGroup and do (Actions)
                        • Loop - Actions
                          • Unit - Cause TempUnit to damage (Picked unit), dealing 50.00 damage of attack type Normal and damage type Normal
                          • Hero - Add 2 experience to TempUnit2, Show level-up graphics
                    • Else - Actions
                      • Hero - Add 1 experience to TempUnit2, Show level-up graphics
                      • Unit Group - Pick every unit in TempGroup and do (Actions)
                        • Loop - Actions
                          • Unit - Cause TempUnit to damage (Picked unit), dealing 50.00 damage of attack type Normal and damage type Normal
                          • Hero - Add 1 experience to TempUnit2, Show level-up graphics
                  • Unit - Remove TempUnit from the game
                  • Custom script: call DestroyGroup(udg_TempGroup)
                  • Custom script: call RemoveLocation (udg_TempPoint1)
            • Else - Actions
          • Set TempInteger = (Custom value of (Dying unit))
          • Set AniCount[TempInteger] = (AniCount[TempInteger] - 1)
          • Unit Group - Remove (Dying unit) from AniChicks[TempInteger]
          • Unit Group - Remove (Dying unit) from AniSheep[TempInteger]
          • Unit Group - Remove (Dying unit) from AniPigs[TempInteger]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) is in FarmerHeroes) Not equal to True
              • ((Dying unit) is in HunterHeroes) Not equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Dying unit) is in Mercenaries) Equal to True
                • Then - Actions
                  • Unit Group - Remove (Dying unit) from StuckGroup
                  • Unit Group - Remove (Dying unit) from CalmGroup
                  • Unit Group - Remove (Dying unit) from OAMercs
                  • Unit Group - Remove (Dying unit) from Mercenaries
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Dying unit) is in Trappers) Equal to True
                    • Then - Actions
                      • Unit Group - Remove (Dying unit) from Trappers
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Dying unit) is A structure) Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Progame Equal to True
                        • Then - Actions
                          • Hero - Add 40 experience to Hero[(Player number of (Owner of (Killing unit)))], Show level-up graphics
                        • Else - Actions
                          • Hero - Add 25 experience to Hero[(Player number of (Owner of (Killing unit)))], Show level-up graphics
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Dying unit)) Equal to Golem Factory
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Golem[(Player number of (Owner of (Dying unit)))] is alive) Equal to True
                            • Then - Actions
                              • Game - Display to (Player group((Owner of (Dying unit)))) the text: Your golem factory ...
                              • Unit - Pause Golem[(Player number of (Owner of (Dying unit)))]
                              • Animation - Change Golem[(Player number of (Owner of (Dying unit)))]'s animation speed to 0.00% of its original speed
                            • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Unit-type of (Dying unit)) Equal to Stone Wall
                                  • (Unit-type of (Dying unit)) Equal to Bombard Tower
                            • Then - Actions
                              • Unit - Remove (Dying unit) from the game
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Unit-type of (Dying unit)) Equal to Box-Throwing Tower
                                  • (Unit-type of (Dying unit)) Equal to Box-Throwing Tower
                                  • (Unit-type of (Dying unit)) Equal to Box-Throwing Tower
                            • Then - Actions
                              • Set BoxTowers[(Player number of (Owner of (Dying unit)))] = (BoxTowers[(Player number of (Owner of (Dying unit)))] - 1)
                              • Set TempPlayer = (Owner of (Dying unit))
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • BoxTowers[(Player number of (Owner of (Dying unit)))] Greater than 4
                                • Then - Actions
                                  • Player - Make Box-Throwing Tower Unavailable for training/construction by TempPlayer
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • BoxTowers[(Player number of (Owner of (Dying unit)))] Greater than 9
                                    • Then - Actions
                                      • Player - Make Box-Throwing Tower Available for training/construction by TempPlayer
                                      • Player - Make Box-Throwing Tower Unavailable for training/construction by TempPlayer
                                    • Else - Actions
                                      • Player - Make Box-Throwing Tower Available for training/construction by TempPlayer
                                      • Player - Make Box-Throwing Tower Unavailable for training/construction by TempPlayer
                                • Else - Actions
                                  • Player - Make Box-Throwing Tower Available for training/construction by TempPlayer
                                  • Player - Make Box-Throwing Tower Unavailable for training/construction by TempPlayer
                                  • Player - Make Box-Throwing Tower Unavailable for training/construction by TempPlayer
                            • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Unit-type of (Dying unit)) Equal to |cffdaa520Flesh|r Golem
                              • (Unit-type of (Dying unit)) Equal to |cffa52a2aRock|r Golem
                              • (Unit-type of (Dying unit)) Equal to |cff696969Iron|r Golem
                              • (Unit-type of (Dying unit)) Equal to |cff00ffffCrystal|r Golem
                              • (Unit-type of (Dying unit)) Equal to |cff9370dbShadow|r Golem
                        • Then - Actions
                          • Game - Display to (All players) the text: (((PlayerColor[(Player number of (Owner of (Killing unit)))] + (Name of (Owner of (Killing unit)))) + |r) + ( has destroyed + (((PlayerColor[(Player number of (Owner of (Dying unit)))] + (Name of (Owner of (Dying unit)))) + |r) + 's Golem !)))
                          • Sound - Play ClanInvitation <gen>
                          • Unit Group - Remove (Dying unit) from Golems
                          • Player - Make |cffdaa520Flesh|r Golem Available for training/construction by (Owner of (Dying unit))
                          • Set TempPlayer = (Owner of (Dying unit))
                          • Set GolemAttSpeedTech[(Player number of TempPlayer)] = 0.00
                          • Set GolemDamageTech[(Player number of TempPlayer)] = 0.00
                          • Set GolemHPTech[(Player number of TempPlayer)] = 0.00
                          • Unit - Remove DummyGolem[(Player number of TempPlayer)] from the game
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Dying unit)) Equal to Treant
                            • Then - Actions
                              • Set TempPoint2 = (Position of (Dying unit))
                              • Destructible - Pick every destructible within 100.00 of TempPoint2 and do (Actions)
                                • Loop - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground) (Large)
                                    • Then - Actions
                                      • Unit - Remove (Dying unit) from the game
                                      • Destructible - Remove (Picked destructible)
                                      • Destructible - Create a Summer Tree Wall at TempPoint2 facing 270.00 with scale (Random real number between 0.80 and 1.20) and variation (Random integer number between 0 and 10)
                                    • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground) (Large)
                                    • Then - Actions
                                      • Unit - Remove (Dying unit) from the game
                                      • Destructible - Remove (Picked destructible)
                                      • Destructible - Create a Ashenvale Tree Wall at TempPoint2 facing 270.00 with scale (Random real number between 0.80 and 0.90) and variation (Random integer number between 0 and 10)
                                    • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground) (Large)
                                    • Then - Actions
                                      • Unit - Remove (Dying unit) from the game
                                      • Destructible - Remove (Picked destructible)
                                      • Destructible - Create a Barrens Tree Wall at TempPoint2 facing 270.00 with scale (Random real number between 0.80 and 1.20) and variation (Random integer number between 0 and 10)
                                    • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Destructible-type of (Picked destructible)) Equal to Pathing Blocker (Ground) (Large)
                                    • Then - Actions
                                      • Unit - Remove (Dying unit) from the game
                                      • Destructible - Remove (Picked destructible)
                                      • Destructible - Create a Fall Tree Wall at TempPoint2 facing 270.00 with scale (Random real number between 0.80 and 1.20) and variation (Random integer number between 0 and 10)
                                    • Else - Actions
                              • Custom script: call RemoveLocation (udg_TempPoint2)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Unit-type of (Dying unit)) Equal to Farmer's Bounty (Female)
                                • Then - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Killing unit) Equal to No unit
                                    • Then - Actions
                                      • Unit - Kill Golem[(Player number of (Owner of (Dying unit)))]
                                      • Set TempGroup = (Units owned by (Owner of (Dying unit)))
                                      • Unit Group - Pick every unit in TempGroup and do (Actions)
                                        • Loop - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • ((Unit-type of (Picked unit)) is Undead) Equal to True
                                            • Then - Actions
                                              • Unit - Kill (Picked unit)
                                            • Else - Actions
                                      • Custom script: call DestroyGroup(udg_TempGroup)
                                      • Set TempGroup2 = (Units owned by Neutral Victim)
                                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                                        • Loop - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Custom value of (Picked unit)) Greater than (Player number of (Owner of (Dying unit)))
                                            • Then - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • ((Unit-type of (Picked unit)) is Undead) Equal to True
                                                • Then - Actions
                                                  • Unit - Add a 5.00 second Generic expiration timer to (Picked unit)
                                                • Else - Actions
                                            • Else - Actions
                                      • Custom script: call DestroyGroup(udg_TempGroup2)
                                    • Else - Actions
                                      • Unit - Cause (Killing unit) to damage Golem[(Player number of (Owner of (Dying unit)))], dealing 999999.00 damage of attack type Normal and damage type Normal
                                      • Set TempGroup = (Units owned by (Owner of (Dying unit)))
                                      • Unit Group - Pick every unit in TempGroup and do (Actions)
                                        • Loop - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • ((Unit-type of (Picked unit)) is A structure) Equal to True
                                            • Then - Actions
                                              • Unit - Cause (Killing unit) to damage (Picked unit), dealing 99999.00 damage of attack type Siege and damage type Normal
                                            • Else - Actions
                                      • Custom script: call DestroyGroup(udg_TempGroup)
                                      • Set TempGroup2 = (Units owned by Neutral Victim)
                                      • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                                        • Loop - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Custom value of (Picked unit)) Greater than (Player number of (Owner of (Dying unit)))
                                            • Then - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • ((Unit-type of (Picked unit)) is Undead) Equal to True
                                                • Then - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • Progame Equal to True
                                                    • Then - Actions
                                                      • Unit - Add a 60.00 second Generic expiration timer to (Picked unit)
                                                    • Else - Actions
                                                      • Game - Display to (All players) the text: (Name of (Picked unit))
                                                      • Unit - Add a 15.00 second Generic expiration timer to (Picked unit)
                                                • Else - Actions
                                            • Else - Actions
                                      • Custom script: call DestroyGroup(udg_TempGroup2)
                                • Else - Actions
            • Else - Actions
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Sadly these are way too huge for me to spend the time to follow...

The only thing I can hear is:

Prof Oak Echoes: Anything you use twice or more store in a variable. Don't use Do Nothing. Always use Triggering Unit.

#deathismyfriend

I don't think you have it here, but just incase anyone might have forgotten, don't use Integer A/B!! Its less efficient, use your own integer.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Thanks you all . First, Those are not my triggers , I just took permission to edit them . And It's a real pain in ass while converting , as poke said , they are really huge . I learned JASS from them so of course I got mistakes :/ .
U would be glade if some one only follows the 2nd category only :)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Although poke has said some things for fixes it doesn't really help with the problem. sry poke

As for the solution it helps if we know what the problem actually is. What happens ? What is supposed to happen ?

You leak locations and this needs some rework. If you do the same actions in an ITE then combine them.
__________________
Ok Peasant builds farms , These farms are types , Each farm trains a type of animal .
For example Chicken farms spawn chickens .
When the peasant dies , His farms are destroyed AND chickens are not . but they die after 15 seconds if it is easy mode , and they expire after 60 if there is pro mode .
If Farms stay aive enough , till they reach max number of animals ( which is 200 or 300 , depends on mode ) . They start upgrading , to level 2 .Livestock is upgraded one by one ( when the farm spawns chicken , if it is max animals , one of chicken salive becoems golden chicken level 2. else another chicken will be spawned .
BUT THE PROBLEMS :
1- Most players don't have their animals upgraded when they reach max animals .
2- Friendly Kill should destroy farms and kill chickens , It doesn't .
3- When some one leaves , or dies , His animals should die , but another player's animals die :/ .

NOTE: Animals are Neutral Passive .
NOTE 2 : Owner Of an Animal is detected by Custom value and player's number .
 
Easiest way to fix this will be to rework the whole thing.

Use an integer counter to count the number of chickens that are alive ( to see if they are maxed)
Use unit group to store the different things for players. Example farmGroupPlayer[ player number]
Use a unit group keyed to the player for the chickens. Like above.
Use a trigger when player leaves / dies loop through the unit group and kill all units for that player.

Not sure what you mean by friendly kill ?
If you mean friendly mode. Were friendly players can kill your stuff make all spells not able to attack mechanical. Then when friendly mode selected pick all units and remove the mechanical classification from the units. You will need a trigger that runs when unit enters map to remove the classification as well.
 
Status
Not open for further replies.
Top