• 🏆 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 to attack random enemy units in range

Status
Not open for further replies.
Level 1
Joined
Oct 24, 2009
Messages
2
i want to summon a not-moving (ward) unit, that randomly attacks enemies in its range (400). so it does not wait till a unit is dead or out of range till it changes its target. well i made it that it changes targets, but the problem is, it also attacks my own units!!

  • Storm
    • Event
      • Unit - A unit creates a Summoned Unit
    • Conditions
      • ((Unit-type of (Summoned unit)) Equal to Storm)
    • Actions
      • For each (Integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • Unit - Order (Summoned unit) to Attack (Random unit from (Units within 400.00 of (Position of (Summoned unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Summoned unit))) Equal to True)))
          • Wait 0.30 seconds
hope i translated everything right (not english editor-version)
dont know where the mistake is; or is there any other way to trigger that?

ty for help
 
Level 2
Joined
Oct 7, 2008
Messages
10
You could just make a ward and give it the Phoenix Fire ability...and choose whatever missile effect you want.

No scripting needed...
 
Level 12
Joined
Aug 22, 2008
Messages
911
  • Events
    • Time - Every 1.00 seconds (or whatever)
  • Conditions
  • Actions
    • Set group = (Units in (Playable Map Area) matching ((Unit-type of (Matching Unit)) equal to Storm)
    • Unit Group - Pick every unit in group and do (All Actions)
      • Loop - Actions
        • Set group2 = (Units within 400.00 of (Picked Unit) matching (((Matching Unit) belongs to an enemy of (Owner of (Picked Unit))) equal to True))
        • Unit - Order (Picked Unit) to Attack (Random unit from group2)
        • Custom script: call DestroyGroup(udg_group2)
    • Custom script: call DestroyGroup(udg_group)
 
Level 1
Joined
Oct 24, 2009
Messages
2
first i have done it with phoenix fire; but i wanted to have a lightning-effect as projectile, and that didnt work with phoenix fire.

i had solved my problem by giving it the chain-lightning ability and now it doesnt attack, but cast chain lightning. this worked, without my own units being targeted; but ty, i will try and change it, cause then my storm can also attack magic-immune units.
 
Status
Not open for further replies.
Top