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
 

woot

New Member
Reaction score
8
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
 

FireBladesX

Eating my wings!
Reaction score
123
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 :|
 

Kitt

New Member
Reaction score
5
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).
 

FireBladesX

Eating my wings!
Reaction score
123
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.
 

Kitt

New Member
Reaction score
5
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.
 

woot

New Member
Reaction score
8
You could make the unit owned by Neutral Hostile I guess ? =\ although that seems kind of iffy
 

Azlier

Old World Ghost
Reaction score
461
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.)
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
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.
 

Kitt

New Member
Reaction score
5
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!
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
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...
 

vinkia

New Member
Reaction score
0
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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top