Page 1 of 1
Attack/Defend stance ranges?
Posted: Tue Feb 18, 2020 5:39 pm
by ineffable
From Autodocs/Battlescript.txt:
"//limits the range of stances the AI can select to a given range. 0 = All Out Attack, 1 = Attack, 2 = Probe, 3 = Defend, 4 = Delay Hold, 5 = Delay Withdraw, 6 = Retreat.
SetAIStanceLimit(side, attackLimit, defenseLimit)"
I assume Initiative (Line #7 in the scenario file) determines the overall Attack/Defend stance for each side. How does the script function above specify a range of stances when each variable value seems to be a specific type of Attack or Defend stance?
Or conversely, without scripting, how does each side choose a specific 0-6 stance?
RE: Attack/Defend stance ranges?
Posted: Tue Feb 18, 2020 5:59 pm
by SteveMcClaire
Initiative in the scenario files determines which side is on the offensive. For Operations this side will get the choose attack timings (hasty, prepared, etc.) For battles this controls what shows up in the battle briefing (Allies Attack, Axis Attack, etc,) how the AI should behave, and what your CO expects if you play the scenario as a single battle. In either case the AI decides exactly what stance to use by evaluating what it knows about the strength ratio between the two forces (basically the same ratio you see on the blue/red force balance bar in the UI.)
SetAIStance() allows you to set limits on how aggressive or passive the AI can be. The 'AttackLimit' argument must always be less than or equal to the DefendLimit argument. The two together restrict the range of options the AI can choose. So SetAIStance(1,0,2) would force the Axis AI to choose either all-out-attack, attack, or probe regardless of the situation. SetAIStance(0,3,3) would force the Allied AI to always pick defend. Scripting is the only way to use this.
RE: Attack/Defend stance ranges?
Posted: Tue Feb 18, 2020 10:02 pm
by ineffable
Got it. Thanks.
Good to see in the content creation doc that the Axis now has branch battle and operation options.
Any chance Save files can be made to use the scripting for the scenario from which the save was made?
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 12:35 pm
by PipFromSlitherine
I don't know what "Any chance Save files can be made to use the scripting for the scenario from which the save was made?" means, sorry.
Cheers
Pip
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 1:07 pm
by ineffable
1. Link a scenario file to a script in the last line of the scenario file
2. BEGIN scenario and save
3. Play the save and the script is ignored
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 2:04 pm
by PipFromSlitherine
Hmmm - OK, I will take a look. Thanks.
Cheers
Pip
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 3:11 pm
by PipFromSlitherine
There were some odd script loading issues, though these should occur whether you save or not. You may be able to work around it for now by placing your custom map files into a subfolder as the logic there seems to be correct in the version you have. Thanks for the report.
Cheers
Pip
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 5:04 pm
by ineffable
This was an issue I mentioned previously in v.1.0.9 and doesnt involve new maps. Attached are the scenario and .bsf files.
The .bsf sets 1) both sides under AI control and 2) only both command units can be given orders (as well as attack/defend stances and 'instant start' upon entering Deploy). The .bsf works as intended as long as the linked scenario file is being played. However, if the scenario is saved and the Save file is played the player's units will complete any existing AI orders then revert to player-control only. Also, while playing the Save file the player can command all of his units, not just his command unit.
I've replicated this issue multiple times, both loading the Save file from the Command screen as well as the Options/Load menu. In all cases the Save file acts as if it has decoupled from the .bsf file.
RE: Attack/Defend stance ranges?
Posted: Wed Feb 19, 2020 5:55 pm
by PipFromSlitherine
Ah - thanks for the details. This isn't an issue with the script loading or hookup I don't think (I also tested whether scripts correctly continued here and it was working for me), more likely that the AI controls status etc are not being saved/loaded correctly - I assume the status is set in script once and then not again? The script doesn't rerun its starting functions every time the game is loaded (that would cause all kinds of potential logic issues). Again, thanks for the info.
Cheers
Pip