Secondary Unit who Mimic Primary Unit.

Kitt

New Member
Reaction score
5
Basically what I would like, is to have one main unit (the hero) who is followed around by a secondary unit, but CANNOT be controlled by the player directly. The secondary unit should alway try and stay within about 400 AoE of the Primary Unit, and should follow all commands given by the player to the Primary unit, such as Attack and Halt commands.

The main unit will have an array of skills which cause both units to make an action, but I think this will be the easiest part, as I just have to code things like I normally would for a skill, but do something in two places.

I'm primarily worried about figuring out how to get the Secondary Unit to follow and mimic the Primary unit in a fluid manner. If anyone has any ideas, or suggestions on ways I can accomplish this, or even a link to a guide that covers something like this, I would be very grateful =D

--Kitt
 
cool idea.. I'm doing something similar in my map


Do you want the following unit to be invulnerable?

if so.. use the "Locust" ability on the following unit to make it untargetable

You can also use the Event - Unit is issued an order (something like that) and then set the following unit (based on which unit issued the order) to do the same order

and perhaps a periodic event that checks the current order of your following units, and if its blank, set it to move towards the owner
 
You can accomplish basic following through the generic "follow" command, although you probably already knew that. You probably also already know to locust the shadow unit, but maybe not. I would also assume transparency (Animation, change vertex coloring).

2 triggers, with the events being (Unit is issued an order targeting a point), (Unit is issued an order targeting a unit).

The conditions are string comparisons, if the order is equal to move or if the order is equal to attack.

If the issued order is equal to move, then order the shadow to follow the hero. If the issued order is equal to attack, then order the shadow to attack that unit.

I know that giving a unit the classification of "worker" makes it so that the unit won't auto-attack, but it also gives it an icon in the corner. Annoying, huh?

Edit: Slow :|
 
Thank you both!

Using the Follow command is nice and smooth, but it has the Secondary Unit practically hugging the Primary. Is there any way to have the Secondary Unit stop following at about 400 range?

Also, I still haven't figured out how to make the unit uncontrollable, yet still auto acquire (making them Neutral Passive prevents this, and Neutral Aggressive causes them to attack the Primary Unit).
 
Have you tried adding the Locust ability to it?

I think that there's a gameplay constant called "Follow Range", but I'm not sure if that's what changes it.
 
Have you tried adding the Locust ability to it?

I think that there's a gameplay constant called "Follow Range", but I'm not sure if that's what changes it.

The problem, though, is that I want Allies or Opponents to be able to Heal/Attack/Target/etc. the Secondary Unit.
 
You could make the unit owned by Neutral Hostile I guess ? =\ although that seems kind of iffy
 
Well, you can add and remove locust via a trigger. It will make it unselectable but targetable. (I think, I don't know if you have to go through the Hide/Unhide steps or not. And even if it does work, I don't know whether you can target it with spells and targeted attacks or not.)
 
maybe have a look at this map i once made awhile ago.

theres a companion (warden) which is following your hero all the time attacking nearby enemys etc etc.
there are different commands you can give you companion by typing them as a chat message:
-go (warden searches nearby enemys)
-help (warden attacks enemys which attack you + follows your hero)
-follow (warden follows your hero but doesnt attack)
-stay back (warden is moving randomly within 500 range of your hero)
-hold position (warden stops following your hero nor will she attack enemys)
-do your best (warden follows your hero + attacks nearby enemys + attacks enemys which attack you hero + attacks enemys attacked by you.)

the warden does always target the creep with lowest hitpoints.
 
I know this is a bit of an old topic, but I recently took my project up again, and began working with this idea of a "shadow unit" some more. I've got a fairly decently working set of triggers - though they're rough, and of course they leak - but they should be enough to give anyone else who wants to do something similar enough to work with =)

The three triggers take care of making the the "shadow unit" do the following:
1) Be 'unselectable' - that is, unable to control directly, though still targetable.
2) Follow the "main unit" (The mechanics of this are actually a little more intricate then originally planned. Description below).
3) Attack whatever the "main unit" was ordered to attack. If no order, then the "shadow unit" will auto attack.

The way the trigger that makes the "shadow unit" follow actually only triggers when the "main unit" is ordered to move to a spot via a right click. If this happens, then the "shadow unit" will also move to that location (with a small offset to prevent bumping into one another); however, if the "main unit" is ordered to move to a location via the 'move' command, then the "shadow unit" will stay put. This way, with some strategy, it's actually possible to split up the two in order to do some interesting tricks.

I'm actually pleased with how this method worked out - it feels more fluid and less frustrating, yet still generally disallows you from simply treating them as two different units (it's very hard to control them separately in different areas of a map).

And here are my (rough) triggers:

Unselectable Trigger:
Code:
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Selection - Remove "Shadow Unit" from selection for (Owner of "Shadow Unit")

Following Trigger:
Code:
    Events
        Unit - "Main Unit" Is issued an order targeting a point
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Issued order) Equal to (Order(smart))
            Then - Actions
                Unit - Order "Shadow Unit" to Move To ((Target point of issued order) offset by 100.00 towards (Angle from (Position of "Main Unit") to (Position of "Shadow Unit")) degrees)
            Else - Actions
                Do nothing

Attacking Trigger:
Code:
    Events
        Unit - "Main Unit" Is issued an order targeting an object
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Issued order) Equal to (Order(attack))
                        (Issued order) Equal to (Order(smart))
            Then - Actions
                Unit - Order "Shadow Unit" to Attack (Target unit of issued order)
            Else - Actions
                Do nothing

Let me know what you think, and hopefully I've helped someone else, too =)
Meow!
 
Selection actions tend to be really slow to run...

And, what about other orders?
Or, "smart / object" could also be an item on the ground that you right-click.

"Do nothing" is not needed. Just remove it. It does exactly what it says, nothing...
 
wow cool spell, i tried to make a similar as u did but whenever the hero died the illusion was still at the place the hero died and when i revived it would come straight back to me..weird..:D
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top