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

Trigger problem; how to recognize targets?

Status
Not open for further replies.
Level 22
Joined
Jan 10, 2005
Messages
3,426
So I got this trigger:

  • Combustion
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Combustion Dummy
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Combustion (Pyromancer) for Pyromancer) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Random 3 units from (Units within 650.00 of (Position of (Dying unit)))) and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Fire Chain Dummy for (Owner of Pyromancer) at (Position of (Dying unit)) facing Default building facing degrees
              • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Picked unit)
        • Else - Actions
          • Do nothing
How do I make sure those dummy units won't cast their spell on the same target?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

First of all you can create a unit group variable. Then you create the trigger and make a loop from 1 to 3.
Then you pick random 1 unit with the condition, if the unit is in the unitgroup equal to false then do xxx.
After do xxx you add the action "unit at x to unitgroup"

After the loop you remove every unit from the group and clear the group.

Edit: I hope I write the trigger correct here (don't have wc3 installed for now)
  • TestTrigger
    • Events
    • Conditions
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
        • For each (Integer A) from 1 to 3, do (Actions)
          • Loop - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Random 1 units from (Units within 650.00 of TempLoc)) and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ((Picked unit) is in TempGroup) Equal to (==) False
                  • Then - Actions
                    • Unit Group - Add (Picked unit) to TempGroup
                    • -------- Do other actions here --------
                  • Else - Actions
            • Unit Group - Pick every unit in TempGroup and do (Actions)
              • Loop - Actions
                • Unit Group - Remove (Picked unit) from TempGroup
                • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempPoint)
Greetings
~ The Bomb King > Dr. Boom
 
Status
Not open for further replies.
Top