RimWorld

RimWorld

Drafted Auto-Combat
128 Comments
Mechanomical 17 Oct @ 9:09pm 
A bit of a weird request but could you add a run away style for those with run and gun, I like to have one good shooting pawn run around and act like a coward to catch attention while everyone else does their thing
Albino Monkey 16 Oct @ 8:40am 
@RedMattis I would definitely do a add-on mod instead of adding it into this one. You could call it "Auto-Combat: Formations" which just add more options to this mod, or if you show me the ropes I could do it myself as I've always been interested in rimworld modding.
Squishyjellyfish 12 Oct @ 11:00pm 
does this work with run and gun?
Alexander Zagirov 12 Oct @ 5:00pm 
AI auto-combat ignore turrets for some reason.
RedMattis  [author] 12 Oct @ 2:51am 
Update
Now works with the old VEF Abilities such as those from Dragon's Descent, probably psycasts, etc. as well.

It hooks into their code which includes things like random-chance-to-not-use, etc., so if a pawn doesn't use an ability it might be due to that kind of setting.

I've not checked how friendly-fire prone they are, but probably exactly the same how the VEF-style autocast usually is.

@Albino Monkey
It would be interesting, but I'm a bit worried that might over-complicate things. While the mod lets you turn off buttons I still don't want to go too crazy on the complexity, and options hidden in the mod menu 98% of users probably never learn about.
Zaphiel 11 Oct @ 6:02am 
This mod doesn't seem to be working well with Simple sidearms mod. The moment I enable the Auto-combat and AI control, all ranged pawns switches to their available melee weapon and starts chasing the enemy instead of using their ranged weapon.
Albino Monkey 10 Oct @ 10:18am 
An idea I have now that I see that you've added full AI drafting, maybe dive into squads and proper formations? I am running a full synthetic army playthrough right now and being able to have ai squads that stay together and fight a little more smart (more than what we have now) would be amazing. Also thank you for the work you have put in so far, the mod is awesome.
Minitialize 9 Oct @ 9:22pm 
thank you for this. Everytime my colonists are downed, I feel the need to savescum hard because as vanilla AI is right now, drafted colonists are only as smart as the players handling them so if they die, 7 times out of 10, its def. player fault. At least that's how I view it, so thank you again.
Shampooh 9 Oct @ 2:27pm 
Oh good call, now that I check Steam still hadn't downloaded the update. Check the time on your AutoCombat.dll on disk and if it's before the update time here (2:16 pm EDT), you're outdated. Unsub and resub, force a redownload through RimPy, restart Steam, whatever you gotta do. All good now for me.
Albino Monkey 9 Oct @ 2:07pm 
Ay, I just had that problem everyone is having where the drafting wasnt working and the UI didnt show up but the patch you just released fixed it. If you are still having problems try to restart your game first before coming here.
Shampooh 9 Oct @ 1:56pm 
Not getting any problems with a new colony, only when trying to draft in my ongoing save that had the prior version. I have a very beefy modlist as you can tell which might be a related factor with the differences people are getting, but here's what I'm getting:
Exception in Verse.GizmoGridDrawer.DrawGizmoGridFor: System.NullReferenceException: Object reference not set to an instance of an object
[Ref 1A58987C]
at BigAndSmall.DraftedActionHolder.GetData (Verse.Pawn pawn) [0x0000c] in <75e8245ce183483ca398166bbf6ac5d7>:0
at BigAndSmall.DraftGizmos.ClearPrioritizedWorkAndJobQueuePostfix (Verse.PriorityWork __instance) [0x0002a] in <75e8245ce183483ca398166bbf6ac5d7>:0
at Verse.PriorityWork.ClearPrioritizedWorkAndJobQueue () [0x00017] in <24d25868955f4df08b02c73b55f389fe>:0
- POSTFIX RedMattis.AutoCombat: Void BigAndSmall.DraftGizmos:ClearPrioritizedWorkAndJobQueuePostfix(PriorityWork __instance)
Full thing: https://hastebin.com/share/qopegiwoce.txt
bigd 9 Oct @ 1:48pm 
My bad. Here's the error message from the beginning.

System.NullReferenceException: Object reference not set to an instance of an object
[Ref 56CFA0E4]
at BigAndSmall.DraftedActionHolder.GetData (Verse.Pawn pawn) [0x00000] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\DraftedJobsUtils.cs:332
at BigAndSmall.DraftGizmos.GetGizmosPostfix (System.Collections.Generic.IEnumerable`1[T] __result, RimWorld.Pawn_DraftController __instance) [0x00031] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\DraftedJobsUtils.cs:88
at RimWorld.Pawn_DraftController.GetGizmos () [0x00026] in <24d25868955f4df08b02c73b55f389fe>:0
Cute Pie 9 Oct @ 12:58pm 
Any work around for the gizmo disappearing?
Riven 9 Oct @ 11:38am 
I had the gizmo bug, the update fixed it
RedMattis  [author] 9 Oct @ 11:17am 
Update: Took a shot in the dark. I'm guessing the list of auto-fire set abilities has somehow scribed as null for some users.

Can't reproduce it myself though.
RedMattis  [author] 9 Oct @ 11:07am 
@bigd
What is the error? The copied text is just pointing at a line. Is it a NullReferenceException?
NoClip 9 Oct @ 11:05am 
Echoing recent statements here, also getting the gizmo bar disappearing when a pawn is drafted now since the update
LeInsurge 9 Oct @ 10:58am 
gizmo bar stopped working with the latest mod update :(
bigd 9 Oct @ 9:41am 
This is what I get. Its trying to look for files dealing with dealing with Big and small files. I tried with big and small mod installed and uninstalled and the same results.

at BigAndSmall.DraftedActionHolder.GetData (Verse.Pawn pawn) [0x00000] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\DraftedJobsUtils.cs:332
at BigAndSmall.JobGiver_AutoCombat.TryGiveJob (Verse.Pawn pawn) [0x00013] in C:\Games\Steam\steamapps\common\RimWorld\Mods\1 BigSmall_Framework\1.6\Base\Source\BigSmallFramework\Auto-Combat\AutoCombatJob.cs:84
Paolini 9 Oct @ 8:20am 
So this is not needed if we already have Big and Small Framework ?
Mara 9 Oct @ 7:35am 
Simple sidearms compatible?
ASaltyTwixBar 9 Oct @ 6:53am 
I'm having the same issue. Disabling the buttons in the mod settings doesn't do anything, and I'm using Character Editor to down Pawns that are drafted and cannot be un-drafted.
Ev 9 Oct @ 6:49am 
Yeah, just experienced that too.
Logical Terror 9 Oct @ 6:28am 
this update broke something, the mod is looking for big and small references and the gizmo bar is disapearing when drafted.
Ev 9 Oct @ 6:20am 
Does the full-auto mode in this update obsolete loading Search & Destroy together with this mod?
RedMattis  [author] 9 Oct @ 5:10am 
Update

Added a full-auto mode.

When enabled they will hunt down any hostile threats (which you are aware of/aren't fogged), beating down doors if required to reach them.

As always you can disable any extra buttons in the mod setting.
ELF SLAYER 28 Sep @ 3:48pm 
Thanks for adding the option to disable gizmos! It was getting really crowded
biowreck 23 Sep @ 4:24pm 
Works now ::cozyspaceengineersc:
RedMattis  [author] 23 Sep @ 2:26pm 
@biowreck
Try updating it again. The name of the settings menu button had gone missing.
biowreck 22 Sep @ 8:24pm 
Hey, just trying to confirm if it's on my end or not. The options don't show up with only DLCs, Harmony, and your mod running. I've tried resubscribing a couple of times too. Does it work on your end?
RedMattis  [author] 22 Sep @ 11:15am 
Update:
Added mod settings menu and ability to toggle on and off display of buttons.

Also added the ability to make the main button be a dropdown menu instead.


@Roque the Rogue
The problem with swapping the state on abilities individually is that when you use it on a large group of pawns the behaviour becomes a bit chaotic.

I might add it as a right-click-menu option though.
Roque the Rogue 8 Sep @ 10:20pm 
Greetings RedMattis, I've had an idea for improving the toggle gizmo on left click;

What if when you click to autocast, it shuffles between;
-Normal mode (just the usual autocast, for basic abilities)
-1 Cast Once (like buffing or triggering a shield)
-2 Cast Twice (useful for certain powerful abilities)

It does another layer of utility.

I think doing this can solve some of the spam issues pawns seem to have with certain abilities, especially ones that consume a resource pool, like force abilities, like hemogen abilities, some mods, allows you use shield abilities and pawns will proceed to spam the ability quickly depleting resources.

Awesome if possible, thanks for your contributions.
next0ne22 7 Sep @ 12:57pm 
Thanks for reply, I will keep your mod in my list and check it later. Good piont is that auto-combat now is auto-disabled when undrafting, that was one of the reasons I had to look for alternatives. What I like in Drafted AI is avoiding friendly fire is also there.
RedMattis  [author] 6 Sep @ 9:32am 
Seems like I missed the language keys. This should be fixed now. Thanks for pointing it out. :)
DAOWAce 6 Sep @ 9:24am 
Yeah, code text is displaying instead of a friendly name on the, I assume, new option (3rd gizmo).
天才少公子 5 Sep @ 3:44pm 
The newly added Auto-Combat mode option seems to display incorrect text in the game.
RedMattis  [author] 5 Sep @ 1:28pm 
@elĐeve
Correct. This is a standalone version of the optional built-in auto-combat. :)
elĐeve 5 Sep @ 12:59am 
now i think of it it's the same autocombat that it's integrated in big and small? i just noticed i can enable it lol (i'm not subbed to this one) :SG0_BestGirl:
RedMattis  [author] 5 Sep @ 12:03am 
@next0ne22
If your issue is them charging too much then the new update might be what you were looking for.

If you wanted them to chase foes around corners then it is better to combine this mod with something like Search & Destroy.

I've not tried the Drafted AI mod, so I can't say how it compares to it, but if you have specific feedback I'm always grateful for it. :)

@elĐeve
I don't think this mod has any performance issues at all. Most of the methods I've created are probably cheaper than what the vanilla AI foes uses against you.

@tanyfilina
I don't know what the other mod does, but I did read a comment from someone saying they used them together.

@Some Random Pleya
Thanks!
RedMattis  [author] 4 Sep @ 11:55pm 
New update!
Melee characters can now be set to only engage nearby foes. Of course if you want them to hold their ground, just toggle autocombat on that pawn.

This was a feature voted by our supporters. :3

Also, auto-combat now is auto-disabled when undrafting. If you want to change the settings for this the auto-combat settings are in the B&S Framework.

I might make a setting menu for the standalone mod too though, it seems to get requested a fair bit.

Also pondering if I can make ability auto-cast clearer since I think most people miss what is probably the coolest feature. In my humble opinion ofc... :D
next0ne22 4 Sep @ 5:40pm 
Had to disable this mod, melee pawns didn't act smart. Drafted AI mod works better for me.
elĐeve 1 Sep @ 11:15pm 
does it perform better than 'search and destroy'?, that mod sometimes kills my tps when i activated for a high skilled melee pawn
Phoenix-D 31 Aug @ 11:56pm 
Run and Gun amazingly actually works fairly well un-updated.
tanyfilina 31 Aug @ 12:14pm 
It's amasing that there apeared two auto-combat mods at one time, I've missed this one! Would be helpful to know the differences. Do I understand right that this mod allows for auto-combat when not drafted too?
I would generally expect this mod to be better, as it's made by much more experienced modder, while that one, I suspect, is made largely by AI :)
(and while I'm here and if you engaged into the combal modding, maybe you could add the functionality of the Run and Gun mod? We're all waiting for Meme Goddess to update it, but still no news)
k/\ttnjiå 29 Aug @ 8:44am 
"At the moment you need Big & Small Framework since this mod doesn't have a mod menu for settings, but I might add it to this standalone as well if there is enough interest for tuning things in detail."

Certainly interested here uwu
Some Random Pleya 24 Aug @ 9:21pm 
ow this is better than search and destroy I love it
RedMattis  [author] 18 Aug @ 1:16pm 
Update:
I've added an option for toggling off the auto-combat when a pawn is undrafted.

At the moment you need Big & Small Framework since this mod doesn't have a mod menu for settings, but I might add it to this standalone as well if there is enough interest for tuning things in detail.
RedMattis  [author] 18 Aug @ 12:01pm 
@Bear
You mean for my abilities? Otherwise I don't have friendly fire avoidance, that is from the other mod.

if I disable the friendly-fire avoidance for abilities they will literally fireball their own team if an enemy would also be hit. I doubt there are many instances where you'd want this.

@Ali50
Sounds good. :)
Bear 18 Aug @ 10:26am 
Could you please add an option to disable the friendly fire avoidance behaviour?
Ali50 18 Aug @ 6:41am 
@RedMattis yes they work together with no real issues for ranged pawns. They use Drafted Auto-Combat for enemies in their sight and then switch to Drafted AI to search for new enemies on the map.

If both are activated for melee pawns, Drafted AI's code for "avoid friendly fire lines" seems take precedent over your / B&S framework's code.
They will not close in on enemies shot by other pawns and only wriggle on the spot if those are the only enemies left. Otherwise they search for new targets on the map.

I think the severity of this can be configured in the mod config for Drafted AI but I have not tinkered with that yet. So far I would simply deactivate the DAI gizmo for melee pawns.