• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 29
Joined
Mar 10, 2009
Messages
5,016
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...
 
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?
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
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