• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Ok. It is my 8'th day with this trigger. Someone can detect the issue in here?

Level 17
Joined
Jun 2, 2009
Messages
1,184
Warning. This one is pretty long and i will try to explain everything.

Let me tell you what happens in here. Each AI have one Hero.
These heroes going with few creatures against enemy Tower.
When tower starts to hit your creeps and if there are 2 or less creeps around, AI Heroes detecting any creeps and right clicking on them.
I have just realized fAI_run_tower never turns False again. This is why they are stucking. I have checked and changed many things but still i havent solved it yet.

  • KuledenKacReaper
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Attacked unit)) Equal to ClanReaperPlayer
      • ((Attacked unit) is in zUG_CreepsReaper) Equal to True
      • ((Attacking unit) is in zUG_TowersDevil) Equal to True
    • Actions
      • Set TempPoint = (Position of (Attacked unit))
      • Set TempGroup = (Units within 1000.00 of TempPoint matching (((Matching unit) is in zUG_CreepsReaper) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Less than or equal to 2
        • Then - Actions
          • Custom script: call DestroyGroup (udg_TempGroup)
          • Set TempGroup = (Units within 800.00 of TempPoint matching ((((Matching unit) is in HerolarYapayZekaReaper) Equal to True) and (((Matching unit) is in zUG_TankOFF_REAPER) Equal to False)))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Set TempUnitArray[(Player number of (Owner of (Picked unit)))] = (Picked unit)
              • Set bool_RUN_TOWER[(Player number of (Owner of (Picked unit)))] = False
              • Set fAI_run_tower[(Player number of (Owner of (Picked unit)))] = True
              • Custom script: call DestroyGroup (udg_TempGroup)
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Unit Group - Pick every unit in (Units within 5000.00 of (Position of TempUnitArray[(Player number of (Owner of (Picked unit)))])) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in zUG_CreepsReaper) Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) is in EBENGRUP) Equal to False
                      • zBool_BotCreepBuldu[(Player number of (Owner of (Picked unit)))] Equal to False
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TempUnitArray[(Player number of (Owner of (Picked unit)))] is in zUG_LanerReaperBOT) Equal to True
                          • (Point-value of (Picked unit)) Equal to 94
                        • Then - Actions
                          • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnitArray[(Player number of (Owner of (Picked unit)))]))] = True
                          • Cinematic - Ping minimap for PG_Debug at (Position of (Picked unit)) for 1.00 seconds
                          • Unit - Order TempUnitArray[(Player number of (Owner of (Picked unit)))] to Right-Click (Picked unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (TempUnitArray[(Player number of (Owner of (Picked unit)))] is in zUG_LanerReaperMID) Equal to True
                              • (Point-value of (Picked unit)) Equal to 95
                            • Then - Actions
                              • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnitArray[(Player number of (Owner of (Picked unit)))]))] = True
                              • Cinematic - Ping minimap for PG_Debug at (Position of (Picked unit)) for 1.00 seconds
                              • Unit - Order TempUnitArray[(Player number of (Owner of (Picked unit)))] to Right-Click (Picked unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (TempUnitArray[(Player number of (Owner of (Picked unit)))] is in zUG_LanerReaperTOP) Equal to True
                                  • (Point-value of (Picked unit)) Equal to 96
                                • Then - Actions
                                  • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnitArray[(Player number of (Owner of (Picked unit)))]))] = True
                                  • Cinematic - Ping minimap for PG_Debug at (Position of (Picked unit)) for 1.00 seconds
                                  • Unit - Order TempUnitArray[(Player number of (Owner of (Picked unit)))] to Right-Click (Picked unit)
                                • Else - Actions
                    • Else - Actions
        • Else - Actions
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
EBENGROUP refers units encountered by enemy tower, so Heroes do not try to right click to units encountering with enemy towers.

  • Ebengrup
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) is in EBENGRUP) Equal to False
      • Or - Any (Conditions) are true
        • Conditions
          • ((Attacked unit) is in zUG_CreepsDevil) Equal to True
          • ((Attacked unit) is in zUG_CreepsReaper) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • ((Attacking unit) is in zUG_TowersReaper) Equal to True
          • ((Attacking unit) is in zUG_TowersDevil) Equal to True
    • Actions
      • Set TempPoint = (Position of (Attacked unit))
      • Unit Group - Pick every unit in (Units within 800.00 of TempPoint) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is in zUG_CreepsDevil) Equal to True
                  • ((Picked unit) is in zUG_CreepsReaper) Equal to True
  • [TRIGGER]
    • Then - Actions
      • Unit Group - Add (Picked unit) to EBENGRUP
      • Custom script: call RemoveLocation(udg_TempPoint)
    • Else - Actions
    • Custom script: call RemoveLocation(udg_TempPoint)
  • EbenGroupLeave
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in EBENGRUP) Equal to True
    • Actions
      • Unit Group - Remove (Dying unit) from EBENGRUP
And i am removing dying units from this group.
Second part is right clicking to units. Heroes are right clicking units and going to near them.

  • OrderSeysi
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] Equal to True
    • Actions
      • Set TempCreep[(Player number of (Owner of (Triggering unit)))] = (Target unit of issued order)
      • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 250.00 of TempCreep[(Player number of (Owner of (Triggering unit)))])
Then i am detecting the Hero are really met with the creep?

  • CreepBulduSeysi
    • Events
    • Conditions
      • ((Triggering unit) is in HerolarBotALL) Equal to True
      • zBool_BotCreepBuldu[(Player number of (Owner of HERO_AI[(Player number of (Owner of (Triggering unit)))]))] Equal to True
    • Actions
      • Set zBool_BotCreepBuldu[(Player number of (Owner of (Triggering unit)))] = False
      • Set fAI_run_tower[(Player number of (Owner of (Triggering unit)))] = False
      • Set fAI_run_creep[(Player number of (Owner of (Triggering unit)))] = False
      • Game - Display to PG_Debug for 2.00 seconds the text: ((Name of (Triggering unit)) + ehe creep buldum)
And of course i am removing these units if they are killed BEFORE Heroes met with them.

  • CreepBulduSeysi2
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to ClanDevilPlayer
          • (Owner of (Triggering unit)) Equal to ClanReaperPlayer
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to TempCreep[(Integer A)]
            • Then - Actions
              • Set zBool_BotCreepBuldu[(Integer A)] = False
              • Set fAI_run_tower[(Integer A)] = False
              • Set fAI_run_creep[(Integer A)] = False
              • Unit - Order HERO_AI[(Integer A)] to Stop
              • Game - Display to PG_Debug for 2.00 seconds the text: ((Name of HERO_AI[(Integer A)]) + aradigim creep öldü )
            • Else - Actions
But this is not happening during my tests.

Issue: Hero falls back from tower and i can see still this boolean True.
  • Set fAI_run_tower[(Integer A)] = False
If it will not turns to False, Hero will never joins other unit groups for the next move.

Why i cannot set fAI_run_tower[(Integer A)] to false?

Alternatively you can suggest changes that you think could be better
 
Level 26
Joined
Sep 26, 2009
Messages
2,418
Let me start with the following: You use temp variables incorrectly. The 'temp' means 'temporary' and they should be used strictly as helper variables in your triggers. They should be cleared of any values manually at the end of the trigger they were used in (or before any wait action in your trigger).

Usually, you will see that people have multiple non-array temp variables like this:
  • Set VariableSet tempLoc1 = (Position of (Triggering unit))
  • Set VariableSet tempLoc2 = (tempLoc1 offset by 256.00 towards 0.00 degrees.)
but some people prefer to instead have a single temp array variable of a given type as that scales better with requirements and they use it like this:
  • Set VariableSet tempLocs[1] = (Position of (Triggering unit))
  • Set VariableSet tempLocs[2] = (tempLocs[1] offset by 256.00 towards 0.00 degrees.)
However you should never have to use temp array variables where the index is "(Player number of (Owner of some_unit))"!
Maybe when you are storing data for some time in a MPI system, but not for temp variables. Yet your three triggers: KuledenKacReaper, OrderSeysi and CreepBulduSeysi refer to "(Player number of (Owner of some_unit))" as index for temp variables a total of 25 times! With KuledenKacReaper refering to it 17 times.
It's very hard for anyone to make heads and tails of what is going on when reviewing your triggers with the unnecessary complexity you are introducing to them.

KuledenKacReaper trigger
Ignoring the memory leaks, the thing that stands out here is:
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • ...
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
A "Unit Group - Pick every unit..." will execute actions under "Loop - Actions" for each unit separately. So if TempGroup contains 8 units, you will call those two custom scripts 8 times.
On top of that, why are you clearing TempGroup and TempPoint variables, which have values assigned outside the "Unit Group - Pick every unit..." action, inside the "Loop - Actions"?

Furthermore, the range used in your "Unit Group - Pick every unit..." actions is fishy at best.

Next, you have a situation where you set some unit to TempUnitArray[..]. Then you pick every unit within 5000.00 of TempUnitArray[..] and order TempUnitArray[..] to right-click each unit in that unit group. So, again, if the unit group contains 10 units, you will give 10 orders to TempUnitArray[..]. Although only the the latest order is the one being kept, this seems like it will cause issues in conjunction with your OrderSeysi trigger.

Ebengrup trigger
I don't know your map, but this trigger has a few holes in it:
#1 Your conditions allow the trigger to fire when zUG_TowersReaper unit attacks zUG_CreepsReaper unit (friendly fire)

#2 Let's say that this trigger fires. The (Attacked unit) is zUG_CreepsReaper, the (Attacking unit) is zUG_TowersDevil. Everything so far seems ok... except the next thing you do is you pick all units within 800.00 of (Attacked unit), which belongs to zUG_CreepsReaper, and if that picked unit belongs to zUG_CreepsReaper OR zUG_CreepsDevil, you add them to EBENGRUP.
So zUG_CreepsDevil are incorrectly added to EBENGRUP when their allied tower attacks enemies.

#3 Why are you clearing up TempPoint both inside and outside the If/Then/Else?

KuledenKacReaper + Ebengrup triggers
Sooo... let's say I play your map. I see that a unit is attacked. In that moment, the following is true:
  • (Attacked unit) belongs to ClanReaperPlayer
  • (Attacked unit) is not in EBENGRUP
  • (Attacked unit) is in zUG_CreepsReaper
  • (Attacking unit) is in zUG_TowersDevil
My question is: Which trigger fires first? Ebengrup or KuledenKacReaper?


OrderSeysi trigger
I don't understand why this trigger exists in the first place. I understand what it does, but not why you use it.
In your KuledenKacReaper trigger you have actions like this:
  • Set zBool_BotCreepBuldu[(Player number of (Owner of TempUnitArray[(Player number of (Owner of (Picked unit)))]))] = True
  • Cinematic - Ping minimap for PG_Debug at (Position of (Picked unit)) for 1.00 seconds
  • Unit - Order TempUnitArray[(Player number of (Owner of (Picked unit)))] to Right-Click (Picked unit)
At this point, you know which unit you are ordering to right-click and who is the target unit of the order.
So why did you move the remaining actions into OrderSeysi trigger? This just forces you to do additional checks and whatnot.

You should not use this action:
  • Trigger - Add to CreepBulduSeysi <gen> the event (Unit - A unit comes within 250.00 of TempCreep[(Player number of (Owner of (Triggering unit)))])
in this trigger which is just a generic trigger reacting to unit being ordered to target some other unit.
The way you use it, you will add this event for same unit multiple times. In your case, the event is "A unit comes within range of some_unit)". Well, if you add this event two times for same unit, you will start the trigger two times for same unit.
It is the equivalent of doing this:
  • Events
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
    • Unit - A unit comes within 256.00 of Footman 0001 <gen>
Notice that I have multiple events but all are for "Footman 0001". There is a total of 7 events for a single unit. So if anyone approach "Footman 0001", my trigger would fire 7 times (once for each registered event for "Footman 0001").

CreepBulduSeysi2 trigger
This is referring to the start of my post about you incorrectly using temp variables.
In your condition "(Dying unit) Equal to TempCreep[(Integer A)]", which unit is TempCreep[(Integer A)]? This temp variable is not set in this trigger, so how do we know which unit it contains?

Why do you use the "For each (Integer A)" loop here? Everywhere else you use "(Player number of (Owner of some_unit))", but here it's (Integer A).
 
Level 17
Joined
Jun 2, 2009
Messages
1,184
I do not exaggerate, i read your post 7 times. During the process i finished my coffee. Tried to understand many things and again i will request going step by step. But before i do that, i have to decide which step should be the first. Now let me think about that, then i will start with first step. This takes some time. I just need few hours.
 
Level 17
Joined
Jun 2, 2009
Messages
1,184
Each step i have take, the more things starts not to work. I want to share my problems but i do no have knowledge "how to describe it properly" because today i broke many things. Many of triggers linked and currently i do not know what to do. Now bots even cannot move and follow creeps. And i do not know "which trigger causes this" this is why it is difficult task and should i share the whole system for the get help and expect people read ALL of the triggers?

Currently i do not know what to do. If i will fix this, another trigger stops work. If i fix it, another one. My days passing just like this. I am demoralized badly.

If someone really wants me to share "every step i have failed" i will gladly do that of course.. This is AI system and problem is finding the source of the problem. This is why i cannot ask the "exact" question. If someone interest and have the time, i can go step by step. I am asking because i think it is a rude request.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,184
Ok here i am. Here is the "exact" question. Check this out @Nichilus
 

Attachments

  • zz.png
    zz.png
    48.5 KB · Views: 5
Level 26
Joined
Sep 26, 2009
Messages
2,418
as I've mentioned in my previous post, why use temp unit array in the first place? why not just a non-array variable?

Instead of this:
  • Set TempUnitArray[(Player number of (Owner of (Picked unit)))] = (Picked unit)
  • Unit Group - Pick every unit in (Units within 5000.00 of (Position of TempUnitArray[(Player number of (Owner of (Picked unit)))])) and do (Actions)
    • Loop - Actions
      • ...
      • Game - Display to (All players) the text: ((Name of TempUnitArray[8]))
you can have this to achieve the same thing in way easier manner:
  • Set TempUnit = (Picked unit)
  • Unit Group - Pick every unit in (Units within 5000.00 of (Position of TempUnit)) and do (Actions)
    • Loop - Actions
      • ...
      • Game - Display to (All players) the text: ((Name of TempUnit))
 
Level 26
Joined
Sep 26, 2009
Messages
2,418
the "Unit Group - Pick every unit..." action creates a group of units and then goes through each unit, one by one, and executes all actions inside
  • Loop - Actions
This does not happen at the same time for all units in the group, instead it happens sequentially. So if your group contains 3 units, then the first unit of the group is picked, then all actions inside "Loop - Actions" are performed. Then second unit is picked and all actions inside "Loop - Actions" are executed. And then the same for the third unit.
As such, using just "TempUnit" non-array variable is totally valid and will work as intended.
 
Level 17
Joined
Jun 2, 2009
Messages
1,184
That means i cannot make it work for everyone. Thank you for your interest. Ok then, i am returning my old system. Here is the specific question now.

  • CreepFallBack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) is in HerolarBotALL) Equal to True
      • ((Attacked unit) is in zUG_RegenALL) Equal to False
      • fAI_run_creep[(Player number of (Owner of (Attacked unit)))] Equal to False
      • (Level of (Attacked unit)) Less than or equal to 21
      • Or - Any (Conditions) are true
        • Conditions
          • ((Attacking unit) is in zUG_CreepsDevil) Equal to True
          • ((Attacking unit) is in zUG_CreepsReaper) Equal to True
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: (Name of the current trigger)
      • Set fAI_run_creep[(Player number of (Owner of (Attacked unit)))] = True
      • Set TempPoint = ((Position of (Attacked unit)) offset by 375.00 towards ((Angle from (Position of (Attacking unit)) to (Center of PreviousTarget[(Player number of (Owner of (Attacked unit)))])) - 0.00) degrees)
      • Unit - Order (Attacked unit) to Move To TempPoint
      • Countdown Timer - Start BotCreeptenKacma[(Player number of (Owner of (Attacked unit)))] as a One-shot timer that will expire in 2.00 seconds
      • Cinematic - Ping minimap for (All players) at TempPoint for 1.00 seconds, using a Simple ping of color (0.00%, 100.00%, 0.00%)
      • Custom script: call RemoveLocation (udg_TempPoint)
  • BotCreepTimer
    • Events
      • Time - BotCreeptenKacma[2] expires
      • Time - BotCreeptenKacma[3] expires
      • Time - BotCreeptenKacma[4] expires
      • Time - BotCreeptenKacma[5] expires
      • Time - BotCreeptenKacma[6] expires
      • Time - BotCreeptenKacma[8] expires
      • Time - BotCreeptenKacma[9] expires
      • Time - BotCreeptenKacma[10] expires
      • Time - BotCreeptenKacma[11] expires
      • Time - BotCreeptenKacma[12] expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if (GetExpiredTimer() == udg_BotCreeptenKacma[bj_forLoopAIndex]) then
          • Set TempInt = (Integer A)
          • Custom script: exitwhen true
          • Custom script: endif
          • Set fAI_run_creep[TempInt] = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempInt Less than or equal to 6
            • Then - Actions
              • Set AIStuckDevilIndex = (Integer A)
              • Trigger - Run HeroTakilincaDevilRun <gen> (checking conditions)
            • Else - Actions
              • Set AIStuckReaperIndex = (Integer A)
              • Trigger - Run HeroTakilincaReaperRun <gen> (checking conditions)
I believe fAI_run_creep[TempInt] never set to False again.
Heroes running away from creeps only once. Am i missing something in here?
 
Top