• 🏆 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!

[Solved] Weird Trigger Issue?

Status
Not open for further replies.
Level 7
Joined
Aug 11, 2010
Messages
269
Essentially I've created a creep system much like DotA's where it spawns a single random group per creep camp. For example; for an easy camp it'll create 3 Centaurs, 3 Satyrs, or 3 Bandits. A hard camp will spawn 3 Demons, 3 Naga, or 3 Tauren.

It works fine; if every creep camp is set to 'easy'. All three 'current' creep camps spawn just fine... However; if I set anything not to easy, only one camp will spawn. It's really confusing and frustrating. Here's the triggers. Bare in mind that they are mostly placeholder, particularly the configuration (as I haven't made any actual creeps yet)

  • VCONF Jungle Creep Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------- [Start Trigger Actions] ---------- --------
      • Set AA_JUNC_CreepCampType[1] = 1
      • Set AA_JUNC_CreepCampRegion[1] = RTJungleCamp01 <gen>
      • Set AA_JUNC_CreepCampPoint[1] = (Point(2686.00, 2305.00))
      • Set AA_JUNC_CreepCampAngle[1] = 180.00
      • Set AA_JUNC_CreepCampType[2] = 2
      • Set AA_JUNC_CreepCampRegion[2] = RTJungleCamp02 <gen>
      • Set AA_JUNC_CreepCampPoint[2] = (Point(3968.00, -3455.00))
      • Set AA_JUNC_CreepCampAngle[2] = 135.00
      • Set AA_JUNC_CreepCampType[3] = 3
      • Set AA_JUNC_CreepCampRegion[3] = RTJungleCamp03 <gen>
      • Set AA_JUNC_CreepCampPoint[3] = (Point(5250.00, 1250.00))
      • Set AA_JUNC_CreepCampAngle[3] = 270.00
      • -------- ---------- [Start Easy Camp Configuration] ---------- --------
      • Set AA_JUNC_CreepGreenTypeA[1] = Dark Troll
      • Set AA_JUNC_CreepGreenTypeB[1] = Dark Troll
      • Set AA_JUNC_CreepGreenTypeC[1] = Dark Troll Shadow Priest
      • Set AA_JUNC_CreepGreenTypeA[2] = Grunt
      • Set AA_JUNC_CreepGreenTypeB[2] = Peon
      • Set AA_JUNC_CreepGreenTypeC[2] = Troll Headhunter
      • Set AA_JUNC_CreepGreenTypeD[2] = Troll Headhunter
      • Set AA_JUNC_CreepGreenTypeA[3] = Furbolg Ursa Warrior
      • Set AA_JUNC_CreepGreenTypeB[3] = Furbolg Ursa Warrior
      • Set AA_JUNC_CreepGreenAmount = 3
      • -------- ---------- [End Easy Camp Configuration] ---------- --------
      • -------- ---------- [Start Medium Camp Configuration] ---------- --------
      • Set AA_JUNC_CreepYellowTypeA[1] = Satyr Hellcaller
      • Set AA_JUNC_CreepYellowTypeB[1] = Satyr Soulstealer
      • Set AA_JUNC_CreepYellowTypeC[1] = Satyr Soulstealer
      • Set AA_JUNC_CreepYellowAmount = 1
      • -------- ---------- [End Medium Camp Configuration] ---------- --------
      • -------- ---------- [Start Hard Camp Configuration] ---------- --------
      • Set AA_JUNC_CreepRedTypeA[1] = Satyr Hellcaller
      • Set AA_JUNC_CreepRedTypeB[1] = Satyr Hellcaller
      • Set AA_JUNC_CreepRedTypeC[1] = Satyr Hellcaller
      • Set AA_JUNC_CreepRedTypeD[1] = Satyr Hellcaller
      • Set AA_JUNC_CreepRedAmount = 1
      • -------- ---------- [End Hard Camp Configuration] ---------- --------
      • -------- ---------- [End Trigger Actions] ---------- --------
  • GGPM Jungle Creep Spawn
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • -------- ---------- [Start Trigger Actions] ---------- --------
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in AA_JUNC_CreepCampGroup[(Integer A)]) Equal to 0
              • (Number of units in (Units in AA_JUNC_CreepCampRegion[(Integer A)] matching ((((Matching unit) is A Hero) Equal to True) and (((Owner of (Matching unit)) is an enemy of Neutral Hostile) Equal to True)))) Equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_JUNC_CreepCampType[(Integer A)] Equal to 1
                • Then - Actions
                  • -------- ---------- [Start Easy Camp Spawn] ---------- --------
                  • Set TempInteger = (Random integer number between 1 and AA_JUNC_CreepGreenAmount)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepGreenTypeA[TempInteger] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepGreenTypeA[TempInteger] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepGreenTypeB[TempInteger] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepGreenTypeB[TempInteger] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepGreenTypeC[TempInteger] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepGreenTypeC[TempInteger] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepGreenTypeD[TempInteger] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepGreenTypeD[TempInteger] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • -------- ---------- [End Easy Camp Spawn] ---------- --------
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_JUNC_CreepCampType[(Integer A)] Equal to 2
                • Then - Actions
                  • -------- ---------- [Start Medium Camp Spawn] ---------- --------
                  • Set TempInteger = (Random integer number between 1 and AA_JUNC_CreepYellowAmount)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepYellowTypeA[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepYellowTypeA[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepYellowTypeB[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepYellowTypeB[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepYellowTypeC[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepYellowTypeC[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepYellowTypeD[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepYellowTypeD[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • -------- ---------- [End Medium Camp Spawn] ---------- --------
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AA_JUNC_CreepCampType[(Integer A)] Equal to 3
                • Then - Actions
                  • -------- ---------- [Start Hard Camp Spawn] ---------- --------
                  • Set TempInteger = (Random integer number between 1 and AA_JUNC_CreepRedAmount)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepRedTypeA[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepRedTypeA[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepRedTypeB[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepRedTypeB[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepRedTypeC[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepRedTypeC[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • AA_JUNC_CreepRedTypeD[(Integer A)] Not equal to No unit-type
                    • Then - Actions
                      • Unit - Create 1 AA_JUNC_CreepRedTypeD[(Integer A)] for Neutral Hostile at AA_JUNC_CreepCampPoint[(Integer A)] facing AA_JUNC_CreepCampAngle[(Integer A)] degrees
                      • Unit Group - Add (Last created unit) to AA_JUNC_CreepCampGroup[(Integer A)]
                      • Unit - Set (Last created unit) acquisition range to 200.00
                    • Else - Actions
                  • -------- ---------- [End Hard Camp Spawn] ---------- --------
                • Else - Actions
            • Else - Actions
      • -------- ---------- [End Trigger Actions] ---------- --------
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
If you need to triplicate the code to essentially do the same thing then that is likely the problem.

The system should have 4 arrays for creep type data.
CreepType // The type of creep unit.
SpawnCount // The number of that type of unit to spawn.
Variation // The spawn variation number. A Variation represents a particular spawn configuration.
Difficulty // The difficulty the spawn is available at.

The system should have 1 array for difficulty data.
VariationCount // Number of variations available for a certain difficulty.

When it is time to spawn new creeps it gets a random variation up to VariationCount for its difficulty and then iterates through all creep data entries looking for ones which match both difficulty and this variation number. It then spawns them.

If one orders the creep type data by difficulty then variation then one can potentially optimize the lookup process by using a lookup table to jump straight to the beginning of a difficulty range and aborting after either difficulty or variation exceed the required numbers. This should not be necessary however as even hundreds of entries should execute trivially.

End result is the same simpler code controls all 3 spawn point types and variations.
 
Level 7
Joined
Aug 11, 2010
Messages
269
If you need to triplicate the code to essentially do the same thing then that is likely the problem.

The system should have 4 arrays for creep type data.
CreepType // The type of creep unit.
SpawnCount // The number of that type of unit to spawn.
Variation // The spawn variation number. A Variation represents a particular spawn configuration.
Difficulty // The difficulty the spawn is available at.

The system should have 1 array for difficulty data.
VariationCount // Number of variations available for a certain difficulty.

When it is time to spawn new creeps it gets a random variation up to VariationCount for its difficulty and then iterates through all creep data entries looking for ones which match both difficulty and this variation number. It then spawns them.

If one orders the creep type data by difficulty then variation then one can potentially optimize the lookup process by using a lookup table to jump straight to the beginning of a difficulty range and aborting after either difficulty or variation exceed the required numbers. This should not be necessary however as even hundreds of entries should execute trivially.

End result is the same simpler code controls all 3 spawn point types and variations.

The reason I've set it up in such the way that I did is because there's going to often be different units per group. For example; the Satyrs might be Hellcallers and Soulstealers, if you just have one CreepType and a spawn count you'd be limited to one.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
For example; the Satyrs might be Hellcallers and Soulstealers, if you just have one CreepType and a spawn count you'd be limited to one.
Exactly, which is why I recommended the "Variation" array. With that one can assign 2 array indices to the same variation, and hence 2 or more different creep types. The spawn loop uses all entries which match the rolled variation at the required difficulty. This gives even more flexibility as you could have 20 or more different creep types for a single variation if so desired.

One could potentially remove the "Difficulty" array by ordering and adding an offset array to the difficulty data.
 
Status
Not open for further replies.
Top