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

Change melee AI "Home Position"

Level 6
Joined
Feb 21, 2020
Messages
77
Hello everyone. Help me plz... It is possible to Change melee AI "Home Position" (The place where he gathers all the troops) by triggers.
I need it... Because he sometimes return to this place and it is long way! (in my map he doesn't build buildings. Only troops)
I move his invisible HQ - it doesn't work. And kill HQ and create new. But it is doesn't work too!
 
Level 21
Joined
Mar 16, 2008
Messages
964
There might be a better solution out there but maybe this option can help you:

1723913234458.png

The JASS version:
JASS:
function InitOptions takes nothing returns nothing
    call SetCaptainChanges( true )
endfunction

Edit: I'm fairly sure this function relies on moving the "Start Location" but I'm not 100% sure. If that is true, then you could perhaps find the trigger that moves the start location to the exact spot you need.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
here is a workaround I have used:
if this is a unit with a preplaced position you can create a region where the unit is created, and detect whenever that unit tries to move back to a point inside that region.
if you are spawning the unit you can use the same strategy with the point the unit was spawned.
(a unit is issued an order targeting a point)
then you can check to see if the conditions where you would have wanted the unit to go back home are filled. if not - you can issue the the unit a stop order, or better yet - the order of whatever that unit should be doing.


aside from that their are several ways to alter the home position of a unit and trick the internal ai. I think if a unit is ensnared, that resets it's spawn point to there, and there are other abilities that when you either cast or are targeted by have this effect, but I don't remember what they are (just bumping into them by accident).

edit: I haven't tested this, but I think the abilities that reset the spawn point are morphing abilities because under the hood those recreate the unit.
 
Last edited:
Top