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

Attack Ground Event 1.01

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Attack Ground Event

Description
An event to detect every instance of attack ground. Replaces regular attack ground for the units that use it.

It works by replacing attack ground with two abilities - one to detect player orders, and another for the actual attack.

Additional Features:
  • Accuracy. Attacks can be set to land in a random location around the target point, and this point is newly randomised every time the unit fires. Random point scales with distance between unit and target.
  • Group attacks. When a group is ordered to attack together, they can be set to space their attacks according to their position from the center of the group.
  • Choose between missile targeting and artillery targeting for unit-target attacks. (missile attacks lead their targets, artillery attacks land at the target's position on attack launch)

Drawbacks:
  • Does not register attack speed, damage or any other modifier bonuses.
  • Cooldown can be inaccurate at very low cooldowns. Currently it's set at 0.05, but this can be changed.
  • When attacking a unit in artillery mode, the artillery will continue to attack the point where the unit was when first targetted. (fix coming soon)

To use the event, use Game - Value of real variable. There are 4 events:
1.00 - Projectile is launched.
2.00 - Attack is started.
3.00 - Unit is ordered.
4.00 - Attack finishes. (only captures AGES_EventUnit)

With associated event response variables:
EventUnit - Unit performing the attack.
EventTarget - Target location of attack.

Installation
Readme in the triggers.

Triggers

  • AGES Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set AGES_Table = (Last created hashtable)
      • -------- ------ --------
      • -------- System Ability --------
      • -------- ------ --------
      • Set AGES_AttackAbility = Attack Ground (Attack Order)
      • Set AGES_AttackAbilityOrder = channel
      • -------- ------ --------
      • -------- Options --------
      • -------- ------ --------
      • -------- Group Attack: All units selected will attack ground when ordered. When disabled, you have to g-click once for each unit. --------
      • -------- Group Spacing: Units selected will fire so that their attacks will land in the same formation as the units are in. --------
      • -------- Artillery Targeting: Units will use their attack ground instead of their missile attack. --------
      • Set AGES_GroupAttackEnabled = True
      • Set AGES_GroupAttackSpacingEnabled = True
      • Set AGES_ArtilleryTargetingEnabled = True
      • -------- ------ --------
      • -------- Units that use the system --------
      • -------- ------ --------
      • Set AGES_SaveUnitType = Mortar Team
      • Set AGES_SaveDummyType = Mortar Team (Attack Ground)
      • Set AGES_SaveAbility = Attack Ground (Icon) (Mortar Team)
      • Set AGES_SaveOrderString = cloudoffog
      • Set AGES_SaveAccuracy = 0.00
      • Set AGES_SaveCooldown = 2.50
      • Set AGES_SaveMaxRange = 1150.00
      • Set AGES_SaveMinRange = 250.00
      • Trigger - Run AGES Register <gen> (ignoring conditions)
      • -------- ------ --------
  • AGES Register
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_tempInt = udg_AGES_SaveUnitType
      • Set tempString2 = (String(AGES_SaveDummyType))
      • Hashtable - Save tempString2 as 0 of tempInt in AGES_Table
      • Custom script: set udg_tempInt2 = udg_AGES_SaveAbility
      • Hashtable - Save tempInt2 as 1 of tempInt in AGES_Table
      • Hashtable - Save True as 2 of tempInt in AGES_Table
      • Hashtable - Save AGES_SaveOrderString as 3 of tempInt in AGES_Table
      • Hashtable - Save AGES_SaveAccuracy as 4 of tempInt in AGES_Table
      • Hashtable - Save AGES_SaveCooldown as 5 of tempInt in AGES_Table
      • Hashtable - Save AGES_SaveMaxRange as 6 of tempInt in AGES_Table
      • Hashtable - Save AGES_SaveMinRange as 7 of tempInt in AGES_Table


  • AGES Order Event
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set tempUnitTrigger = (Triggering unit)
      • -------- Get unit type and ability ids --------
      • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitTrigger)
      • -------- Check if the order matches the unit's attack order --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 3 of tempInt from AGES_Table) Equal to (String((Issued order)))
        • Then - Actions
          • Unit Group - Add tempUnitTrigger to AGES_AttackingGroup
          • -------- Create the event --------
          • Set AGES_EventUnit = tempUnitTrigger
          • Set AGES_EventTargetPoint = (Target point of issued order)
          • Set AGES_EventOrder = (String((Issued order)))
          • Set AGES_Event = 3.00
          • Set AGES_Event = 0.00
          • -------- Order the actual attack ability --------
          • Custom script: call IssuePointOrderLoc( udg_tempUnitTrigger, udg_AGES_AttackAbilityOrder, udg_AGES_EventTargetPoint )
        • Else - Actions
  • AGES Start Event
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to AGES_AttackAbility
    • Actions
      • Set tempUnitTrigger = (Triggering unit)
      • -------- Create the event --------
      • Set AGES_EventUnit = tempUnitTrigger
      • Set AGES_EventTargetPoint = (Target point of ability being cast)
      • Set AGES_Event = 2.00
      • Set AGES_Event = 0.00
      • -------- Check minimum range --------
      • Set tempLoc = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between tempLoc and AGES_EventTargetPoint) Greater than (Load 7 of tempInt from AGES_Table)
        • Then - Actions
          • -------- Check if unit is in cooldown --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tempUnitTrigger is in AGES_CDGroup) Equal to True
              • (tempUnitTrigger is in AGES_AttackingGroup) Equal to False
            • Then - Actions
              • Trigger - Turn off AGES Cancel Attack <gen>
              • Unit - Order tempUnitTrigger to Stop
              • Trigger - Turn on AGES Cancel Attack <gen>
            • Else - Actions
              • -------- All checks passed, continue --------
        • Else - Actions
          • Trigger - Turn off AGES Cancel Attack <gen>
          • Unit - Order tempUnitTrigger to Stop
          • Trigger - Turn on AGES Cancel Attack <gen>
  • AGES Attack Event
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AGES_AttackAbility
    • Actions
      • Set tempUnitTrigger = (Triggering unit)
      • Set tempPlayer = (Owner of tempUnitTrigger)
      • -------- Get unit type and ability ids --------
      • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitTrigger)
      • -------- Start the unit's attack cooldown --------
      • Set AGES_CDIndex = (AGES_CDIndex + 1)
      • Set AGES_CDUnit[AGES_CDIndex] = tempUnitTrigger
      • Set AGES_CDTime[AGES_CDIndex] = (Load 5 of tempInt from AGES_Table)
      • Set AGES_CDTarget[AGES_CDIndex] = (Target point of ability being cast)
      • Set AGES_CDAutoAttack[AGES_CDIndex] = True
      • Unit Group - Add tempUnitTrigger to AGES_CDGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AGES Cooldown <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on AGES Cooldown <gen>
        • Else - Actions
      • -------- Create the event --------
      • Set AGES_EventUnit = tempUnitTrigger
      • Set AGES_EventTargetPoint = (Target point of ability being cast)
      • Set AGES_EventOrder = (Load 3 of tempInt from AGES_Table)
      • Set AGES_Event = 1.00
      • Set AGES_Event = 0.00
      • -------- Create a dummy to attack the point --------
      • Set tempLoc = (Position of tempUnitTrigger)
      • Set tempReal = (Load 4 of tempInt from AGES_Table)
      • Set tempReal = (tempReal x ((Distance between tempLoc and AGES_EventTargetPoint) / (Load 6 of tempInt from AGES_Table)))
      • Set tempLocTarget = (AGES_EventTargetPoint offset by (Random real number between 0.00 and tempReal) towards (Random angle) degrees)
      • Unit - Create 1 (Unit-type((Load 0 of tempInt from AGES_Table))) for tempPlayer at tempLoc facing (Facing of tempUnitTrigger) degrees
      • Set tempUnitCreated = (Last created unit)
      • Unit - Order tempUnitCreated to Attack Ground tempLocTarget
      • Unit - Add a 0.15 second Generic expiration timer to tempUnitCreated
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: call RemoveLocation(udg_tempLocTarget)
  • AGES Finish Event
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Set tempUnitTrigger = (Triggering unit)
      • Set tempPlayer = (Owner of tempUnitTrigger)
      • -------- Get unit type and ability ids --------
      • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitTrigger)
      • Custom script: set udg_tempInt2 = GetSpellAbilityId()
      • -------- Check if the ability matches the unit's attackground --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempInt2 Equal to (Load 1 of tempInt from AGES_Table)
        • Then - Actions
          • -------- Create the event --------
          • Set AGES_EventUnit = tempUnitTrigger
          • Set AGES_Event = 4.00
          • Set AGES_Event = 0.00
        • Else - Actions


  • AGES Cooldown
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer ForC) from 1 to AGES_CDIndex, do (Actions)
        • Loop - Actions
          • -------- Reduce cooldown remaining --------
          • Set AGES_CDTime[ForC] = (AGES_CDTime[ForC] - 0.05)
          • -------- Check if cooldown is expired and remove unit from group --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AGES_CDTime[ForC] Less than or equal to 0.00
            • Then - Actions
              • Unit Group - Remove AGES_CDUnit[ForC] from AGES_CDGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (AGES_CDGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AGES_CDAutoAttack[ForC] Equal to True
                • Then - Actions
                  • Custom script: call IssuePointOrderLoc( udg_AGES_CDUnit[udg_ForC], udg_AGES_AttackAbilityOrder, udg_AGES_CDTarget[udg_ForC] )
                • Else - Actions
              • -------- Move all units after this unit in the list down one space --------
              • For each (Integer ForB) from ForC to AGES_CDIndex, do (Actions)
                • Loop - Actions
                  • Set AGES_CDUnit[ForB] = AGES_CDUnit[(ForB + 1)]
                  • Set AGES_CDTime[ForB] = AGES_CDTime[(ForB + 1)]
                  • Set AGES_CDTarget[ForB] = AGES_CDTarget[(ForB + 1)]
                  • Set AGES_CDAutoAttack[ForB] = AGES_CDAutoAttack[(ForB + 1)]
              • Custom script: call RemoveLocation(udg_AGES_CDTarget[udg_AGES_CDIndex])
              • Set AGES_CDIndex = (AGES_CDIndex - 1)
            • Else - Actions
  • AGES Group Attack
    • Events
      • Game - AGES_Event becomes Equal to 3.00
    • Conditions
      • AGES_GroupAttackEnabled Equal to True
    • Actions
      • Set tempPlayer = (Owner of AGES_EventUnit)
      • -------- Check if the player ordered it --------
      • Custom script: set udg_tempInt = GetUnitTypeId(udg_AGES_EventUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 3 of tempInt from AGES_Table) Equal to AGES_EventOrder
        • Then - Actions
          • -------- Get the mean location of the group --------
          • Set tempX = 0.00
          • Set tempY = 0.00
          • Set tempGroup = (Units currently selected by tempPlayer)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (AGES_EventUnit is in tempGroup) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in tempGroup and do (Actions)
                • Loop - Actions
                  • Custom script: set udg_tempX = udg_tempX + GetUnitX(GetEnumUnit())
                  • Custom script: set udg_tempY = udg_tempY + GetUnitY(GetEnumUnit())
              • Set tempLocCenterOfGroup = (Point((tempX / (Real((Number of units in tempGroup)))), (tempY / (Real((Number of units in tempGroup))))))
              • Unit Group - Pick every unit in tempGroup and do (Actions)
                • Loop - Actions
                  • Set tempUnitPicked = (Picked unit)
                  • -------- Get the ability order from the picked unit --------
                  • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitPicked)
                  • Set tempString2 = (Load 3 of tempInt from AGES_Table)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AGES_GroupAttackSpacingEnabled Equal to True
                    • Then - Actions
                      • Custom script: set udg_tempX = GetUnitX(GetEnumUnit()) - GetLocationX(udg_tempLocCenterOfGroup)
                      • Custom script: set udg_tempY = GetUnitY(GetEnumUnit()) - GetLocationY(udg_tempLocCenterOfGroup)
                      • Custom script: set udg_tempLocTarget = Location(GetLocationX(udg_AGES_EventTargetPoint) + udg_tempX, GetLocationY(udg_AGES_EventTargetPoint) + udg_tempY)
                    • Else - Actions
                      • Set tempLocTarget = AGES_EventTargetPoint
                  • -------- Order the attack --------
                  • Trigger - Turn off (This trigger)
                  • Custom script: call IssuePointOrderLoc( udg_tempUnitPicked, udg_AGES_AttackAbilityOrder, udg_tempLocTarget )
                  • Trigger - Turn on (This trigger)
                  • Custom script: call RemoveLocation(udg_tempLocTarget)
              • Custom script: call RemoveLocation(udg_tempLocCenterOfGroup)
            • Else - Actions
          • Custom script: call DestroyGroup(udg_tempGroup)
        • Else - Actions
  • Events
    • Unit - A unit Is issued an order targeting an object
    • Unit - A unit Is issued an order targeting a point
    • Unit - A unit Is issued an order with no target
  • AGES Artillery Targeting
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • AGES_ArtilleryTargetingEnabled Equal to True
    • Actions
      • Set tempUnitTrigger = (Attacking unit)
      • -------- Get unit type and ability ids --------
      • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitTrigger)
      • -------- Check if the order matches the unit's attack order --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 2 of tempInt from AGES_Table) Equal to True
        • Then - Actions
          • Set tempLoc = (Position of (Attacked unit))
          • Set tempString = (Load 3 of tempInt from AGES_Table)
          • Custom script: call IssuePointOrderLoc( udg_tempUnitTrigger, udg_tempString, udg_tempLoc )
          • Custom script: call RemoveLocation(udg_tempLoc)
        • Else - Actions


Changelog
1.01
  • Improved code in various places. (thanks Maker)

Keywords:
attack ground, attack, ground, event, attack ground event, attack event, artillery, artillery attack, artillery event, random artillery
Contents

Attack Ground Event 1.01 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Required changes: There is a location leak in AGES Start Event The system bugs when units are ordered to attack a location where they have no vision Required changes: Turn...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Reviewed by Maker, Attack Ground Event 1.01, 29th Jan 2012

Required changes:
  • There is a location leak in AGES Start Event
  • The system bugs when units are ordered to attack a location where they have no vision

Reviewed by Maker, Attack Ground Event 1.00, 28th Jan 2012

Required changes:
  • Turn off Ages Cooldown when it is not needed.

Suggested changes:
  • IssuePointOrderLocBJ->IssuePointOrderLoc
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • (tempUnitTrigger is in AGES_CDGroup) Equal to True
            • (tempUnitTrigger is in AGES_AttackingGroup) Equal to False
      • Then - Actions
      • Else - Actions
    ->
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (tempUnitTrigger is in AGES_CDGroup) Equal to True
        • (tempUnitTrigger is in AGES_AttackingGroup) Equal to False
      • Then - Actions
      • Else - Actions
  • Start/Attack/Finish event triggers could be off when there are no active attacks.
    • Set tempUnitType1 = (Unit-type of tempUnitTrigger)
    • Custom script: set udg_tempInt = udg_tempUnitType1
    ->
    • Custom script: set udg_tempInt = GetUnitTypeId(udg_tempUnitTrigger)
    And there's GetSpellAbilityId also.
  • In Cancel attack, exit the loop when correct unit is found.
    You could turn this trigger off when it is not needed.
  • The dummies remain too long after they die, set their
    death type to Can't raise, doesn not decay

This system could be useful. Drawbacks are that the attacking unit
does not deal the damage or get the credit from the kill and that
editing animation - Cast point affects all spells.
 
Level 7
Joined
Jan 28, 2012
Messages
266
you should make the cooldown be saved to an individual unit, this would increase the accuracy of your cooldown timer
example
units cooldown is .83
your system will set it, with its current settings, to
-.02 and then recover it to 0, making the unit fire .02 seconds slower but if you were to save the cooldown to the unit and then did this
set unitscool[index] = unitscool[index] +unittypecooldown the unit would average the correct number of hits a minute.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
this is an useful and original :D

but i have some problem when i'm trying to configure it to fit my need.

I ordered several mortar teams to attack ground to certain point, but they shot on different points. is this just a feature ?

anyway, i want to create a special effect at the position of unit when the unit is ordered (AGES_Event == 3.00), but it's only worked for a unit while i ordered 5 units.

so i tried to change the AGES_Event == 2.00, it worked well.

i also tried to change the AGES_Event == 4.00, didn't work at all.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I ordered several mortar teams to attack ground to certain point, but they shot on different points. is this just a feature ?

A feature, you can turn it off in the AGES Config trigger:
Set AGES_GroupAttackSpacingEnabled = False

I'm busy trying to fix some other bugs with the system, thanks for the feedback.
 
Level 12
Joined
Feb 11, 2008
Messages
809
On the AGES Group Attack trigger on the custom scripts instead of calling "GetEnumUnit()" you already have the unit set into a variable so it should be the variable instead.

  • Set tempUnitPicked = (Picked unit)
so just replace all the "GetEnumUnit()" with "udg_tempUnitPicked"
 
Top