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

[Solved] Neutral Victim/Passive & Buildings

Status
Not open for further replies.
Level 4
Joined
Nov 27, 2012
Messages
85
Having trouble finding a way to have Neutral units attack other Neutral owned buildings.
Can't order a direct target to it as the units need to attack other units on the way as well.

There are 2 options I've found that each have their own problem

1) Creating the units and changing the ownership will allow them to attack the buildings (sometimes, sometimes they just keep running through), but the units will flee when they get low
JASS:
call SetUnitOwner(CreateUnit(Player(0),udg_integer_huntress,-6336,-3936,bj_UNIT_FACING), Player(13), true )

2) Changing the buildings to units, but this causes the icons on the minimap to shrink to unit size

I know Dota 6v6 has successfully done this, but I can't figure out how

Reference threads
Neutral Units: "Fleeing" battle
Disable Neutral Hostile fleeing from towers
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,024
The only known way to get around this is to make all your buildings mechanical units.
Did you explore this possibility? Perhaps just making them mechanical (and still structures) would be enough? Though I suspect this quip about mechanical was just to make things affect them as if they were still structures, not to disallow fleeing.

In your case perhaps you could issue an attack move to the location of the building(s) initially and then when within X range of the building and there are no other 'enemy' units for it to attack manually order it to attack the building.
 
Level 4
Joined
Nov 27, 2012
Messages
85
yes that was option #2.
I think I found a couple solutions on a Tides of blood forum from 2008, going to link the info here since I saw a LOT of threads on this same issue with no solutions

www.tidesofblood.com • View topic - How did they make ToB 6v6?
www.tidesofblood.com • View topic - Alternative 6v6 Method

This would fix option #2 for me
The structures are actually units with extended vision (or whatever it's called) set to true in the object editor so they don't disappear in the fog. This is to prevent neutral from running away from towers and ignoring other structures. There's also an invulnerable dummy structure underneath with no model. This is for the ubersplat and the minimap structure blip. A simple trigger kills the dummy structure when the unit structure dies.

This made the units stop fleeing, but I couldn't get them to attack the buildings. Combined with my option #1 above, but the units still sometimes wouldn't attack the buildings
I haven't seen anything similar to this, but I haven't really looked. I found out that if a building damages a unit spawned very close to the building, owned by one of the neutral slots, and has below 60% health, other neutral units will no longer run from that building. So I call this on all my buildings:

JASS:
function FlagBuilding takes unit u returns nothing
    local unit dummy = CreateUnit(Player(12),'h000',GetUnitX(u),GetUnitY(u),0)
    call SetUnitState(dummy,UNIT_STATE_LIFE,5)
    call UnitDamageTargetBJ( u, dummy, 1.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call RemoveUnit(dummy)
    call UnitAddAbility(u,'A001')
    set dummy = null
endfunction
 
Status
Not open for further replies.
Top