Total War: WARHAMMER II

Total War: WARHAMMER II

Attack Move and Counter Charge (WH2)
paperpancake  [developer] 10 Aug, 2020 @ 3:42pm
Scripting limitations preventing the perfect attack-move
Do you have great ideas for how to make this mod more intuitive to use and better overall? Yeah? So did I before they were dashed one by one upon the rocky shores of these technical cliffs. If you are a daring and intrepid explorer (or a CA employee in disguise) and you think you can help me find ways around these obstacles, please find me. I'm washed up on some Lua-scripted shore with a scraggly beard, next to the volleyball named Wilson.


Things I wish this mod could do that I'm stuck with (starting with the most wished for):

  1. I wish you the player could give new orders to attack-moving units without having to remember to unlock the attack-move for that unit.

  2. I wish you could give attack-move orders at the end of a queued set of orders (shift-clicked orders).

  3. I wish that if the player locked in an attack-move, this mod had a reliable way of knowing whether that unit already had an attack order.

  4. I wish modders had access to more advanced Unitcontroller functionality, including things like lib_battle_patrol_manager, while still giving players access to unit selections in some way, or have some other way for players to easily indicate when they want to turn it on and off for their units.


Technical obstacles that I think might need CA intervention:
EDIT: I included these requests in the modder’s wishlist that Da Modding Den compiled, so I have a hope, perhaps a fool's hope, that some of this might be available for TWW3. Maybe? We'll see if I'm still making mods at that time.

  1. I don't think it's possible to tell from Command Handlers[chadvandy.github.io] what unit received the orders (like the move, attack, or halt orders). You can tell what unit was the target of an attack order, but not what unit will be doing the attacking. You'd think you could just assume that the units receiving the order were the units currently selected, but that assumption fails when Unitcontroller objects are capable of giving orders to units that aren't selected.

  2. Command Handlers don't differentiate between commands given by users and commands given by Unitcontrollers[chadvandy.github.io] (which this mod uses to give its attack and move orders, not to mention other game scripts or mods that could as well, such as AI General II).

  3. I can't seem to listen for right clicks during battle. ComponentLClick on root works fine, but I can't get ComponentRClick to work. (Right clicks wouldn't handle everything, since users can also give orders through alt-drags, keyboard shortcuts, etc, and since right click is also used to cancel spells and abilities, but it might be at least a place to start.)

  4. This is an obnoxious long shot, but I think I might be able to hack my way around the problems above by caching orders that it gives, but we can't consistently tell what order a unit has. Although this script can determine a unit's ordered position[chadvandy.github.io], there's no equivalent for ordered_attack_target or something like that. If you give an attack order, the ordered_position seems to change to be the unit's current position at the time the attack order was given. That knowledge could possibly be used to give us a way to listen for new attack and move orders that aren't in a cache of orders from this mod, but we'd also have to watch out for other situations that can change the ordered_position (iirc, one is when your unit causes another unit to rout). I'd also have to hope that the order of operations for receiving orders from Unitcontrollers and players was consistent enough that I could tell them apart for the rare times when the player and the Unitcontroller gave different attack or halt orders during the same iteration of the game loop. It seems like a lot of work for something that makes a bunch of assumptions about what's happening behind the scenes, might not work as intended anyway, and could be subject to change during a CA update.

  5. Probably other technical obstacles I've already forgotten. I've been talking with Wilson about this mod idea for over half a year, after all.
Last edited by paperpancake; 18 Aug, 2021 @ 10:59pm
< >
Showing 1-1 of 1 comments
paperpancake  [developer] 4 Dec, 2023 @ 8:05pm 
In WH3, technical obstacle #4 is less of an obstacle, because scripts can now determine a unit's current target. Unfortunately, I think this might be less helpfully reliable for ranged units in some situations, since ranged units might be firing at will.
Last edited by paperpancake; 4 Dec, 2023 @ 8:06pm
< >
Showing 1-1 of 1 comments
Per page: 1530 50