modding hospital chance

Order of Battle is a series of operational WW2 games starting with the Pacific War and then on to Europe!

Moderators: Order of Battle Moderators, The Artistocrats

Post Reply
Ichthyic
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Mon May 02, 2016 10:55 pm

modding hospital chance

Post by Ichthyic »

Panzerkrieg seems to have set the chance to be hospitalized much higher than previous versions.

I often find my guys going to hospital after only taking 20-30% stack damage, which is quite irritating. Sometimes 2 days, sometimes for 4 days... and it carries over to the next map even. It used to be I never saw commanders going to hospital unless the unit suffered 60% damage or more (so less than 40% max health).

is this hard coded, or moddable?

if moddable, which file is it so I can change it? I want NO chance of injured commander if the unit is at 70% health or higher, and a 10% chance for each 10% of health the unit loses below 70%. So 60-70% would have 10% chance, 50-60% would have 20% chance, all the way down to 10-20% which would then have a 50% chance of seeing the commander injured.
Erik2
Order of Battle Moderator
Order of Battle Moderator
Posts: 9482
Joined: Thu Jul 14, 2011 12:59 pm
Location: Norway

Re: modding hospital chance

Post by Erik2 »

+1

Seems even a light cold will put the commanders in sick-bed.
Shards
Slitherine
Slitherine
Posts: 3990
Joined: Tue Aug 25, 2015 10:05 am

Re: modding hospital chance

Post by Shards »

I believe that it's linked to the damage dealt in that particular attack. So if you get hit by a 4 damage attack, you've got a much greater chance of having the commander knocked out than from a 2 damage attack. And I believe that's also the value used for how long they're out of action too?

I don't know if those values are in any settings files anywhere though
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: modding hospital chance

Post by Horst »

The game's secrets are all mine now! :twisted:

You'd have to change following code in the Assembly-CSharp.dll file by a de-/compiler tool.

Code: Select all

    public static void CheckIfCommanderGetsWounded(Unit unit, int losses, GameState gameState)
    {
        if (losses != 0 && unit.State(gameState).commander != null && unit.State(gameState).strength < 71)
        {
            int num = unit.State(gameState).strength + losses;
            if ((num + 9) / 10 > (num + 9 - losses) / 10)
            {
                int num1 = losses * 100 / num;
                int num2 = num1 * 50 / 100;
                if (App.game.SetState(gameState).GetNextRandomInteger(0, 100) <= num2)
                {
                    int num3 = (100 - unit.State(gameState).strength) / 10;
                    GameCommanders.WoundCommander(unit.State(gameState).commander, num3, gameState);
                }
            }
        }
    }
Shards
Slitherine
Slitherine
Posts: 3990
Joined: Tue Aug 25, 2015 10:05 am

Re: modding hospital chance

Post by Shards »

Fair warning. Hacking around in the compiled files can have unintended consequences. And it will almost certainly mess up any multiplayer games that you try to play

Ta
Ichthyic
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 105
Joined: Mon May 02, 2016 10:55 pm

Re: modding hospital chance

Post by Ichthyic »

Horst wrote:The game's secrets are all mine now! :twisted:

You'd have to change following code in the Assembly-CSharp.dll file by a de-/compiler tool.

Code: Select all

    public static void CheckIfCommanderGetsWounded(Unit unit, int losses, GameState gameState)
    {
        if (losses != 0 && unit.State(gameState).commander != null && unit.State(gameState).strength < 71)
        {
            int num = unit.State(gameState).strength + losses;
            if ((num + 9) / 10 > (num + 9 - losses) / 10)
            {
                int num1 = losses * 100 / num;
                int num2 = num1 * 50 / 100;
                if (App.game.SetState(gameState).GetNextRandomInteger(0, 100) <= num2)
                {
                    int num3 = (100 - unit.State(gameState).strength) / 10;
                    GameCommanders.WoundCommander(unit.State(gameState).commander, num3, gameState);
                }
            }
        }
    }
sweet!

oh, and evil chuckle added for your opening line.
Post Reply

Return to “Order of Battle Series”