• 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.

[Solved] Unit enters region centered at all destructibles of a type event

Status
Not open for further replies.
Level 15
Joined
Sep 6, 2015
Messages
576
Basically, I need a trigger like this:

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters (Region centered at (Position of Pine 6325 <gen>) with size (100.00, 100.00))
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Owner of (Entering unit)) controller) Equal to Computer
          • (Unit-type of (Entering unit)) Not equal to Woodcutter
          • (Unit-type of (Entering unit)) Not equal to Mutant Woodcutter
          • (Unit-type of (Entering unit)) Not equal to Woodcutter (Gnoll)
          • (Unit-type of (Entering unit)) Not equal to Goblin Shredder
    • Actions
      • Unit - Order (Entering unit) to Attack Pine 6325 <gen>
But that the "A unit enters region" event happens at every destructible of the type Pine on the map, and not only at one destructible Pine. There are 6000 trees (Pines) on my map, so making a trigger for each of them is not an option.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
Using Jass you can achieve what you are asking for. In Jass you can use loops when you specify which events are registered.
I have attached a map. You can configure:
- Range of the region to enter
- Range of the region to search for the destructible to attack

A trigger Condition Register:

Allows you to specify which destructibles should be used.
Use the custom variable MatchingDestructible to refer to the destructible. Set ReturnBoolean accordingly.

A trigger Condition Attack:

Allows you to specify if a destructibles should be attacked when entered.
Use the custom variable MatchingDestructible to refer to the destructible.
Use the custom variable EnteringUnit to refer to the unit.
Set ReturnBoolean accordingly.
 

Attachments

  • PineTrees.w3x
    19.2 KB · Views: 36
Level 15
Joined
Sep 6, 2015
Messages
576
Using Jass you can achieve what you are asking for. In Jass you can use loops when you specify which events are registered.
I have attached a map. You can configure:
- Range of the region to enter
- Range of the region to search for the destructible to attack

A trigger Condition Register:

Allows you to specify which destructibles should be used.
Use the custom variable MatchingDestructible to refer to the destructible. Set ReturnBoolean accordingly.

A trigger Condition Attack:

Allows you to specify if a destructibles should be attacked when entered.
Use the custom variable MatchingDestructible to refer to the destructible.
Use the custom variable EnteringUnit to refer to the unit.
Set ReturnBoolean accordingly.
Wow, it works perfectly. I am finally being able to make the AI work properly on my map.
Thanks both for help.
 
Status
Not open for further replies.
Top