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

Region Capture Trigger

Status
Not open for further replies.
Level 2
Joined
Oct 5, 2008
Messages
15
Hey there, Hiveworkshop.
I'm currently attempting to make a trigger; I'm not really that good at making them, however, and have decided to ask for some assistance here, seeing as you guys are good at such.

Generally, the main idea of the trigger is to make it so, if a unit is attacked while it's health is under 1500, the unit and every structure in the region is given to the owner of the attacker of the initial building.

I've been able to make it so every unit in the region go to the owner of the attacking unit, but currently I'm having trouble trying to figure out how to make it so the picked units are only the structure units in the region.

Here's my trigger so far:
  • Events:
  • Unit - BuildingNameGoesHere 0070 <gen> Is attacked
  • Conditions:
  • (Life of (Attacked unit)) Less than or equal to 1500.00
  • Actions:
  • Unit Group - Pick every unit in (Units in REGIONSouthernOntario <gen>) and do (Actions)
    • Loop - Actions
      • Unit - Change ownership of (Picked unit) to (Owner of (Attacking unit)) and Change color
Thanks for any and all help in advance.
 
You had better do this:
  • Trigger
  • Events
    • Unit - BuildingNameGoesHere 0070 <gen> takes damage
  • Conditions
    • (Owner of (Damage source)) Not Equal to (Owner of (Triggering unit))
    • (Life of (Attacked unit)) Less than or equal to 1500.00
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in REGIONSouthernOntario <gen> matching ((Matching unit) is a structure) Equal to True)) and do (Actions)
      • Loop - Actions
        • Unit - Change ownership of (Picked unit) to (Owner of (Damage source)) and Change color
Basically use "Units in region matching condition" and when you have to place a condition, go to Boolean comparison.
 
Level 2
Joined
Oct 5, 2008
Messages
15
Ah, that looks much better. Thanks. I'll be sure to set the Hp back to 100% as well.

If I might ask though, what exactly does that custom script do? Prevent the memory leak?
 
Status
Not open for further replies.
Top