• 🏆 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 Need help in Triggering a simple AI

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2009
Messages
19
The situation here is whenever the unit get a hp lower than a certain amount it will cast a skill (banish) the 'nearest' enemy and start draining hp from the 'nearest' 'banished' enemy.
Otherwise it will cast offensive and negative skill on the enemy unit.
Now i facing some problem cause there are many trigger I not yet familiar with so I wish that someone will lend me some help to solve this problem , thank you.Of course +rep to those who help.

Btw this is just a draft trigger ,I will add in memory leak removal trigger later.
this unit has chain lightning , banish , life drain , cripple ,and all the skill's active string is confirmed.
  • warlock
    • Events
      • Unit - Drak'thul 0056 <gen> Is attacked
      • Unit - Drak'thul 0056 <gen> Takes damage
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Life of (Attacked unit)))) Less than or equal to 1750
          • ((Attacked unit) has buff Drain Life (Caster)) Not equal to True
        • Then - Actions
          • Unit - Order (Attacked unit) to Human Blood Mage - Banish (Attacking unit)
          • Unit - Order (Attacked unit) to Neutral Dark Ranger - Life Drain (Attacking unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Attacked unit) has buff Drain Life (Caster)) Not equal to True
            • Then - Actions
              • Unit - Order (Attacked unit) to Undead Necromancer - Cripple (Attacking unit)
              • Unit - Order (Attacked unit) to Orc Far Seer - Chain Lightning (Attacking unit)
            • Else - Actions
 
Last edited:
Level 9
Joined
May 28, 2007
Messages
365
Off the bat you can use only Takes damage, you don't need is attacked. To refer to the unit that took the damage use Triggering Unit, and the damage source as Get Event Damager Source (that's what it's called in JASS, I'm sure you can find something like it in GUI)

I think the problem is that in the same line you can't order 2 actions at the exact same time. Otherwise it actually looks fine. Try adding a Wait in between those 2 actions, see if that helps.
 
Level 5
Joined
Nov 7, 2007
Messages
134
I agree with overload119, the problem is probably that the attacked unit gets the order for the first spell, but doesn't have time to use it until it receives the next order. If you're going to add a "wait" in between the given orders, it could be a good idea to store the attacked unit in a variable and then refer to that variable for future orders. Otherwise, the trigger tends to forget who the attacked unit was after a wait.
 
Level 2
Joined
Aug 15, 2009
Messages
19
  • warlock AI Copy
    • Events
      • Unit - Drak'thul 0056 <gen> Takes damage
    • Conditions
    • Actions
      • Set warlock_position = (Position of Drak'thul 0056 <gen>)
      • Set Buffed_nearby_unitgroup = (Units within 950.00 of warlock_position matching ((((Matching unit) has buff Banish) Equal to True) and (((Matching unit) is A Hero) Equal to True)))
      • Set nearby_unitgroup = (Units within 950.00 of warlock_position)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Drak'thul 0056 <gen> has buff Drain Life (Caster)) Not equal to True
        • Then - Actions
          • Unit Group - Pick every unit in nearby_unitgroup and do (Actions)
            • Loop - Actions
              • Unit - Order Drak'thul 0056 <gen> to Human Blood Mage - Banish (Picked unit)
              • Unit - Order Drak'thul 0056 <gen> to Undead Necromancer - Cripple (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Life of Drak'thul 0056 <gen>))) Less than or equal to 1100
            • Then - Actions
              • Unit Group - Pick every unit in Buffed_nearby_unitgroup and do (Actions)
                • Loop - Actions
                  • Unit - Order Drak'thul 0056 <gen> to Orc Far Seer - Chain Lightning (Picked unit)
              • Wait 1.00 seconds
              • Unit Group - Pick every unit in Buffed_nearby_unitgroup and do (Actions)
                • Loop - Actions
                  • Unit - Order Drak'thul 0056 <gen> to Neutral Dark Ranger - Life Drain (Picked unit)
            • Else - Actions
              • Unit Group - Pick every unit in Buffed_nearby_unitgroup and do (Actions)
                • Loop - Actions
                  • Unit - Order Drak'thul 0056 <gen> to Orc Far Seer - Chain Lightning (Picked unit)
        • Else - Actions
      • Custom script: call DestroyGroup (udg_Buffed_nearby_unitgroup)
      • Custom script: call DestroyGroup (udg_nearby_unitgroup)
      • Custom script: call RemoveLocation(udg_warlock_position)
Thank overload119 +rep ,but the solution I really wanted the most is making the unit to cast a spell on the "nearest" unit , any idea how to make a trigger like this ?
Also another thing is if the unit is not taking any damage the trigger will not fire , what should i use for the event part , i want the unit always on the action and cast spell on the enemy in any condition. +rep for helper.
 
Last edited:
Status
Not open for further replies.
Top