OSP Code Combat Overhauled Morale and Routing (Also Reduces Stuttering)

Users who are viewing this thread

For some reason routed enemies aren't being calculated as casualties and I end up having to fight a second battle to deal with them. I had the same problem in TLD, so I'm assuming it's either a warband problem or a me problem. Anyone else having this?

If I tab out when all enemies are routing but haven't actually routed yet then they don't count as routed for the calculate casualties script. Presumably because I forgot to change the "$g_battle_won" = 1 bug that vetrogor pointed out :facepalm:
 
Last edited:
Bugs are countless. One need to overhaul the code. In quotes just few of them from the first look.
changing that 1 to a 0 in the first alleged bug seems to stop troops from routing entirely. if it is a bug then it appears to be working in this scripts favor.
 
No, troops still rout once this is fixed, I assume they just rout far less often because they don't get the morale recovery until after the battle ends. Perhaps omit it completely or change the timing if you want more routing.
 
I'm actually fine with less routing lol. I've only been using quick battle to test. in those tests it seems like AI is way too quick to rout without vetrogor's fix, and simply never routes with the fix. I used the debug trigger from the OP and it shows "Fear = 0" for the entire battle (regardless of what's happening), but when I apply vetrogor's fix the Fear value shoots up to extremely high values continuously. Neither of which appear consistent with the associated AI behavior. I suppose I probably have something implemented wrong, but I have no idea what.
 
#tweaking
(val_mul, ":strength", 4),
(val_div, ":strength", 1),
Maybe these lines near the end of that script might be why it has such a large effect.
 
(is_between, ":order", mordr_form_1_ranks, mordr_form_5_ranks_plus_one),
(val_sub, ":order", mordr_form_0_rank),
Since these orders don't exist in Native, how should they be declared in header_mission_templates? what numbers should they be assigned?

Edit: found this thread https://forums.taleworlds.com/index...s-updated-header_mission_templates-py.327844/ but it still does not include all the orders used in this trigger. Also, was Lav wrong here? I just downloaded a fresh modsys from Taleworlds site and they're definitely not in there.
 
Last edited:
(is_between, ":order", mordr_form_1_ranks, mordr_form_5_ranks_plus_one),
(val_sub, ":order", mordr_form_0_rank),
Since these orders don't exist in Native, how should they be declared in header_mission_templates? what numbers should they be assigned?

Edit: found this thread https://forums.taleworlds.com/index...s-updated-header_mission_templates-py.327844/ but it still does not include all the orders used in this trigger. Also, was Lav wrong here? I just downloaded a fresh modsys from Taleworlds site and they're definitely not in there.
They are there, just using a different name.

Jacobhinds named it mordr_form_1_rank but the official module system named it mordr_form_1_row.

Compare the id's of the orders and you'll see they are the same. You can either replace the names from within his code with the official names, or just add his list to the current module system which will work fine because both ultimately point to the same order id.
 
Ah I see, but what are the equivalents of mordr_form_0_rank and mordr_form_5_ranks_plus_one? jacob didn't have them in that thread and none of the native mordr lines really sound right for those.
 
I can only definitively say that,
mordr_form_5_ranks_plus_one = 27
It only exists for ease of use for ranges. This engine uses non-inclusive upper bounds so if you want a value included in it, you need to add one to it, so last applicable value + 1.

My guess for the other is
mordr_form_0_rank = 21
Looking at a glance it seems to only use it as a way to numerate their rank's depth so I assume you want form/rank 1 to be 1, but I could be wrong. I've never used the pack before, and I don't know if there will be unintended consequences. The other reasonable answer would be 22, but I assume he would just subtract the first row in that case.
 
If anyone has WinMerge and few minutes, it would be awesome if somebody could compare my module_mission_templates with my old one before adding this OSP to help me peg down any implementation problems (both here: https://www.mediafire.com/file/v5erq19rlh0ockq/module_mission_templates.zip/file). The only rout I've been able to induce with this overhauled morale was the last 2 of a group of 10 looters against 30 Swadian knights. I don't believe the problem is in module_scripts since that is mostly fool proof adding or replacing isolated scripts. I also feel somewhat confident that I have the appropriate triggers in the appropriate MTs (lead_charge, village_raid, village_attack_bandits, and quick_battle_battle), but the behavior still feels native.
 
Last edited:
Its been a long time since I worked on this and I think I just forgot to reupload it when i had fixed some of the bugs. I would suggest simply debugging it by adding the template to custom battles and printing the morale values every few seconds. The mordr_form_5_rank thing was just a crappy way to make tighter formations more resistant to morale, it can probably be removed.
 
the start of a 200v200 custom battle:
CDnoSZd.jpg

near the end, in which the Khergits didn't rout despite being trounced:
uH6tkOv.jpg

this debug trigger is meant to show morale, right? to me, this looks like it's doing exactly what the native script_apply_effect_of_other_people_on_courage_scores does as described in the OP. I'm certain I've replaced that script. even if this OSP as posted isn't working exactly as intended, this still seems inconsistent with the results others have achieved.
 
Back
Top Bottom