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

My trigger-based SF AI bypassing some condition!! HELP!!!

Status
Not open for further replies.
Level 4
Joined
Mar 24, 2012
Messages
24
I am making my custom Shadow Fiend AI using GUI triggers for a custom map.... :goblin_good_job:
My current problem is related to its Ultimate Skill - Requiem of Souls function..
Here's how it supposed to work... :vw_sleep:
The SF AI will use its Requiem of Souls when; :vw_unimpressed:

  • If - Conditions
    • (Number of units in Enemy Group) Greater than 0
    • Or - Any (Conditions) are true
      • Conditions
        • (SF has buff Wind Walk) Equal to True
        • (Number of units in Enemy Group) Greater than or equal to 3
        • (Percentage life of SF) Less than or equal to 35.00
        • And - All (Conditions) are true
          • Conditions
            • (Current order of SF) Equal to (Order(tranquility))
            • (Percentage life of SF) Less than or equal to 40.00
        • And - All (Conditions) are true
          • Conditions
            • (Current order of SF) Equal to (Order(tranquility))
            • (Percentage life of SF) Greater than 40.00
            • DistanceX Less than or equal to 400.00
        • And - All (Conditions) are true
          • Conditions
            • RandomChance Less than or equal to 0.16
            • (SF has an item of type Rikimaru's Cloak) Equal to True
        • And - All (Conditions) are true
          • Conditions
            • Shadowraze[Z]'s Cooldown Greater than 0.00
            • Shadowraze[X]'s Cooldown Greater than 0.00
            • Shadowraze[C]'s Cooldown Greater than 0.00
            • RequiemOfSouls' Cooldown Less than or equal to 0.00
        • And - All (Conditions) are true
          • Conditions
            • DistanceX Less than or equal to 300.00
            • Shadowraze[Z]'s Cooldown Greater than 0.00
Where,
- SF is "unit" "picked unit"
- Enemy Group is "unit group" "enemy within 800 AoE"
- DistanceX is "real" "closest distance of nearby enemy unit"
- Rikimaru's Cloak is "item" "provides Wind Walk buff/effect"
- Shadowrazes are "custom skills/abilities"
- Order ID of Requiem of Souls is "tranquility"

If some condition are met, the SF will do Requiem of Souls "order unit - tranquility". Otherwise, if its current order is "tranquility", I ordered them to "order - stop"....

OK, now for the problem, MY AI IS SOMEHOW ABLE TO BYPASS "unit count in Enemy Group condition", I don't know where my mistake is but i'm guessing the AI considered nearby allies as, enemies!!?? :goblin_jawdrop: :vw_wtf: :goblin_boom: :ogre_rage:

And the weirdest thing is, sometimes it will do Requiem of Souls even though no units is in range except itself/himself.... Here, im guessing, either dummy units are located, considered "alive" and as an "enemy" nearby the SF or it interferes with the SF itself, which will eventually try to use the custom made Requiem of Souls ability to mimic its original one (the ability which I made it from...), The Keeper of The Grove's Tranquility as a sign of desperation for it to "heal" itself even though I've set all values of its custom ability to absolute zero?

Please, help me find a way to fix it... :vw_death:
 
Level 4
Joined
Mar 24, 2012
Messages
24
Okay, help me fix this, else just say this trigger fail and I'll make a better one :)

  • AI Insane Part 2 Final Attack Function
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set group[1] = (Units in (Playable map area) matching ((((((((Matching unit) is alive) Equal to True) and (((Matching unit) is in WANT_HEAL_SO_BAD) Equal to False)) and (((Matching unit) is in AI_EVADE_ULTI) Equal to False)) and (((Matching unit) is in AIBusy_Selling) Equal to False and ((Melee AI of Owner of (Matching Unit))) Equal to Insane AI) and ((((Matching Unit) is A Hero) Equal to True) and (((Owner of (Matching Unit)) controller) Equal to Computer)
      • Unit Group - Pick every unit in group[1] and do (Actions)
        • Loop - Actions
          • Set unit[1] = (Picked unit)
          • Set unitowner[1] = (Owner of unit[1])
          • Set P = (Position of unit[1])
          • Custom script: set udg_ID = udg_unit[1]
          • -------- ========================================================================= --------
          • Set group[3] = (Units within 850.00 of P matching (((((((Matching unit) is alive) Equal to True) and (((Matching unit) is A Hero) Equal to True)) and ((Matching unit) Not equal to unit[1])) and (((Matching unit) is visible to unitowner[1]) Equal to True)) and (((Matching un
          • Set real[2] = (Load 1 of (Key ID) from AIInsaneCheckCD)
          • Set real[3] = (Load 2 of (Key ID) from AIInsaneCheckCD)
          • Set real[4] = (Load 3 of (Key ID) from AIInsaneCheckCD)
          • Set real[5] = (Load 4 of (Key ID) from AIInsaneCheckCD)
          • -------- ----------- ///////////////////////////////////// -------------------- --------
          • Set real[1] = 850.00
          • Unit Group - Pick every unit in group[3] and do (Actions)
            • Loop - Actions
              • Set P_array[1] = (Position of (Picked unit))
              • Set real[2] = (Distance between P and P_array[1])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • real[2] Less than or equal to real[1]
                • Then - Actions
                  • Set real[1] = real[2]
                  • Set unit[2] = (Picked unit)
                • Else - Actions
              • Custom script: call RemoveLocation (udg_P_array[1])
          • -------- ----------- REQUIEM OF SOULS FUNCTION -------------------- --------
          • Set real[10] = (Random real number between 0.00 and 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in group[3]) Greater than 0
              • Or - Any (Conditions) are true
                • Conditions
                  • (unit[1] has buff Wind Walk) Equal to True
                  • (Number of units in group[3]) Greater than or equal to 3
                  • (Percentage life of unit[1]) Less than or equal to 35.00
                  • And - All (Conditions) are true
                    • Conditions
                      • (Current order of unit[1]) Equal to (Order(tranquility))
                      • (Percentage life of unit[1]) Less than or equal to 40.00
                      • (Number of units in group[3]) Greater than 0
                  • And - All (Conditions) are true
                    • Conditions
                      • (Current order of unit[1]) Equal to (Order(tranquility))
                      • (Percentage life of unit[1]) Greater than 40.00
                      • real[1] Less than or equal to 400.00
                      • (Number of units in group[3]) Greater than 0
                  • And - All (Conditions) are true
                    • Conditions
                      • real[10] Less than or equal to 0.16
                      • (unit[1] has an item of type Rikimaru's Cloak) Equal to True
                  • And - All (Conditions) are true
                    • Conditions
                      • real[2] Greater than 0.00
                      • real[3] Greater than 0.00
                      • real[4] Greater than 0.00
                      • real[5] Less than or equal to 0.00
                  • And - All (Conditions) are true
                    • Conditions
                      • real[1] Less than or equal to 300.00
                      • real[2] Greater than 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • real[5] Less than or equal to 0.00
                • Then - Actions
                  • Unit Group - Remove unit[1] from AIHiding_group
                  • Unit Group - Remove unit[1] from AICamping_Group
                  • Unit Group - Remove unit[1] from AI_WANNA_GET_ITEMS
                  • Unit Group - Remove unit[1] from AI_BUY_UPGRADE
                  • Unit Group - Remove unit[1] from AIBusy_Selling
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • real[10] Less than or equal to 0.16
                    • Then - Actions
                      • Hero - Order unit[1] to use (Item carried by unit[1] of type Rikimaru's Cloak)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (unit[1] has buff Wind Walk) Equal to False
                    • Then - Actions
                      • Unit - Order unit[1] to Human Mountain King - Storm Bolt unit[2]
                      • Set P_array[1] = (Position of unit[2])
                      • Hero - Order unit[1] to use (Item carried by unit[1] of type Kelen's Dagger) on P_array[1]
                      • Custom script: call RemoveLocation (udg_P_array[1])
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in group[3]) Greater than 0
                      • Or - Any (Conditions) are true
                        • Conditions
                          • real[1] Less than or equal to 130.00
                          • And - All (Conditions) are true
                            • Conditions
                              • real[1] Less than or equal to 600.00
                              • (Percentage life of unit[1]) Less than or equal to 35.00
                              • (Number of units in group[3]) Greater than 1
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (unit[1] is in AI_INSANE_DO_SKILL) Equal to False
                          • (Current order of unit[1]) Not equal to (Order(stormbolt))
                        • Then - Actions
                          • Player - Enable Abam's Exorcism Requiem for unitowner[1]
                          • Player - Enable Abam's Holy Requiem for unitowner[1]
                          • Player - Enable Abam's Requiem of Souls for unitowner[1]
                          • Unit Group - Add unit[1] to AI_DOING_ULTI
                          • Hero - Order unit[1] to use (Item carried by unit[1] of type Banish Blade) on unit[2]
                          • Hero - Order unit[1] to use (Item carried by unit[1] of type Dark Zeus Amulet)
                          • Hero - Order unit[1] to use (Item carried by unit[1] of type Mage Staff) on unit[2]
                          • Hero - Order unit[1] to use (Item carried by unit[1] of type Fist of the Doom) on unit[2]
                          • Unit Group - Add unit[1] to AI_INSANE_DO_SKILL
                          • Unit Group - Remove unit[1] from AI_Insane_MoodChange
                          • Custom script: call IssueImmediateOrderBJ( udg_unit[1], "tranquility" )
                        • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Number of units in group[3]) Equal to 0
                              • And - All (Conditions) are true
                                • Conditions
                                  • real[1] Greater than 130.00
                                  • (Percentage life of unit[1]) Greater than 35.00
                                  • (Current order of unit[1]) Not equal to (Order(tranquility))
                              • And - All (Conditions) are true
                                • Conditions
                                  • real[1] Greater than 500.00
                                  • (Percentage life of unit[1]) Greater than 35.00
                              • And - All (Conditions) are true
                                • Conditions
                                  • real[1] Greater than 500.00
                                  • (Percentage life of unit[1]) Less than or equal to 35.00
                                  • (Number of units in group[3]) Equal to 1
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Current order of unit[1]) Equal to (Order(tranquility))
                            • Then - Actions
                              • Unit - Order unit[1] to Stop
                              • Unit Group - Remove unit[1] from AI_DOING_ULTI
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of units in group[3]) Greater than 0
                                • Then - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Current order of unit[1]) Not equal to (Order(move))
                                    • Then - Actions
                                      • Set P_array[1] = (Position of unit[2])
                                      • Unit - Order unit[1] to Move To P_array[1]
                                      • Custom script: call RemoveLocation (udg_P_array[1])
                                    • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • real[1] Greater than 450.00
                                    • Then - Actions
                                      • Hero - Order unit[1] to use (Item carried by unit[1] of type Scepter of Cyclone Divinity) on unit[2]
                                    • Else - Actions
                                • Else - Actions
                        • Else - Actions
                • Else - Actions
                  • Unit Group - Remove unit[1] from AI_DOING_ULTI
                  • Hero - Order unit[1] to use (Item carried by unit[1] of type Scepter of Cyclone Divinity) on unit[2]
                  • Hero - Order unit[1] to use (Item carried by unit[1] of type Fist of the Doom) on unit[2]
                  • Hero - Order unit[1] to use (Item carried by unit[1] of type Refresher Orb)
                  • Hero - Order unit[1] to use (Item carried by unit[1] of type Rikimaru's Cloak)
                  • Hero - Order unit[1] to use (Item carried by unit[1] of type Scepter of Cyclone Divinity) on unit[1]
                  • Player - Disable Abam's Exorcism Requiem for unitowner[1]
                  • Player - Disable Abam's Holy Requiem for unitowner[1]
                  • Player - Disable Abam's Requiem of Souls for unitowner[1]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current order of unit[1]) Equal to (Order(tranquility))
                • Then - Actions
                  • Unit - Order unit[1] to Stop
                  • Unit Group - Remove unit[1] from AI_DOING_ULTI
                • Else - Actions
          • -------- ----------- ///////////////////////////////////// -------------------- --------
          • Custom script: call DestroyGroup (udg_group[3])
          • -------- ========================================================================= --------
          • Custom script: call RemoveLocation (udg_P)
          • Unit Group - Remove unit[1] from group[1]
          • Set unit[1] = No unit
      • Custom script: call DestroyGroup (udg_group[1])
I put some very specific conditions and it seems to not fit the trigger screen so I'll just say it,

In group[1], I'm picking some SF units from Computer controlled players,
-matching unit must be alive
-matching unit must not be "busy selling items"
-matching unit must not be "in desperate need to heal itself"
-matching unit's computer AI is Insane AI
-matching unit must not be "in desperate need to evade other enemy SFs within range which are doing ultimate skill"
-matching unit is a hero

In group[3], I'm helping the picked SF units to find/search their enemies within 850 AoE,
-matching unit must be alive
-matching unit is a hero
-matching unit is not "the SF who's doing the searching"
-matching unit is an enemy of "owner of SF who's doing the search"
-matching unit is visible to the "owner of SF who's doing the search"

note: unit[2] = SF's targeted enemy = the one nearest to SF
real[1] = Distance from SF to SF's targeted enemy
real[2] = Cooldown of Shadowraze[Z]
real[3] = Cooldown of Shadowraze[X]
real[4] = Cooldown of Shadowraze[C]
real[5] = Cooldown of Requiem of Souls

"stormbolt" order ID is for my Sven's Storm Bolt stun ability(non-AoE)
"tranquility" order ID is for my Requiem of Souls ability
 
I won't pretend to understand your entire trigger, but have you tried breaking it up into several triggers by assigning variables and using them as triggering events? In my experience the more you put into a single trigger, the more difficult it becomes to identify the culprit when it glitches. It seems as though you are attempting to make 1 trigger do at least 3 functions. I might be way off and maybe there's a really good reason for what your doing. However, in attempting to identify a bug, it is useful to have short simple triggers so that you can pinpoint which one is misfiring. I'm probably no help, I know.
 
Level 4
Joined
Mar 24, 2012
Messages
24
I thank you all

thanks for all the tips... Now I know that I must make simple triggers, each trigger with 1 function only... furthermore, if I want to check which order the AI gives, just use Floating Text action which shows the unit's current order using the event - Unit is issued order (no target).. since they'll only use razes and requiem of souls... thanks anyway folks :goblin_good_job:
 
Status
Not open for further replies.
Top