• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[GUI] Custom Bunker System 0.08

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: CoLd Bon3
Custom Bunker System
by rulerofiron99


2zgydxc.png



Description:
Create bunkers (like the Orc Burrow) that are not limited to a specific unit type, and function like Starcraft bunkers.

Example Uses:
  • Making a Starcraft map
  • Buildings that can be garrisoned - like in Command and Conquer
  • Safehouses for units

Prerequisites / Other Systems:

Features:
  • Specify any number of bunker types, for each bunker specify:
    • Which unit types are allowed
    • Capacity (defined either by amount of units or supply usage)
    • Enter radius
  • Units can attack from the bunker, each with its own target and attack timing
  • Loaded units are completely hidden - no HP bar, cannot be picked by other triggers or affected by AoE damage
  • Specify an attacker type for each loaded unit type (e.g. have a loaded Footman attack like a Rifleman)
  • Floating text indicators to show loaded units / capacity
  • Works for moving bunkers; so you can easily make APCs/Ghetto Gunships/Battleships
Limitations:
  • Not meant to work for heroes
  • Units cannot be unloaded individually
  • No information is available on loaded units (they don't appear in the info card as with regular burrow / cargo hold)


Triggers:
  • CBS Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --------------------- --------
      • -------- --- SYSTEM SETUP --- --------
      • -------- --------------------- --------
      • -------- capacity style 1: each unit counts slots equal to its food cost --------
      • -------- capacity style 2: each unit counts as 1 --------
      • Set cbsVAR_CapacityStyle = 2
      • -------- set associated abilities --------
      • -------- make a new ability based on channel (or anything with no target) that does -nothing-, add it to your bunker type, and define it here --------
      • Set cbsVAR_AbilUnloadAll = Unload
      • Set cbsVAR_AbilAttackOrder = Attack Order
      • -------- define half-width per character to center the floating text --------
      • Set cbsVAR_FloatOffset = 3.50
      • -------- --------------------- --------
      • -------- ---- BUNKER TYPES SETUP ---- --------
      • -------- --------------------- --------
      • -------- BunkerTypeUnitT is the actual bunker unit type --------
      • Set cbsVAR_BunkerTypeUnitT[1] = Blacksmith
      • -------- BunkerAllowString is a list of units allowed, follow this XXYYZZ convention, using the numbers defined further on (set unit types and ids) --------
      • -------- e.g. a peasant is index 1, so the code for peasant is "01" --------
      • Set cbsVAR_BunkerAllowString[1] = 0102
      • -------- radius is simply the size of a circle around the bunker where units can enter --------
      • Set cbsVAR_BunkerRadius[1] = 250.00
      • -------- capacity is how many units / how many supply units can be in the bunker --------
      • Set cbsVAR_BunkerCapacity[1] = 6
      • Set cbsVAR_BunkerMoves[1] = False
      • -------- --- --------
      • Set cbsVAR_BunkerTypeUnitT[2] = Siege Engine
      • Set cbsVAR_BunkerAllowString[2] = 0203
      • Set cbsVAR_BunkerRadius[2] = 300.00
      • Set cbsVAR_BunkerCapacity[2] = 20
      • Set cbsVAR_BunkerMoves[2] = True
      • -------- --- --------
      • Set cbsVAR_BunkerTypeUnitT[3] = Wagon
      • Set cbsVAR_BunkerAllowString[3] = 0203
      • Set cbsVAR_BunkerRadius[3] = 300.00
      • Set cbsVAR_BunkerCapacity[3] = 10
      • Set cbsVAR_BunkerMoves[3] = True
      • -------- set bunkerTypeId to the number of bunker types you have --------
      • Set cbsVAR_BunkerTypeId = 3
      • -------- --------------------- --------
      • -------- ---- UNIT TYPES SETUP ---- --------
      • -------- --------------------- --------
      • -------- unitTypeT is the unit type --------
      • Set cbsVAR_UnitTypeUnitT[1] = Peasant
      • -------- TypeDummy is the unit that is created in the bunker to attack foes; they can be the same, but e.g. melee units won't attack, so set a melee unit type's dummy to a ranged unit --------
      • Set cbsVAR_UnitTypeDummy[1] = Rifleman
      • -------- ----- --------
      • Set cbsVAR_UnitTypeUnitT[2] = Mortar Team
      • Set cbsVAR_UnitTypeDummy[2] = Mortar Team
      • Set cbsVAR_UnitTypeUnitT[3] = Rifleman
      • Set cbsVAR_UnitTypeDummy[3] = Rifleman
      • Set cbsVAR_UnitTypeUnitT[4] = Footman
      • Set cbsVAR_UnitTypeDummy[4] = Footman
      • Set cbsVAR_UnitTypeId = 4
      • -------- --------------------- --------
      • -------- init preplaced bunkers --------
      • -------- --------------------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Trigger - Run CBS Add Bunker <gen> (ignoring conditions)
  • CBS Get New Bunker
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • Set tempUnit = (Triggering unit)
      • Trigger - Run CBS Add Bunker <gen> (ignoring conditions)
  • CBS Add Bunker
    • Events
    • Conditions
    • Actions
      • -------- cycle through each bunker type --------
      • For each (Integer D) from 1 to cbsVAR_BunkerTypeId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of tempUnit) Equal to cbsVAR_BunkerTypeUnitT[D]
            • Then - Actions
              • Unit - Add cbsVAR_AbilAttackOrder to tempUnit
              • Unit - Add cbsVAR_AbilUnloadAll to tempUnit
              • Set tempId = D
              • -------- add to the group of all bunkers and increment id --------
              • Unit Group - Add tempUnit to cbs_GroupOfBunkers
              • Set cbs_BunkerId = (cbs_BunkerId + 1)
              • Set cbs_BunkerUnit[cbs_BunkerId] = tempUnit
              • Trigger - Add to CBS Enter Bunker <gen> the event (Unit - A unit comes within cbsVAR_BunkerRadius[D] of tempUnit)
              • Skip remaining actions
            • Else - Actions
  • CBS Move To Bunker
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • ((Target unit of issued order) is in cbs_GroupOfBunkers) Equal to True
      • (Owner of (Triggering unit)) Equal to (Owner of (Target unit of issued order))
    • Actions
      • For each (Integer forA) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of issued order) Equal to cbs_BunkerUnit[forA]
            • Then - Actions
              • Set tempId = forA
              • -------- translate bunker allow string to unit types to check --------
              • For each (Integer forB) from 1 to cbsVAR_BunkerTypeId, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of cbs_BunkerUnit[tempId]) Equal to cbsVAR_BunkerTypeUnitT[forB]
                    • Then - Actions
                      • Set tempString = cbsVAR_BunkerAllowString[forB]
                    • Else - Actions
              • -------- check each element in the allow string --------
              • For each (Integer forB) from 1 to ((Length of tempString) / 2), do (Actions)
                • Loop - Actions
                  • -------- convert number in string to index to check unit types --------
                  • Set tempInt = (Integer((Substring(tempString, ((forB x 2) - 1), (forB x 2)))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Triggering unit)) Equal to cbsVAR_UnitTypeUnitT[tempInt]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Triggering unit) is in cbs_BunkerTargetGroup[tempId]) Equal to False
                          • ((Triggering unit) is in cbs_BunkerUnitGroup[tempId]) Equal to False
                        • Then - Actions
                          • -------- disable going to other bunkers, only one target --------
                          • For each (Integer C) from 1 to cbs_BunkerId, do (Actions)
                            • Loop - Actions
                              • Unit Group - Remove (Triggering unit) from cbs_BunkerTargetGroup[C]
                          • Set tempLoc = (Position of (Triggering unit))
                          • Set tempLoc2 = (Position of cbs_BunkerUnit[tempId])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Distance between tempLoc and tempLoc2) Less than or equal to (cbsVAR_BunkerRadius[tempId] + 64.00)
                            • Then - Actions
                              • Set tempUnit = (Triggering unit)
                              • Set addUnit = tempUnit
                              • Set addId = tempId
                              • Set addLoc = tempLoc2
                              • Trigger - Run CBS Add Unit to Bunker <gen> (ignoring conditions)
                            • Else - Actions
                              • Unit Group - Add (Triggering unit) to cbs_BunkerTargetGroup[tempId]
                          • Custom script: call RemoveLocation(udg_tempLoc)
                          • Custom script: call RemoveLocation(udg_tempLoc2)
                          • Skip remaining actions
                        • Else - Actions
                    • Else - Actions
            • Else - Actions
  • CBS Enter Bunker
    • Events
    • Conditions
    • Actions
      • Set tempUnit = (Triggering unit)
      • -------- find which bunker the unit is headed towards --------
      • Set tempId = 0
      • For each (Integer forA) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tempUnit is in cbs_BunkerTargetGroup[forA]) Equal to True
            • Then - Actions
              • Set tempId = forA
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempId Not equal to 0
        • Then - Actions
          • Set tempLoc = (Position of cbs_BunkerUnit[tempId])
          • -------- make sure the bunker is in range; since this trigger runs on proximity to - any- bunker --------
          • Set tempBool = False
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within cbsVAR_BunkerRadius[tempId] of tempLoc matching ((Matching unit) Equal to cbs_BunkerUnit[tempId])) and do (Actions)
            • Loop - Actions
              • Set tempBool = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempBool Equal to True
            • Then - Actions
              • Set addUnit = tempUnit
              • Set addId = tempId
              • Set addLoc = tempLoc
              • Trigger - Run CBS Add Unit to Bunker <gen> (ignoring conditions)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_tempLoc)
        • Else - Actions
  • CBS Add Unit to Bunker
    • Events
    • Conditions
    • Actions
      • -------- check bunker capacity --------
      • For each (Integer C) from 1 to cbsVAR_BunkerTypeId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of cbs_BunkerUnit[addId]) Equal to cbsVAR_BunkerTypeUnitT[C]
            • Then - Actions
              • Set tempId2 = C
            • Else - Actions
      • Set tempBool = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • cbsVAR_CapacityStyle Equal to 1
        • Then - Actions
          • Set tempInt2 = 0
          • Unit Group - Pick every unit in cbs_BunkerUnitGroup[tempId] and do (Actions)
            • Loop - Actions
              • Set tempInt2 = (tempInt2 + (Supply used by (Picked unit)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt2 Less than or equal to (cbsVAR_BunkerCapacity[tempId2] - (Supply used by addUnit))
            • Then - Actions
              • Set tempBool = True
              • Set tempInt2 = (tempInt2 + (Supply used by addUnit))
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • cbsVAR_CapacityStyle Equal to 2
        • Then - Actions
          • Set tempInt2 = 0
          • Unit Group - Pick every unit in cbs_BunkerUnitGroup[tempId] and do (Actions)
            • Loop - Actions
              • Set tempInt2 = (tempInt2 + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt2 Less than or equal to (cbsVAR_BunkerCapacity[tempId2] - 1)
            • Then - Actions
              • Set tempBool = True
              • Set tempInt2 = (tempInt2 + 1)
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempBool Equal to True
        • Then - Actions
          • Unit Group - Add addUnit to cbs_BunkerUnitGroup[addId]
          • Unit Group - Remove addUnit from cbs_BunkerTargetGroup[addId]
          • Custom script: call UnitAddAbility(udg_addUnit, 'Abun')
          • Unit - Hide addUnit
          • Unit - Make addUnit Invulnerable
          • Unit - Pause addUnit
          • For each (Integer C) from 1 to cbsVAR_UnitTypeId, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of addUnit) Equal to cbsVAR_UnitTypeUnitT[C]
                • Then - Actions
                  • Set tempId3 = C
                • Else - Actions
          • Unit - Create 1 cbsVAR_UnitTypeDummy[tempId3] for (Owner of addUnit) at addLoc facing Default building facing degrees
          • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Custom script: call UnitAddAbility(GetLastCreatedUnit(), 'Aloc')
          • Custom script: call SetUnitPropWindow(GetLastCreatedUnit(), 0)
          • Unit - Move (Last created unit) instantly to addLoc
          • Set cbs_BunkerUnitDummy[(Custom value of addUnit)] = (Last created unit)
          • Set floatCapacity = cbsVAR_BunkerCapacity[tempId2]
          • Set floatId = tempId
          • Set floatLoaded = tempInt2
          • Trigger - Run CBS Float Passive <gen> (ignoring conditions)
        • Else - Actions
          • Game - Display to (Player group((Owner of addUnit))) the text: |cffffError|r - bun...
  • CBS Unload
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to cbsVAR_AbilUnloadAll
    • Actions
      • For each (Integer A) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to cbs_BunkerUnit[(Integer A)]
            • Then - Actions
              • Set tempId = (Integer A)
            • Else - Actions
      • Set tempLoc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in cbs_BunkerUnitGroup[tempId] and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Set tempInt = (Custom value of tempUnit)
          • Unit - Remove cbs_BunkerUnitDummy[tempInt] from the game
          • Unit Group - Remove tempUnit from cbs_BunkerUnitGroup[tempId]
          • Unit - Unhide tempUnit
          • Unit - Make tempUnit Vulnerable
          • Unit - Unpause tempUnit
          • Custom script: call UnitRemoveAbility(udg_tempUnit, 'Abun')
          • Unit - Move tempUnit instantly to tempLoc
      • Custom script: call RemoveLocation(udg_tempLoc)
  • CBS Unload on Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in cbs_GroupOfBunkers) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from cbs_GroupOfBunkers
      • For each (Integer A) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to cbs_BunkerUnit[(Integer A)]
            • Then - Actions
              • Set tempId = (Integer A)
            • Else - Actions
      • Set tempLoc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in cbs_BunkerUnitGroup[tempId] and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Set tempInt = (Custom value of tempUnit)
          • Unit - Remove cbs_BunkerUnitDummy[tempInt] from the game
          • Unit Group - Remove tempUnit from cbs_BunkerUnitGroup[tempId]
          • Unit - Unhide tempUnit
          • Unit - Make tempUnit Vulnerable
          • Unit - Unpause tempUnit
          • Custom script: call UnitRemoveAbility(udg_tempUnit, 'Abun')
          • Unit - Move tempUnit instantly to tempLoc
      • Custom script: call RemoveLocation(udg_tempLoc)
  • CBS Float Passive
    • Events
    • Conditions
    • Actions
      • Floating Text - Destroy cbs_BunkerFloat[floatId]
      • Set tempString2 = |cffffcc00
      • For each (Integer D) from 1 to floatLoaded, do (Actions)
        • Loop - Actions
          • Set tempString2 = (tempString2 + -)
      • Set tempString2 = (tempString2 + |r|cff202020)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • floatCapacity Greater than floatLoaded
        • Then - Actions
          • For each (Integer D) from (floatLoaded + 1) to floatCapacity, do (Actions)
            • Loop - Actions
              • Set tempString2 = (tempString2 + -)
        • Else - Actions
      • Set tempString2 = (tempString2 + |r)
      • Set tempLoc3 = (addLoc offset by ((((Real((Length of tempString2))) x cbsVAR_FloatOffset) x -1.00), 0.00))
      • Floating Text - Create floating text that reads tempString2 at tempLoc3 with Z offset 96.00, using font size 25.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Hide (Last created floating text) for (All players)
      • Floating Text - Show (Last created floating text) for (Player group((Owner of addUnit)))
      • Set cbs_BunkerFloat[floatId] = (Last created floating text)
      • Custom script: call RemoveLocation(udg_tempLoc3)
  • CBS Attack Order
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to cbsVAR_AbilAttackOrder
    • Actions
      • For each (Integer forA) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to cbs_BunkerUnit[forA]
            • Then - Actions
              • Set tempId = forA
            • Else - Actions
      • Unit Group - Pick every unit in cbs_BunkerUnitGroup[tempId] and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Set tempInt = (Custom value of tempUnit)
          • Set tempUnit = cbs_BunkerUnitDummy[tempInt]
          • Unit - Order tempUnit to Attack (Target unit of ability being cast)
  • CBS Moving Bunker
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer C) from 1 to cbs_BunkerId, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • cbsVAR_BunkerMoves[C] Equal to True
              • (cbs_BunkerUnitGroup[C] is empty) Equal to False
            • Then - Actions
              • Floating Text - Change the position of cbs_BunkerFloat[C] to cbs_BunkerUnit[C] with Z offset (Current flying height of cbs_BunkerUnit[C])
              • Custom script: set udg_x = GetUnitX(udg_cbs_BunkerUnit[udg_C])
              • Custom script: set udg_y = GetUnitY(udg_cbs_BunkerUnit[udg_C])
              • -------- Note: the dummy attacking units sometimes bug out and stop attacking; this counter resets them every few seconds. --------
              • Set cbs_MovingBunkerResetCounter[C] = (cbs_MovingBunkerResetCounter[C] + 1)
              • Unit Group - Pick every unit in cbs_BunkerUnitGroup[C] and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • cbs_MovingBunkerResetCounter[C] Greater than or equal to 150
                    • Then - Actions
                      • Unit - Order (Picked unit) to Stop
                    • Else - Actions
                  • Set tempUnit = cbs_BunkerUnitDummy[(Custom value of (Picked unit))]
                  • Custom script: call SetUnitX(udg_tempUnit, udg_x)
                  • Custom script: call SetUnitY(udg_tempUnit, udg_y)
            • Else - Actions


Changelog:

0.08
  • Replaced all instances of Integer B.
  • Fixed attacking units in a moving transport becoming pacifists (not attacking after a while).
  • Removed floating text listing occupants.
  • Added ability for bunkers to order all occupants to attack a target.
  • The Unload and Attack abilities are now added to the unit in the triggers; you no longer need to specify it in the Unit Editor.
0.07
  • Replaced potentially troublesome instances of Integer A
  • Added a floating text indicator to show loaded units / capacity
  • Added a floating text indicator that lists units inside a bunker when selected
  • Added option to set a different "bunker attacker" unit for each unit type - e.g. a footman that enters a bunker can be set to attack like a Rifleman
0.06
  • Release

Credits:

Thanks to:


Keywords:
bunker, burrow, bunker system, burrow system, multi-unit burrow, multi-unit bunker, starcraft bunker
Contents

Bunker System 0.08 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 00:45, 24th November 2012 Magtheridon96: - Instead of expecting users to fill out arrays of data, you can encapsulate the whole process of 'adding' a unit by expecting users to set some...

Moderator

M

Moderator

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

00:45, 24th November 2012
Magtheridon96:

- Instead of expecting users to fill out arrays of data, you can encapsulate the whole process of 'adding' a unit by expecting users to set some temporary system variables to whatever values they want and running a trigger called "Register Bunker Type" or something
- You could store (Triggering unit) into a variable so you don't have to repeat it multiple times in a loop. (You can apply this to most things that are inside parentheses)
-
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within cbsVAR_BunkerRadius[tempId] of tempLoc matching ((Matching unit) Equal to cbs_BunkerUnit[tempId])) and do (Actions)
    • Loop - Actions
      • Set tempBool = True
This method is pretty slow. Instead of picking all the units in the group, you can store the group as a variable, and do this:
set udg_tempBool = (FirstOfGroup(udg_groupVariable) != null)
 
Well it's nice I guess, though seems a little redundant, since we can just create bunker abilities to units which is actually quite a lot less hassle. Eitherway: Don't use IntegerA use your own, it's good practice and there are some issues with integerA though I don't think any of them apply here, and if you use them all, don't call them IntegerA to avoid confusion. Can't see any immediate problems, though my code-reading isn't that good this time of night

Other than that, seems pretty unique, if a bit bulky for one system, but yeah quite fond of it.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Thanks! A light search made me none the wiser as to the problems with Integer A, any chance you could link me to some reading material?
Replace the function with using Variable Integer instead;
  • For each (Integer YourIntegerVariable) from 1 to cbs_BunkerId, do (Actions)
    • Loop - Actions
The YourIntegerVariable does not need to be set its value, it's just for the looping action.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
The system is reeeealy nice. I like how the units inside attack with their own attack type. However, i have some suggestions. What happens when a melee units enters the bunker - nothing. You should make it like the old bunkers, make 'em shoot arrows when melee units are inside. It would also be good if you somehow display how much units in the bunker are there, or at least their unit-type (this can be done really easily with a floating text). It might be confusing in a map if the user has 15 bunkers with different unit-types in them.

Otherwise, it's REEEALY nice! I like it very much!
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Tell this to Magtheridon, and you'll be lectured by him for 3 hours straight saying Integer A/B bugs when used globally simultaneously by more than 1 trigger at a time.
Um, in my map, i have at least 6 triggers using Integer A. Can you tell me what is the problem (desync, leak, etc.)? I am worried.

However, i haven't seen problems so far... but all the triggers don't run at once. I mean, first goes one of the triggers, then another, then another...
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Um, in my map, i have at least 6 triggers using Integer A. Can you tell me what is the problem (desync, leak, etc.)? I am worried.

However, i haven't seen problems so far...

If, for example, you have a trigger that does an Int A for loop, and runs another trigger that also does an Int A for loop.

... isn't there like a way to force integer A into a local variable?
e.g.
  • Custom script: local integer ForLoopIndexA
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
If a trigger is run by another trigger, you can think of it as being "in" the other trigger.

So the parent trigger will increment
inta = 1
inta = 2
inta = 3
run other trigger
... which will the star inta at 1 or whatever you set
so now the main loop will continue with inta = the last value set by the child trigger, and miss a whole bunch of actions, potentially.

EDIT: New version up. Oh dear, what a lot of triggers :S (it isn't bloat, I promise!)
 
Last edited:
Level 14
Joined
Aug 8, 2010
Messages
1,022
No, no, i didn't want to say that they are a chain of triggers. They are simply no goin' together. Well, there are some cases where there are two chained triggers, both with integer a, but i have seen no problems so far. Everything is executed perfectly.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Suggestions:
- You did not clean the Floating Text when you select the Bunker (if you spam click on the Bunker filled with units, you will notice that the Floating Text font grows "thicker", right ? This is because you did not clean the last Floating Text and create a new one, fix this, you can make it stay there forever - in other words, it leaks)
- When we click on the bunker (somehow the bunker must have an attack order, why ?) Because, if I want to focus all my units to attack specific individual unit, I would just click on the Bunker and order attack to that unit, all units in that Bunker will be forced to change its attack target.
- When Bunker dies, you should remove all data attached to it (Floating Text, mostly). Currently, when Bunker dies, Floating Text remains there :)
 
Level 3
Joined
Jan 8, 2022
Messages
64
Not sure if this is necro post territory; I noticed in your map that units stop attacking from the bunker after three attacks.
 
Top