"Herding" units

W

witch doctor

Guest
Hello, I'm posting because I have a bit of a problem. I want one of my units (I.e. this dog) to be able to "herd" other units, e.g. sheep.

I've tried things like swapping ownership when it gets close, so I can manualy move it, and losing ownership when it gets too far away from the sheep. I've also tried editing monster lures, but i can't see what "lures" the units or how to change what they lure...
Another thing is I tried doing the "if units enter a region around a point" or something (i.e. around the dog) that they swap ownership, but this seems not to work, or works very infrequently...

If anyone had anything to say or do that'd help me, I'd be glad.

So, in brief, I'd like either something that changes ownership of a unit in proximity with another, and loses it when the distance is too great, Or, something that causes units to follow another...

Any help is appreciated!
 

Romek

Super Moderator
Reaction score
964
E: Unit comes within range of <Dog>
C: Triggering unit is a Sheep
A: Order triggering unit to move to [Polar offset [ angle between units, distance between units + 400]

Brief, and quite rubbish. But might give you a general idea :)
If you want a better trigger [from the editor], just ask :)
 

Squishy

You can change this now in User CP.
Reaction score
127
Wouldn't it be more realistic if the units moved away from the dog when the dog came too close? But if you wanna go with the ownership method, make a periodic trigger that picks all units within 500 (or whatever range you want) of the dog and adds them to a unit group while giving control of the units to you. Then, make another periodic trigger that checks all units within your unit group, and when one of them isn't within 500 of the dog anymore, return it to its original owner and remove it from the unit group.

EDIT: Too late
 
W

witch doctor

Guest
I know about the units moving away and that, but I thought it might be too difficult as it is :p lol
But if there was some way I could do that it'd be great! lol

But yeah, I'm still havin trouble... what I've done is:

E: Every Second
C: Unit-type of (picked unit) Equal to Footman
A: Unit group- Pick every unit in (units in (region centered at (Position of Dog 0000 <gen>) with size (300, 300)) and do (actions)
- loop - Actions
Unit - Change ownership of (picked unit) to player one (red) and change color

I think that's similar to what you suggested, but I'm not sure if what I've done is wrong... I suspect it might b e the (picked unit) bit, but I'm not sure....

I've tried doing the ordering it to move to a polar offset bit, but I'm not sure how to do this and how it would stop if out of range or w.e :(

Well thanks for your help lol :p

Edit: And yeah, I know it says footman, It's just a test until it works lol, as that's the first unit that appeared in the unit bit :p lol
 

Squishy

You can change this now in User CP.
Reaction score
127
To do the move units to position with polar offset, you need to use the action Unit-Issue Order Targetting a point. Then, at the part where it asks for a point, look for point with polar offset and use arithmetic to get the '+400' bit. If you want to go with the control swap idea, this is what the triggers would look like.
Code:
Trigger 1
    Events
        Unit - A unit comes within 500.00 of Your Dog Unit
    Conditions
        (Unit-type of (Triggering unit)) Equal to Sheep
    Actions
        Unit - Change ownership of (Triggering Unit) to Player 1 (Red) and Retain color
        Unit Group - Add (Triggering unit) to (Unit_Group_Variable)
Code:
Trigger 2
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Unit_Group_Variable)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked Unit) is in (Units within 500.00 of (Position of Your Dog Unit)) Equal to False
                    Then - Actions
                        Unit - Change ownership of (Picked unit) to Neutral Passive and Retain color
                    Else - Actions
 
W

witch doctor

Guest
Right thanks :)

It all works apart from the last bit; I can't seem to work out how to find the

"((Picked Unit) is in (Units within 500.00 of (Position of Your Dog Unit)) Equal to False"

thing. I've had a look, but I can't find where that is in the conditions, like I mean, do I find it under e.g. boolen comparison or something?

Sorry for being a pain lol :p and thanks for your help!
 

Romek

Super Moderator
Reaction score
964
Seriously.. Just do what I said :p

Code:
    Events
        Unit - A unit comes within 500.00 of [B][Wolf][/B]
    Conditions
        (Unit-type of (Triggering unit)) Equal to [B][Sheep][/B]
    Actions
        Set Temp_Point = Position of (Triggering unit)
        Set Temp_Point2 = Position of [b][Wolf][/b]
        Unit - Order (Triggering unit) to Move To (Temp_Point) offset by 500.00 towards (Angle from (Temp_Point2) to (Temp_Point) degrees)
        Custom Script: call RemoveLocation(udg_Temp_Point)
        Custom Script: call RemoveLocation(udg_Temp_Point2)

Works perfectly. [tested]
 
W

witch doctor

Guest
Thanks for your help everyone! :D

I didn't really understand the triggers (not because I'm new to world edit, but because I'm new to using more detailed triggers!) but I had a look and it works!

:D


Edit:
Btw, is there anyway to get the trigger to work if the dog dies? Like, can I summon a new dog and get the trigger to work on that?
Thanks :)
 

Squishy

You can change this now in User CP.
Reaction score
127
If the dog is a Hero and you revive it, it will still work fine. If it is a unit, set the unit to a variable and every time the unit respawns, set the variable to the new unit. Then use your variable in the trigger is replace of Dog.
 
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

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top