• 🏆 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] Does this system actually work?

Status
Not open for further replies.
Level 4
Joined
Sep 11, 2018
Messages
74
For some reason the ai sometimes use spells (some heroes) sometimes don't (some others) at all. I already made sure the spell action is correct.

  • AILearnSpells
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Gawain
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Lightfall
          • Hero - Learn skill for protagonist[2]: Arc Light
          • Hero - Learn skill for protagonist[2]: Divine Halo
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Gilgamesh
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Holy Bolt
          • Hero - Learn skill for protagonist[2]: Pierce
          • Hero - Learn skill for protagonist[2]: Holy Judgement
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Golden Princess
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Jump
          • Hero - Learn skill for protagonist[2]: Telekinesis (GUI)
          • Hero - Learn skill for protagonist[2]: Telekinetic
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Ruler
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Restoration Field
          • Hero - Learn skill for protagonist[2]: Divine Protection
          • Hero - Learn skill for protagonist[2]: Holy Shockwave
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Saber
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Omnislash
          • Hero - Learn skill for protagonist[2]: Holy Nova
          • Hero - Learn skill for protagonist[2]: Holy Dragging Spell
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Saber Lily
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Celestial Beam
          • Hero - Learn skill for protagonist[2]: Holy Cross
          • Hero - Learn skill for protagonist[2]: Aura
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of protagonist[2]) Equal to Saber Nero
        • Then - Actions
          • Hero - Learn skill for protagonist[2]: Volatile Light
          • Hero - Learn skill for protagonist[2]: Assassinate
          • Hero - Learn skill for protagonist[2]: Holy Domination
          • Hero - Learn skill for protagonist[2]: Attribute Bonus
        • Else - Actions
  • RandomAISpellChance
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer number[10]) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set randomspellchance[number[10]] = (Random integer number between 1 and 100)
  • AllyUseSpells
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_temporarygroups[1] = CreateGroup()
      • Set temporarygroups[1] = (Units in (Playable map area) matching ((Owner of (Matching unit)) Not equal to Player 1 (Red)))
      • Unit Group - Pick every unit in temporarygroups[1] and do (Actions)
        • Loop - Actions
          • Set pickedloc[1] = (Position of protagonist[2])
          • Set pickedloc[2] = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Gawain
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 50
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Dragonhawk Rider - Cloud pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 50
                • Then - Actions
                  • Unit - Order protagonist[2] to Night Elf Warden - Fan Of Knives
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Gilgamesh
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 50
                • Then - Actions
                  • Unit - Order protagonist[2] to Neutral Pandaren Brewmaster - Storm, Earth, And Fire
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 50
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Priest - Dispel (Picked unit)
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Golden Princess
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 33
                • Then - Actions
                  • Unit - Order protagonist[2] to Neutral Pandaren Brewmaster - Breath Of Fire pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 33
                  • randomspellchance[1] Less than 66
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Archmage - Blizzard pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 66
                  • randomspellchance[1] Less than or equal to 100
                • Then - Actions
                  • Unit - Order protagonist[2] to Night Elf Warden - Fan Of Knives
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Ruler
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 33
                • Then - Actions
                  • Unit - Order protagonist[2] to Night Elf Druid Of The Claw - Roar
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 33
                  • randomspellchance[1] Less than 66
                • Then - Actions
                  • Unit - Order protagonist[2] to Neutral Tinker - Cluster Rockets pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 66
                  • randomspellchance[1] Less than or equal to 100
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Mountain King - Thunder Clap
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Saber
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 33
                • Then - Actions
                  • Unit - Order protagonist[2] to Undead Lich - Frost Nova (Picked unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 33
                  • randomspellchance[1] Less than 66
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Archmage - Blizzard pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 66
                  • randomspellchance[1] Less than or equal to 100
                • Then - Actions
                  • Unit - Order protagonist[2] to Orc Far Seer - Chain Lightning (Picked unit)
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Saber Lily
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 33
                • Then - Actions
                  • Unit - Order protagonist[2] to Undead Crypt Lord - Impale (Picked unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 33
                  • randomspellchance[1] Less than 66
                • Then - Actions
                  • Unit - Order protagonist[2] to Human Archmage - Blizzard pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 66
                  • randomspellchance[1] Less than or equal to 100
                • Then - Actions
                  • Unit - Order protagonist[2] to Orc Far Seer - Feral Spirit
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of protagonist[2]) Equal to Saber Nero
              • ((Picked unit) is alive) Equal to True
              • (Distance between pickedloc[1] and pickedloc[2]) Less than or equal to 300.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Less than 33
                • Then - Actions
                  • Unit - Order protagonist[2] to Orc Far Seer - Chain Lightning (Picked unit)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 33
                  • randomspellchance[1] Less than 66
                • Then - Actions
                  • Unit - Order protagonist[2] to Neutral - Monsoon pickedloc[2]
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • randomspellchance[1] Greater than or equal to 66
                  • randomspellchance[1] Less than or equal to 100
                • Then - Actions
                  • Unit - Order protagonist[2] to Night Elf Priestess Of The Moon - Starfall
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_temporarygroups[1])
      • Custom script: call RemoveLocation(udg_pickedloc[1])
      • Custom script: call RemoveLocation(udg_pickedloc[2])
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
AllyUseSpells might be running into operation limit and hence why it does not work. It is also possible that if a unit passes multiple of the tests the earlier issued orders would be ignored.

It is also possible that other triggers conflict with the issued orders resulting in them being immediately cancelled before the abilities get cast. Disable all order related triggers to test for this.

If it is only specific abilities which are not being cast then it is possible their order has become corrupted by use of channel changing it to a different target type. To prevent this from happening channel should only use order strings of abilities with the same target type. Eg strombolt can be used for a widget targeted channel ability while blizzard can be used for a point targeted channelled ability.
 
Last edited:
Level 4
Joined
Sep 11, 2018
Messages
74
Found the culprit:
  • Custom script: call RemoveRect(udg_tempregion)
I don't know why but when I delete it in the initialize trigger, the ai use spells.
 
Level 4
Joined
Sep 11, 2018
Messages
74
Yes I did.
  • Set tempregion = (Playable map area)
you removed playable map cause it is only a reference to a object geenrated at map init
Does this mean every 'playable map area' triggers will fail?
 
Last edited:
Status
Not open for further replies.
Top