Total War: WARHAMMER III

Total War: WARHAMMER III

Just Good Babysitter
Fixed: Mods that confuse[d] JGB
Edit: As far as I can tell, this has been fixed. Thanks, Deo!

-------------Original post below---------------

Just Good Babysitter can get confused when used with AI General, Attack Move and Countercharge, and Aerial Pursuit. There might be other mods that give orders to units during battle, but I can only speak to mine. Even if Deo and I work together, I don't think there's a fix. If you think of something, though, please let me know.

Edit: Deo found a solution. Thanks, Deo!

Some people (@Bodongs) have used the mods together despite the conflicts. Just be aware that using one of those mods at the same time as Just Good Babysitter could result in unexpected behavior from Just Good Babysitter, like a unit attacking when it shouldn't or not attacking when it should.

The biggest problem

Just Good Babysitter relies on unit selections to determine which unit received an order. If any other mod gives an order to one unit while the player has a different unit selected, then JGB gets confused about which unit got the order.

There might also be a problem with conflicting use of unit controllers. That would be straightforward to work around if Deo and I worked together. I haven't been able to recreate the problem, though, so maybe it's not as big of an issue as it was in previous versions.

Why I don't think the selection problem can be fixed without CA intervention

Edit: Deo found a solution. Thanks, Deo!

Unfortunately, the command handlers that modders can listen to don't distinguish between player orders and orders that come from other sources like mods. They also don't tell us which unit received the order, just that one was given.

JGB isn't relying on unit selections because Deo wants to. Deo's too good of a scripter to hassle with that normally. But it is a work-around for those technical limitations that we modders have (that I've been frustrated with for years.) Deo's workaround assumptions allow JGB to avoid frustrating UX like order locks, but the assumptions break down when other mods also start giving orders.
Last edited by paperpancake; 11 Dec, 2023 @ 7:36pm
< >
Showing 1-13 of 13 comments
Deo  [developer] 4 Dec, 2023 @ 10:18pm 
Hi, Andrew, thanks for pointing out to the problem.
Originally posted by paperpancake:
Unfortunately, the command handlers that modders can listen to don't distinguish between player orders and orders that come from other sources like mods. They also don't tell us which unit received the order, just that one was given.
that's the main issue, I agree, although I use some workaround within mod, it is still not perfect and other mods giving commands indeed will break it

Regarding AI General mod - as I remember it puts units under script control (or ai control), right? So may be I just miss one little check to ignore such units. I'll have to test it

Not familiar with other mods, though, lets think how to make them compatible
paperpancake 4 Dec, 2023 @ 11:19pm 
Originally posted by Deo:
Regarding AI General mod - as I remember it puts units under script control (or ai control), right?

During the battle, it uses the Script AI Planner[chadvandy.github.io]. When the phase becomes Victory Countdown, it switches to unit controllers like Just Good Babysitter.

Originally posted by Deo:
So may be I just miss one little check to ignore such units.

I don't think it will be enough to know which units my mods control, because I think the command handler will still notify your script. But if it helps, all of my mods use modder_API_uc_manager. So you can ask which units are controlled by any of my mods using something like this.

local function is_pancake_controlling(unit) local string_ui_id = tostring(unit:unique_ui_id()) local mod_key = nil if is_table(modder_API_uc_manager) and is_function(modder_API_uc_manager.is_unit_claimed) then mod_key = modder_API_uc_manager:is_unit_claimed(string_ui_id) -- mod_key is nil if not controlled, else is a string like "aigeneral_pancake" end --unnecessary step local result_as_boolean = not not mod_key return result_as_boolean end
Last edited by paperpancake; 4 Dec, 2023 @ 11:23pm
Deo  [developer] 4 Dec, 2023 @ 11:36pm 
that may work, i'll add it, thanks :steamthumbsup:
paperpancake 4 Dec, 2023 @ 11:40pm 
I like your code style. It is neat and clean. And I like your mod ideas. :) I'm going to sleep now. Good night!
Deo  [developer] 4 Dec, 2023 @ 11:44pm 
thanks man, good night!
Deo  [developer] 5 Dec, 2023 @ 3:41am 
added a check, seem to be working fine
paperpancake 5 Dec, 2023 @ 1:25pm 
The check you added is an improvement, but the selection problem still exists.

Here are the steps to reproduce the problem, with a video to show it:

1. In your mod manager, enable both "Just Good Babysitter" and "Attack Move and Counter-charge"

2. Start any battle

3. Give some of your units a counter-charge order. (In the video, I give the infantry a counter-charge order.)

4. Select some units that don't have a counter-charge order (in the video, I select the flying units). You can move them if you want, but don't give them any attack orders.

5. When the infantry starts to counter-charge, your selected units will attack that unit also. But we never told the selected units to attack, so that is a bug.

This bug doesn't happen if only one of the mods is enabled in the mod manager. It only happens if both mods are enabled.

Here is a video showing the selection problem: https://youtu.be/EbomY4KCTgA
paperpancake 5 Dec, 2023 @ 2:03pm 
In your mod, you account for this using ignore_targets. Perhaps it might help if you create a public function for my mods to call when I give an order?
Deo  [developer] 5 Dec, 2023 @ 2:56pm 
hm, right, because selected units were not marked as claimed and your script gave attack command to other ones.
You are right we can use ignore_targets, will make it global and let you know
Deo  [developer] 6 Dec, 2023 @ 6:58am 
i'll try to adapt BattleUnitAttacksEnemyUnit event and may be we'll be able to avoid strange workarounds
in contrary to "command_handler" this event gives you attacking unit, and target you can get through "current_target" method
Deo  [developer] 6 Dec, 2023 @ 10:12am 
it should be better now, without additional hack
one problem still remains though, if script make some movement orders and we have units selected - they will be removed from JGB, don't see a solution yet
maybe should to update,somtime range troops can't shoot
FinaL 3 Jan, 2024 @ 5:55am 
Just wanna thank paperpancake and Deo for this collaboration! You're these kind of people that make a good game a GREAT game :)
< >
Showing 1-13 of 13 comments
Per page: 1530 50