Modifying battle calculator formula

Users who are viewing this thread

Status
Not open for further replies.

Noobrzor

Recruit
Good day to all of you, who accepted the challange of helping me solve my task.

The task is simple: i'm trying to make it so, every killed agent during any sort of combat would be wounded (knocked unconscious) instead of dead.

So far I've noticed that combat takes place in 2 ways that are of interest to me: leading the charge (player fights) or ordering troops to attack without the player (battle simulation and calculation takes place).

Due to try and error method, i've been able to confirm, that having level 15 surgery perfectly works for "unkillable but knockable" troops while leading the charge. It was unsuccessful for auto-calc though.
So I started meddling with all the things I could set my eyes on:
a) Unkillable flag (for troops) didn't work, searching the forums also confirmed it
b) "inflict_casualties_to_party" was the only script that made possible sense to me in an autocalc, however try and error as well as browsing the forums revealed that it is, sadly, not a working script.

Hence my question: Is it even possible to make a bypass (hand meddling with the scripts, I'm unable to write a new one) of a proper, working, "Unkillable but knockable" flag for Battle Calculator (Ordering your troops to attack without you)?

I thank any of You who braved through my post, and I'm waiting patiently for any helpful responses.
Best Regards.
 
Just go through the menus and see where they lead you. Auto-calc goes to the following menu
Code:
  (
    "order_attack_2",mnf_disable_all_keys,
    "{s4}^^Your casualties: {s8}^^Enemy casualties: {s9}",
    "none",
    [
      (set_background_mesh, "mesh_pic_charge"),

      (call_script, "script_party_calculate_strength", "p_main_party", 1), #exclude player
      (assign, ":player_party_strength", reg0),

      (call_script, "script_party_calculate_strength", "p_collective_enemy", 0),
      (assign, ":enemy_party_strength", reg0),
      
      (party_collect_attachments_to_party, "p_main_party", "p_collective_ally"),
      (call_script, "script_party_calculate_strength", "p_collective_ally", 1), #exclude player
      (assign, ":total_player_and_followers_strength", reg0),
                                    
      (try_begin),
        (le, ":total_player_and_followers_strength", ":enemy_party_strength"),
        (assign, ":minimum_power", ":total_player_and_followers_strength"),
      (else_try),
        (assign, ":minimum_power", ":enemy_party_strength"),
      (try_end),
...
The important thing here is to note that it uses the operation (inflict_casualties_to_party_group), which is hardcoded to do some esoteric calculations and inflict actual damage on the party groups being passed in, returning that amount to p_temp_casualties. You can try by-passing this by either writing your own implementation that takes the surgery skill into effect, or backing up the parties before the operation is called, and then returning a number of the casualties to life. Because this operates on the entire stack of party groups associated with the ally/enemy, you should take care that you don't clump the results together, that is if there are 100 knights in the enemy group but only 10 in the first group, half of which are marked as wounded, you might end up with 25 wounded knights in the first group if a cap or distribution by party weight within the attached group isn't imposed.

There is also another script that may be of interest, script_count_mission_casualties_from_agents which is called when you retreat from a battle. If you are unable to "meddle" with the module scripts then you probably won't be able to write a bypass as I've described above.
 
I sense great wisdom in your words, and put all my trust in them. I will try the next time I'll install Warband, due to time and nerves spent I wind off by uninstalling it :grin:
I thank you solemnly for your help, Sir. :smile:

#EDIT
I wanted to make sure this script actually does something, so I removed the "inflict_casualties_on_party_group" that was referring to my own (player's) party, and poof, everything worked as anticipated.
@Somebody thank You, you were right. Job's done by your hand.
 
Status
Not open for further replies.
Back
Top Bottom