• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Gate trigger

Status
Not open for further replies.
Level 2
Joined
Sep 7, 2014
Messages
17
Is it possible to make a trigger that will repeatedly force enemy units to attack the gate if gate is closed and to attack units behind the gate if the gate is open/destroyed?
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
It is. I don't have access to WE right now but it'll go along the lines of "every 2 seconds pick every unit in region and belonging to <attacking player>" (where the region contains the gates) and "order picked unit to attack gate".

I assume run the trigger every 2 seconds because the AI is likely to focus the units back on the ones behind the gate if they get attacked.

Alternatively you can make the gate a unit with a very small attack (AI will ignore it otherwise) and replace it with a destroyed gate doodad when it dies, via trigger.

//\\oo//\\
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Theory #1 " Gate is a destructible " :

With a periodic event , or any event of your choice, check if the destructible 'Gate' is alive, if yes, pick every unit far from the gate X radius ( for example 500 ) then order it to attack. If the gate is destroyed, either do : 1- Pick every unit from 500 radius from the gate and order it to attack-move behind the gate, OR , create a region and order them to move to it, there are many solutions for this.

Theory #2 ' Gate is a unit ':

Just Order your units to attack-move behind the gate with one of the ways stated above ( using region point or polar offset ) , they will automatically attack the gate 'til they reach units behind it.

Example for polar offset :

  • Set Beyond_The_Gate_Point = ( (Position of destructible 'Gate') offset by 600 towards (Gate Facing - 180))
  • Unit Group - Pick every unit in Enemies_Group and do multiple actions
    • Loop - Actions
      • Unit - Issue order unit to attack-move to Beyond_The_Gate_Point
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
order the unit to attack-move to a location. It'll attack anything it sees on its way. (not sure if it works on gates though)

If that doesn't work go with Boris's solution.

The AI will not auto-target gates, since they are neutral-passive non-units. I've never seen the AI destroy non-tree destructibles.

Theory #1 " Gate is a destructible " :

With a periodic event , or any event of your choice, check if the destructible 'Gate' is alive, if yes, pick every unit far from the gate X radius ( for example 500 ) then order it to attack. If the gate is destroyed, either do : 1- Pick every unit from 500 radius from the gate and order it to attack-move behind the gate, OR , create a region and order them to move to it, there are many solutions for this.

Theory #2 ' Gate is a unit ':

Just Order your units to attack-move behind the gate with one of the ways stated above ( using region point or polar offset ) , they will automatically attack the gate 'til they reach units behind it.

Example for polar offset :

  • Set Beyond_The_Gate_Point = ( (Position of destructible 'Gate') offset by 600 towards (Gate Facing - 180))
  • Unit Group - Pick every unit in Enemies_Group and do multiple actions
    • Loop - Actions
      • Unit - Issue order unit to attack-move to Beyond_The_Gate_Point

If the gate is a unit, it must have an attack for the AI to consider it to be worth killing unless no other enemy units are within the acquisition range.

//\\oo//\\
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
The AI will not auto-target gates, since they are neutral-passive non-units. I've never seen the AI destroy non-tree destructibles.
He actually means Units behind the gate, he wasn't sure about the gate also :D

If the gate is a unit, it must have an attack for the AI to consider it to be worth killing unless no other enemy units are within the acquisition range.

I didn't know you use AI, you had better add a very low attack ( 1 - 1 ) with range 1 ... It would not affect...

Is the gate consider as destroyed when it is open?

Not sure about this, afaik not.

You can open it by a trigger and add boolean that it's open, and instead of checking if it's dead, check if the boolean is correct. Like this:
  • Animation - Play Gate 0001 Open Animation
  • Set Gate_Is_Open = True

Then before ordering the AI to attack-move to the beyond-gate-location, check if this boolean is true...
 
Level 12
Joined
Oct 16, 2010
Messages
680
Again, opened gates are considered dead , that is why u can walk through

I didn't know you use AI, you had better add a very low attack ( 1 - 1 ) with range 1 ... It would not affect...

make the bridge as a unit (neutral hostile) and set its priority to 20 (its the max)

then AI will target it first

however that means if there is a huge fight and there is one gate then AI will rush on it:D
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
He actually means Units behind the gate, he wasn't sure about the gate also :D

I didn't know you use AI, you had better add a very low attack ( 1 - 1 ) with range 1 ... It would not affect...

He wants to make sure the gate is dead before attacking units behind the gate. Unless he has a visibility modifier in place, the units will attempt to kill whatever is attacking them. Destructibles don't get targeted as something to kill unless you specifically order them destroyed.

The AI control also dictates what un-microed player units do too. The 'call for help when attacked' will draw in all units that are standing around in the vicinity. Units with orders will ignore this. If the units are controlled by an AI players, you'll need to repeatedly tell them to attack the gate unless it is a unit with an attack. If it has no attack & no enemy units in the aquisition range are present - then the AI will target the defenseless unit.

//\\oo//\\
 
Status
Not open for further replies.
Top