Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
"Or even add the option (or leave it for another mod entirely if you feel this does not fit the scope of this mod) to have it where units can be set to just attack anything nearby, but can still be given new orders and such (an auto attack order basically)
...having it where units can be ordered about as normal, just with Attack Move always on
so basically, I can understand having the order lock due to countercharge, but having it where you disable countercharge entirely, and this will allow you to attack move and give orders otherwise with them being locked"
-----------------
My reply:
@GeneralKong Ah, I see the subtle difference now. Unfortunately, I believe that an implementation of your suggestion would have its own quirks due to technical limitations of scripted mods. For example, if your unit got close enough to start charging an enemy and you wanted to cancel the charge to move away, this would be impossible. Also, the mod would need to decide whether to allow order changes once an attack order was given. If they weren't allowed, then the mod wouldn't work with ranged units (because of how current_target is reported), and the melee units couldn't react to new situations, so they could be easily baited. If attack order changes were allowed, then it could interfere with player-given attack orders. For example, if you wanted to attack an enemy back-line unit and your unit first needed to pass close to an enemy front-line unit, it would attack the front-line unit instead. To reiterate, not all of these are problems with your idea. The biggest problems are caused by scripting limitations that (I think) prevent a straightforward implementation of your suggestion.
If you're curious for more details about why this is so technically fraught, the underlying technical problems are that mods can't tell which unit is receiving an order and also can't tell whether the order came from the user or from a mod. This means that in some common situations the mod wouldn't know whether it needed to issue a new order or keep the existing order. Even if you use no other mods besides this one, I don't think this mod can't tell. You'd think that it could just un-register the command handler just for the duration of the order, but that doesn't work because the orders are queued and don't fire events until later in the game loop. You'd think that it could just remember what orders this mod gave and look for new orders that don't fit, but a straightforward implementation isn't possible because command handlers don't specify which unit received the order, and an implementation that looks at current targets has many exceptions that start piling up due to a combination of game-loop order and also due to how current_target and ordered_position are handled in various situations. (I tried to do something like that with my Aerial Pursuit mod, for example. There is a config option in that mod to turn on the beta for auto-unlocking, but it had so many false positives and negatives that I disabled it by default.)
(Command listeners distinguishing between player orders and scripted orders has been on my wishlist since WH2.)
Its a shame that the game is limited in that way when it comes to scripting, we can only hope that at some point later in WH3 life cycle it will open up, but I doubt it.
I am curious, are you able to add a toggle for magic units that during attack move and such, that they will use spells/abilities?
I read the just good babysetter mod's script, but I am not sure whether I have fully understood it. There's a piece of code:
local function attack_cb(event)
local unit = event:battle_unit()
local unit_id = unit:unique_ui_id()
if (not unit:is_controllable()) or
(not unit:is_player_controlled()) or
unit:is_behaviour_active("defend") or
unit:is_script_controlled() or
unit:is_ai_controlled() or
is_pancake_controlling_by_id(unit_id) then
return
end
It seems that event:battle_unit() can be used to figure out which unit received the order(this is for attack order but others may be similar).
And a bunch of functions shaped like is_xxx_controlled() can be used to find out who is in control of the unit. Though this does not directly mean where the order come from, but can be used to filter the orders only when the unit is controlled by player.
First I use two functions attack_cb and non_attack_cb to monitor all the orders, no matter where it is from, if a unit is in attack-move mode, this mod may automatically order it to attack nearby enemies and restore the move order after that. Player can also give attack or move order at any time.
I set a rule that, when player gives a move order, the unit is changed to attack-move mode to its destination. When already in attack-move mode, player's another move order will cancel the attack-move mode and perform a normal move. And a player's attack order should always cancel the attack-move mode. But when in attack-move mode, the auto given move and attack order should not change the mode.
To achieve this, in function check_attack_move_orders, before the auto order is given, a flag named self.auto_order_flag[current_friendly_id] is set to true, this auto order will soon be caught by the cb functions, so the two cb functions can check this flag to identify whether the order captured is given by this mod or by user. Of course this flag should be set to false after either situation.
I made a prototype mod to prove the feasibility, but I'm not a veteran modder so the code looks quite messy, and I actually just stuck the two mods together without fully understanding them, I don't know what cco is at all and can not find a document about it.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3373356409
This prototype kinda works, but sometimes not, maybe a move order to cancel the attack-move mode is given, but the mode is not cancelled immediately so the unit tried to move or attack again, then I click again but it brings the attack-move mode back again, and I should give a third order to cancel it again...
I think that this is because the function is implemented by using several callback functions so some synchronize problem may happen when orders are given to frequently, maybe the state change should be recorded and processed altogether in one timer callback, that is check_attack_move_orders function, but this is too hard for me without fully understanding your mod for now.
Notice that I didn't use the toggle attack-move mode button at all, again, I just made a prototype for proof. You can use this button to make the attack-move mode for example only turned on by button but cancelled by any manual order.
And also there's another suggestion, when a move order is caught, checks can be made that is the target the same as the recorded move order, to identify whether the move order is given to restore the movement or a new one.
https://chadvandy.github.io/tw_modding_resources/index.html
(The documentation is also sometimes included in the game files themselves.)
If you want to find a community of modders, including some that have written tutorials on Cco, the Modding Den has a very active discord and a sometimes updated wiki.