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

[General] Need help with unit attack ! this is exhausting.

Status
Not open for further replies.
Level 3
Joined
Sep 25, 2020
Messages
36
Hi guys!

I hope someone can help out. I was trying to place building's as a barricade where unit's will attempt to attack the barricades first. unfortunately once my units attack the attacking enemies they totally ignore the barricade and finds a way to attack my unit's.

And yes! I did my research already with older post's! for the past 4 days already! unfortunately this just led people having unsatisfying triggers.

This is the only problem i had with my map. here's what i want to happen
1. create a unit every seconds
2. unit attacks any random units i have
3. unit will attack the barricades first before they attack my heroes who are behind the barricade.

Someone please im losing hope no one has posted a proper resolution on the older threads.
 
Level 3
Joined
Sep 25, 2020
Messages
36
i found something more, check Creeps do not attack Barricades
i did not test it however

This community is awesome thanks for the reply, The thread that you shared @a|mun was the one that i mentioned in my original post that i already checked. the resolution was not that good, the user was forced to add spell "tornado auro" to zombies just to break the barricades which is not what i have in mind. @chopinski yes i already messed that priorities and it did nothing
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
I think it has to do with Armor types. I remember reading something like targets with Fortified armor get ignored if there are other non-Fortified targets nearby.

Also, try giving your barricades an attack that deals 0-0 damage. That may draw the attention of the enemy AI.
 
Level 12
Joined
Feb 5, 2018
Messages
521
How about hidden taunt? Make the barricades buildings owned by player. Order the barricades to cast taunt with some conditions.

Remove the effects from the taunt.

The taunt could also have maxium number of targets set to 1 or 2, and small AoE, so it wouldn't bug the units running around hitting different barricades.
 
Level 21
Joined
Dec 4, 2007
Messages
1,473
The solution you picked up is one of many offered in the thread.

I think the most impactful/practical way (also with the most workload) would be to replace your barricades with attacking units (structures are by default low priority) + pathing blockers.

The taunt solution might be worthwhile too.
If you can live with zombies attacking walls primarily, since they will ignore units, even if they stand right behind them.
 
Level 3
Joined
Sep 25, 2020
Messages
36
I think it has to do with Armor types. I remember reading something like targets with Fortified armor get ignored if there are other non-Fortified targets nearby.

Also, try giving your barricades an attack that deals 0-0 damage. That may draw the attention of the enemy AI.
yea i already did that.
@DoomBlade are you trying to impose a trigger?
@A]mun thats interesting however if i replace the barricades units they will spin because of the unit-rotation. what do you mean about pathing blockeres
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
yea i already did that.
@DoomBlade are you trying to impose a trigger?
@A]mun thats interesting however if i replace the barricades units they will spin because of the unit-rotation. what do you mean about pathing blockeres
Set the unit's Movement Type to None and Speed Base to 0. They will no longer be able to turn or move but they can still attack and cast spells.
 
Level 3
Joined
Sep 25, 2020
Messages
36
Set the unit's Movement Type to None and Speed Base to 0. They will no longer be able to turn or move but they can still attack and cast spells.

I already twicked game-constants and set movement speed to 0. problem is unit-turn is not inlcuded in the option so the minimum turn-speed will be 0.10 in the editor, i already thought of that however its capped under 0.10
 
Level 3
Joined
Sep 25, 2020
Messages
36
The Turn Rate stat doesn't matter in this case, a Unit with those settings will NOT turn. Movement Type needs to be NONE.

it will, if its a unit with atleast 0.10 turn it will face the unit that his attacking regardless the movement speed i already tried them you can try it yourself once a unit is placed under 0 movement speed they are already considered a building by the AI and will totally ignore them like the rest of the buildings.
 
Level 3
Joined
Sep 25, 2020
Messages
36
The solution you picked up is one of many offered in the thread.

I think the most impactful/practical way (also with the most workload) would be to replace your barricades with attacking units (structures are by default low priority) + pathing blockers.

The taunt solution might be worthwhile too.
If you can live with zombies attacking walls primarily, since they will ignore units, even if they stand right behind them.

im totally fine with that. can you make me a tuant script for all barricades to taunt nearby units
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
im totally fine with that. can you make me a tuant script for all barricades to taunt nearby units
Either it's different on older versions (i'm using the latest patch) or you aren't changing the Movement Type as well. I just tested it, the units will NEVER turn.

But if the AI treats them like a building in this case than it doesn't matter anyway, although I'm not sure if that's confirmed or not.
 
Level 21
Joined
Dec 4, 2007
Messages
1,473
Units are considered a building (priority wise) with 0 movement?

This begins to intrigue me verily, i'll give it a more thorough testing.
 
Level 3
Joined
Sep 25, 2020
Messages
36
Either it's different on older versions (i'm using the latest patch) or you aren't changing the Movement Type as well. I just tested it, the units will NEVER turn.

But if the AI treats them like a building in this case than it doesn't matter anyway, although I'm not sure if that's confirmed or not.

im using an older version but i dont think the trigger will be that complicated r
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
im using an older version but i dont think the trigger will be that complicated r
What trigger? All I'm saying is that setting a unit's Movement Type to NONE and Speed Base to 0 will prevent it from turning. At least that's how it works on the latest patch.

My suggestion was to use a Unit as a barricade with these movement settings, give it an Attack of 0-0, and give it non-fortified Armor.
 
Level 21
Joined
Dec 4, 2007
Messages
1,473
^ Don't we have to make those flying so that we can put pathing blockers under them?
(btw you can make their movement type flying without beging targeted as air, so melee units can still attack them)

Indeed 0 movement speed makes the zombies ignore them.

Findings:
The solution so far is to have 1 movement speed, 1 max, 0 minimum (change gameplay constants to allow 0 movement speed for buildings).
Give them attack (0-0 works).
No fortified armor.

New problems:
The walls are turning now, very slowly (even with 0 turn rate).
The walls are moving now, very slowly.
Walls will be focussed, even if units are close.
 
Level 19
Joined
Feb 27, 2019
Messages
563
Lartin posted this in a thread a time ago: call SetUnitPropWindow(<Unit>,0)
Combine that with setting Turn rate to 0.00 and the unit wont be able to move or turn.
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
Alright, I think I found a decent solution that solves most noticeable issues.

The Barricade Unit is setup so that it cannot move/turn and has an attack to draw enemy aggro.

It's model is made hidden by changing it's transparency to 100% and in it's place is a Barricade Special Effect.

This Special Effect mimics the model of the Barricade.

IMPORTANT: I use a Unit Indexer to link each Barricade to it's respective Special Effect. You might need to find an older Unit Indexer that's compatible with your map version. Just search for Unit Indexer, they should all be pretty similar.
  • Setup Barricades 1
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Barricade) and do (Actions)
        • Loop - Actions
          • Set VariableSet Barricade_Point = (Position of (Picked unit))
          • Special Effect - Create a special effect at Barricade_Point using Doodads\LordaeronSummer\Terrain\Barricade\Barricade0.mdl
          • Special Effect - Set Yaw of (Last created special effect) to: (Radians((Facing of (Picked unit))))
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Set VariableSet Barricade_Sfx[(Custom value of (Picked unit))] = (Last created special effect)
          • Custom script: call RemoveLocation (udg_Barricade_Point)
  • Setup Barricades 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Barricade
    • Actions
      • Set VariableSet Barricade_Point = (Position of (Triggering unit))
      • Special Effect - Create a special effect at Barricade_Point using Doodads\LordaeronSummer\Terrain\Barricade\Barricade0.mdl
      • Special Effect - Set Yaw of (Last created special effect) to: (Radians((Facing of (Triggering unit))))
      • Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Set VariableSet Barricade_Sfx[(Custom value of (Triggering unit))] = (Last created special effect)
      • Custom script: call RemoveLocation (udg_Barricade_Point)
  • Barricade Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Barricade
    • Actions
      • Special Effect - Destroy Barricade_Sfx[(Custom value of (Triggering unit))]
 

Attachments

  • unit settings 1.png
    unit settings 1.png
    56.7 KB · Views: 35
  • unit settings 2.png
    unit settings 2.png
    76.2 KB · Views: 41
  • unit settings 3.png
    unit settings 3.png
    64.9 KB · Views: 42
  • unit settings 4.png
    unit settings 4.png
    60.9 KB · Views: 33
  • Barricade.w3m
    22.6 KB · Views: 28
Last edited:
Level 21
Joined
Dec 4, 2007
Messages
1,473
Lartin posted this in a thread a time ago: call SetUnitPropWindow(<Unit>,0)
Combine that with setting Turn rate to 0.00 and the unit wont be able to move or turn.

That fixed the movement problem!

Now the only thing missing is stopping their turning.
 
Level 19
Joined
Feb 27, 2019
Messages
563
That fixed the movement problem!

Now the only thing missing is stopping their turning.
I noticed Uncle did it better by changing the value directly in the unit editor aswell with some other fields.

On another note the barricades will be targeted even though they dont attack. So one could set their attack range to 0. That led me to a kind of solution, although an unclean one. That is if you remove spell immunity, then stun the barricade for 0 seconds so that its stunned indefinetely. Then add spell immunity back to the unit. It will still be targeted but cant turn anymore. The downsides are its implementation, the buff being displayed and it may be dispelled. If stun is dispellable.
 
Last edited:

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
I noticed Uncle did it better by changing the value directly in the unit editor aswell with some other fields.

On another note the barricades will be targeted even though they dont attack. So one could set their attack range to 0. That led me to a kind of solution, although an unclean one. That is if you remove spell immunity, then stun the barricade for 0 seconds so that its stunned indefinetely. Then add spell immunity back to the unit. It will still be targeted but cant turn anymore. The downsides are its implementation, the buff being displayed and it may be dispelled. If stun is dispellable.
Good idea. And what if you Pause the unit instead of stunning it?

We have this now which is like a triggered Stun, this might work if the original Pause doesn't:
vJASS:
BlzPauseUnitEx(whichUnit, flag)
 
Level 19
Joined
Feb 27, 2019
Messages
563
Good idea. And what if you Pause the unit instead of stunning it?

We have this now which is like a triggered Stun, this might work if the original Pause doesn't:
vJASS:
BlzPauseUnitEx(whichUnit, flag)
That is amazing! Using call BlzPauseUnitEx(whichUnit, true) works as a way to stop the barricades from moving and retain aggro. Using a regular pause however did not achieve aggro.

BUT
If the barricades can attack they will pull units while using BlzPauseUnitEx(whichUnit, flag) will only aggro if the attackers are close to it.

So it all comes down to how one would like the ai to function. I would set turn rate to max if I wanted the barricades to be able to attack because they will aggro better.

EDIT: Or both can be used, each for a different building or as an upgrade.
 
Last edited:
Level 21
Joined
Dec 4, 2007
Messages
1,473
But what if you want to upgrade the barricade/wall?

It cannot be paused/stunned then.
Just need to find the simplest way to reset their facing (you could add them to a unitgroup and do so periodically as a last straw).
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
But what if you want to upgrade the barricade/wall?

It cannot be paused/stunned then.
Just need to find the simplest way to reset their facing (you could add them to a unitgroup and do so periodically as a last straw).
Well, my method allows them to remain unpaused, the only issue that I found with it was that the Shadow would turn while in Reforged graphics. This is because you can't turn off shadows for a specific unit in Reforged.
 
Level 3
Joined
Sep 25, 2020
Messages
36
Well, my method allows them to remain unpaused, the only issue that I found with it was that the Shadow would turn while in Reforged graphics. This is because you can't turn off shadows for a specific unit in Reforged.
Hey sorry for the very late reply, so this means that the only option is to make the barricade "unit"
 
Level 3
Joined
Sep 25, 2020
Messages
36
I think the solution that you have in mind is perfect however I cant open the map, it says level info data missing or invalid.
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,455
If you're on an older version it might not work due to missing things like changing the Yaw of a Special Effect (the angle it's facing).

That aside, you can try to re-create my triggers, they're pretty simple and I posted pretty much everything you need to know. There's even pictures.
 
Status
Not open for further replies.
Top