• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] they wont use their abilitys right..

Status
Not open for further replies.
heres a trigger I wish for help for might be simple might not but the units will not use their abilitys how I want when they attack eatch other or when there is more then one unit of the same kind they wont use the ability please help :)
  • Sorcrcess
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Sorceress
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of Polymage) Equal to Player 1 (Red)
        • Then - Actions
          • Set point = (Center of Blue Castle <gen>)
          • Set Polymage = (Attacking unit)
          • Set ptarget = (Attacked unit)
          • Unit - Order Polymage to Human Sorceress - Polymorph ptarget
          • Wait 0.50 game-time seconds
          • Unit - Order Polymage to Attack-Move To point
          • Custom script: call RemoveLocation (udg_point)
        • Else - Actions
          • Set point = (Center of Red Castle <gen>)
          • Set ptarget = (Attacked unit)
          • Set Polymage = (Attacking unit)
          • Unit - Order Polymage to Human Sorceress - Polymorph ptarget
          • Set ptarget = No unit
          • Set Polymage = No unit
          • Wait 0.25 game-time seconds
          • Unit - Order Polymage to Attack-Move To point
          • Custom script: call RemoveLocation (udg_point)[trigger]
 
Level 2
Joined
Sep 27, 2010
Messages
14
Ok, so the most obvious thing here is that the wait causes your variables to get overwritten before they can be used/removed. That makes your attack move not work and also causes leaks.

Your condition also uses a variable that is not yet defined at that point.

I don't really get why the wait is shorter for when it's not owned by Player 1 or why you repeat some stuff instead of putting it before the if clause, but ok, doesn't really matter.

For the sake of simplicity I would recommend splitting this into two triggers like this:

  • Sorceress
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Sorceress
    • Actions
      • Unit - Order (Attacking unit) to Human Sorceress - Polymorph (Attacked unit)
  • Attack Move
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set TempUnitGroup (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Unit-type of (Picked unit) equal to Sorceress
              • [Add other units in your map here]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Owner of (Picked unit) Equal to Player 1 (Red)
            • Then - Actions
              • Set TempPoint = (Center of Blue Castle <gen>)
            • Else - Actions
              • Set TempPoint = (Center of Red Castle <gen>)
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempUnitGroup)

If that still causes problems you should check if things in the Object Editor and Gameplay Constants (e.g Guard Distance) could be the issue.
 
Ok, so the most obvious thing here is that the wait causes your variables to get overwritten before they can be used/removed. That makes your attack move not work and also causes leaks.

Your condition also uses a variable that is not yet defined at that point.

I don't really get why the wait is shorter for when it's not owned by Player 1 or why you repeat some stuff instead of putting it before the if clause, but ok, doesn't really matter.

For the sake of simplicity I would recommend splitting this into two triggers like this:

  • Sorceress
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Sorceress
    • Actions
      • Unit - Order (Attacking unit) to Human Sorceress - Polymorph (Attacked unit)
I tried this First and with a trigger to make them attack after they cast spells they just don't use the spells them selfs

  • Attack Move
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set TempUnitGroup (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Unit-type of (Picked unit) equal to Sorceress
              • [Add other units in your map here]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Owner of (Picked unit) Equal to Player 1 (Red)
            • Then - Actions
              • Set TempPoint = (Center of Blue Castle <gen>)
            • Else - Actions
              • Set TempPoint = (Center of Red Castle <gen>)
          • Unit - Order (Picked unit) to Attack-Move To TempPoint
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
figured I would try this in the next public test.

If that still causes problems you should check if things in the Object Editor and Gameplay Constants (e.g Guard Distance) could be the issue.

TY for the help I'm trying to get those things to work decided to put the units in a unit group after they were trained and maked it make to its simple form seems to work better. wont know till I stress test it.
 
Last edited:
Status
Not open for further replies.
Top