Page 1 of 1

modding hospital chance

Posted: Thu Feb 15, 2018 5:26 am
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.

Re: modding hospital chance

Posted: Thu Feb 15, 2018 8:45 am
by Erik2
+1

Seems even a light cold will put the commanders in sick-bed.

Re: modding hospital chance

Posted: Thu Feb 15, 2018 11:35 am
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

Re: modding hospital chance

Posted: Thu Feb 15, 2018 11:38 am
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);
                }
            }
        }
    }

Re: modding hospital chance

Posted: Thu Feb 15, 2018 11:43 am
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

Re: modding hospital chance

Posted: Thu Feb 15, 2018 12:08 pm
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.