Mindustry

Mindustry

Unit Hunter Logic
16 Comments
RedGoat 8 Jun, 2024 @ 4:27pm 
trying to use this and the return to core behaviour makes the logic useless when i want my units to attack at the frontlines, if the author wont update it can anyone modify the script and post an updated version? i'd do it myself if i knew how to code
TheNightglow  [author] 21 Oct, 2023 @ 6:25am 
Yea you are right @Kareekoe
I have not looked at this in a while but seems like the Rally Points were removed from the game
you could do the same I do for the watch-tower turret selection, and simply see if the selected object is not a turret, if its not a turret use it as rally point

then the user would just need to mark a non-turret object the same way they can mark turrets as watch-towers right now

not sure when I ll be able to adjust the code tho, have not looked at mindustry in quite a while^^
Kareekoe 21 Oct, 2023 @ 5:08am 
Seems this logic's rally point function might have been made for when the command center block was a thing back in Version 6.0 and stopped working after the command center block was removed when Version 7.0 was released.

Wonder if there's a way to fix this logic's rally point function to work similar or the same to how it probably did when the command center block existed, maybe there's a way to have the logic make the units hang out around the unit production building rally point?
Kareekoe 21 Oct, 2023 @ 4:46am 
No idea how to set up a rally point.
Seems that the rally point of the unit production buildings don't count as the rally point for the logic.
Veldie 7 Feb, 2023 @ 5:09am 
How do i set up a rally point?
[TC] Toaster Oven 8 Oct, 2021 @ 2:06pm 
I posted it as an issue on Github as this indeed seems like a strange bug:
https://github.com/Anuken/Mindustry/issues/6123

Maybe head over, give it a read, and add your side of the story to the issue?
The more specific information the better.
TheNightglow  [author] 8 Oct, 2021 @ 8:02am 
thats quite odd... it does not seem like there is anything wrong with your code, so i checked mine and my Unit Hunter Processesor also no longer works in the way it should... I know it used to take all linked turrets, but right now it does the same for my code as it does for yours
I feel like the devs changed something and I havent updated my code accordingly (havent kept this mod up to date since February), or this might simply be just a bug^^

in any way, this error is not just with your code in the pastebin but also with mine here in the workshop
[TC] Toaster Oven 7 Oct, 2021 @ 10:07am 
Nice, I recently modified it to work with another processor (and a few other small changes), but for some reason the code seems to only detect the first building I link. Individually linking to only one turret always works, but when there are multiple----some turrets are completely ignored (wTT always comes out as null---when they shouldn't [enemies within linked turret range]). Also, in that situation, the first turret linked ever (during session), seems to get priority while the others ignored, any ideas?

mlog code (paste in VS code or import into a Mindustry processor for easier reading):
https://pastebin.com/0nERbKdi
Pokeking 4 Jun, 2021 @ 2:37am 
Now flares and minkes won't let targets just walk on by!
TheNightglow  [author] 15 Feb, 2021 @ 7:54am 
thx, I updated the schematic to use the unit range now, tho instead of

op sub minRange range 1

I do a multiplication with a proportion value, because if the units only approach up to their shooting range, they wont be able to follow the enemy (since the processors update slower then the enemy walk, the enemy can escape the field of fiew of the units otherwise)
Melagius 13 Feb, 2021 @ 8:04pm 
Nice one.

You can use the code below so you don't have to hard code the 3rd command:

sensor range @unit @range
op sub minRange range 1
Just Evan 17 Jan, 2021 @ 3:40pm 
I will put this to good use. Thank you.
Hunter 495 15 Jan, 2021 @ 6:54am 
I've never really used logic before, but was thinking about how units should do this in survival
Edward Howton 14 Jan, 2021 @ 8:05am 
Oh, it's hardly a problem. I just found it funny that it worked that way. Explains how schematics work. It's trivial to deselect stuff.
I've had a lot of success with this. The weak spot at the edge of a map wasn't destroyed because a mass of Eclipses went to meet the wave guardians. Saved on ammo, lost all my attacking units, but the last guardian left died to a single foreshadow shot. Really a hassle to need something like this to make units useful outside of base attack maps, but if it works...
TheNightglow  [author] 14 Jan, 2021 @ 3:52am 
Yea the F marking will remember where from the processor the linked structures are expected, which makes processors sometimes a bit awkward to place multiple of.

Easiest way to get around that is to either place it using a clear not linked up yet schematic, or to place an empty processor and copy and paste the commands over.
Edward Howton 13 Jan, 2021 @ 8:53pm 
Works great, and easy to modify. First line in the block selects ship type from a drop-down menu, and changing all three lines for hail1 hail2 and hail3 to whatever weapons you want to use for targeting (Foreshadow is ideal), but you don't need all three for it to work, just associate the block with up to three weapons. Odd detail: copying block with F will transfer the altered code (useful for putting foreshadows in different places) but it will also transfer the relative location of the associations; I ended up with a logic block automatically connecting to conveyor belts because they were in the same spot as two other guns on the original block. Not a bug, just a funny quirk of how F-copying works.