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

Unit Follow Unit

Status
Not open for further replies.
Level 5
Joined
Feb 3, 2012
Messages
107
alright so i have a problem. i want to make an allied unit follow you, but also attack nearby enemies. i tried using the 'follow' trigger but the problem was they didnt attack nearby enemies. so i played smart, used the attack-move to position of my hero, but the problem was that they would crowd over you and you'll get stuck.
so i made another improvement, i turned off the collision for that unit. and another problem occurred. in cinematics, they would crowd around the hero, and make the whole cinematic really bad. so now im out of options and any help is appreciated.
also, the friendly unit is a summoned unit that can pop up any time my hero uses an ability. tx in advance.
 
Do not use attack move to position of your unit then attack move to position of your unit ofset 150 range with random angle. Make boolean or cinemait lets name it CinematicBoolean. And when each cinematic start set cinematic equal to true, when end to false. Then add to trigger with order attack condition Cinematic boolean false equal to true. This wil stop unit from mooving
 
Level 5
Joined
Feb 3, 2012
Messages
107
tx both of u.
but can u issue a patrol order to a unit? or do i have to issue a patrol order to the position of my hero?
EDIT: i also found another idea where everytime the ally is summoned, i will add it to a unit group.
so when everytime it is a cinematic, i would move the unit group instantly to a region somewhere far and it would look like the cinematic campaign in warcraft III (where all the units are gone and only your hero is there talking to the guy). i think it looks professional that way but tx for ur help guys. anyways, im still curios about the patrol order MortAr.
 
Level 5
Joined
Feb 3, 2012
Messages
107
Patrol and attack-move does the same actually, but I preffer attack-move, to the position
of your hero offset by xxx, the idea is this;
check in a looping trigger the distance of your hero and the following unit, so that if the
hero is retreating, in xxx distance, order your unit to follow, else order it to attack-move...

cant find the if condition, can u explain in more detail?
 
JASS:
//Put this code above your map script:
function DistXY takes unit hero, unit follower, real howfar returns nothing
   local real x = GetUnitX(hero)
   local real y = GetUnitY(hero)
   local real x1 = GetUnitX(follower)
   local real y1 = GetUnitY(follower)
   if ((x1-x)*(x1-x)+(y1-y)*(y1-y)) < (howfar*howfar) then
      call IssuePointOrder(follower, "attack", x, y)
   else
      call IssueTargetOrder(follower, "move", hero)
   endif
endfunction

then in trigger:
  • Event
    • Time - every 2 seconds of game time
  • Actions
    • Custom script: call DistXY(hero, follower, 600)
 
Last edited:
Status
Not open for further replies.
Top