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

Please help - unit indexer issue !

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
Im using a unit indexer system from these boards that allows units to defend a position, the problem is that once they die they just reapawn instantlyy and multipy a lot. The indexer works fine while the units are alive but if they die then it instantly respawns and the map is eventually crawling with excess units
 
Level 5
Joined
Feb 1, 2009
Messages
111
Okay so here are my triggers:

I am using the Guard Posts system made by mckill2009 as seen here

I have in total 3 triggers - one to create the guard system for units, one that creates the guard system for units that die and respawn, and one that removes the guard system after a certain event takes place.

  • Soldier Defend Timer Expires Order Units Defend
    • Events
      • Time - SoldierDefendTimer expires
    • Conditions
    • Actions
      • Sound - Play CreepAggroWhat1 <gen>
      • Game - Display to (All players) for 5.00 seconds the text: |cffffff00Attack is...
      • -------- Set to True to allow Soldiers to be in 'attacking' mode and leave ShadowDale --------
      • Set TimetoDefend = True
      • Unit Group - Pick every unit in PrimarySoldierGroup and do (Actions)
        • Loop - Actions
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- Sets the Guard unit --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Set GP_GuardingUnit = (Picked unit)
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- Sets the location point of where the unit will guard --------
          • -------- You do not need to remove the location coz it will be removed from the system automatically --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Set GP_GuardWhere = (Random point in Soldier Defend Area <gen>)
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- Sets the range perimeter from the location where the unit is guarding --------
          • -------- If an enemy unit is in range, he will engage --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Set GP_Perimeter = 700.00
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- Facing angle and Engage while traveling are optional --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Set GP_FacingAngle = 90.00
          • Set GP_EngageWhileTraveling = True
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- Store the guard unit to the system --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Trigger - Run Guard Post Form <gen> (ignoring conditions)


  • Respawn Dark Green
    • Events
      • Unit - A unit Dies
    • Conditions
      • Multiple ConditionsAnd - All (Conditions) are true
        • Conditions
          • ((Unit-type of (Dying unit)) Equal to (==) Footman) or ((Unit-type of (Dying unit)) Equal to (==) Archer)
    • Actions
      • Wait 20.00 seconds
        • Do Multiple ActionsFor each (Integer A) from 1 to TownCount, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Triggering unit) Equal to (==) TownUnit[(Integer A)]
              • Then - Actions
                • Set Location = (Point(Start_X[(Integer A)], Start_Y[(Integer A)]))
                • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Location facing Default building facing (270.0) degrees
                • Set TownUnit[(Integer A)] = (Last created unit)
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • -------- Sets the Guard unit --------
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • Set GP_GuardingUnit = (Last created unit)
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • -------- Sets the location point of where the unit will guard --------
                • -------- You do not need to remove the location coz it will be removed from the system automatically --------
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • Set GP_GuardWhere = (Random point in Soldier Defend Area <gen>)
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • -------- Sets the range perimeter from the location where the unit is guarding --------
                • -------- If an enemy unit is in range, he will engage --------
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • Set GP_Perimeter = 700.00
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • -------- Facing angle and Engage while traveling are optional --------
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • Set GP_FacingAngle = 90.00
                • Set GP_EngageWhileTraveling = True
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • -------- Store the guard unit to the system --------
                • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
                • Trigger - Run Guard Post Form <gen> (ignoring conditions)
              • Else - Actions


And finally, the trigger that removes the guard system from all units after I dont want them to guard anymore:

  • Check for Wave Completion
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
      • Multiple ConditionsAnd - All (Conditions) are true
        • Conditions
          • (Custom value of (Dying unit)) Equal to (==) 99
          • ((All units of EnemiesOnMap are dead) Equal to (==) True) or ((EnemiesOnMap is empty) Equal to (==) True)
          • WaveFull Equal to (==) True
    • Actions
      • Set Wave_Is_Underway = False
      • -------- Get every soldier on map and return them to Shadowdale --------
      • Wait 30.00 seconds
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to (==) Footman) or ((Unit-type of (Matching unit)) Equal to (==) Archer))) and do (Actions)
        • Loop - Actions
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • -------- If you want to remove the unit from the system, just do this --------
          • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
          • Set GP_GuardingUnit = (Picked unit)
          • Trigger - Run Guard Post Remove <gen> (ignoring conditions)
          • Unit Group - Add (Picked unit) to PrimarySoldierGroup
      • Unit Group - Pick every unit in PrimarySoldierGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_Start_X[udg_TownCount] = GetUnitX(GetEnumUnit())
          • Custom script: set udg_Start_Y[udg_TownCount] = GetUnitY(GetEnumUnit())
          • Set TownUnit[TownCount] = (Picked unit)
          • Set TownCount = (TownCount + 1)
          • Set Temp_Integer_Guard = (Random integer number between 1 and GuardPatrolPoints)
          • Set a_myLocation = (Random point in GuardPoints[Temp_Integer_Guard])
          • Unit - Order (Picked unit) to Attack-Move To a_myLocation
          • Custom script: call RemoveLocation(udg_a_myLocation)
      • Custom script: call DestroyGroup(udg_a_myUnitGroup)
      • Trigger - Turn off (This trigger)

So I don't know what Im doing wrong ? How do I de-index a unit if that's what I need to do ?
 
Last edited:
Status
Not open for further replies.
Top