Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 5 [6]   Go Down

Author Topic: Random Failures Mod public beta 0.5  (Read 21928 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6051
Re: Random Failures Mod public beta 0.5
« Reply #60 on: May 25, 2023, 02:27:21 PM »

I downloaded from the link supplied in reply #47. The only thing included are the classfiles; there's no readme file.

I note in the java file that there is provision for conf.ini [Mods] section for the following, the first two of which aren't mentioned in this topic:

- "FailType", which appears to be permitted to range from 0 to 13, defaulting to 0 if no entry present.
- "FailTimer", which gets multiplied by 60; defaults to 0 if no entry present.
- And of course the mentioned "FailureRate", which can lie between 0 to 100, defaulting to 0 if no entry present.


Here's the list of FailType entries in method setafail(), compacted for easier readability:

failtype == 1 .setEngineStops

failtype == 2 .setKillPropAngleDevice " Prop Angle Device Damaged!"

failtype == 3 .setCyliderKnockOut " Cylinders Damaged!"

failtype == 4 .setReadyness " Crank Case Damaged!"

failtype == 5 hitEngine " Crank Case Damaged!"

failtype == 6 .hitEngine " Cylinders Damaged - Engine On Fire!"

failtype == 7 .setKillCompressor " Compressor Out!"

failtype == 8 .setMagnetoKnockOut " Magneto #0 Destroyed!"

failtype == 9 .setMagnetoKnockOut " Magneto #1 Destroyed!"

failtype == 10 .hitTank .doSetTankState (increments fuel tank damage by 1 step)

failtype == 11 .setOilState " Oil Filter Damaged!"

failtype == 12 .hitOil " Oil Tank Leak!"

failtype == 13 .GearControl .Gears.setHydroOperable "Gear: Hydraulic system Failed!"
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6051
Re: Random Failures Mod public beta 0.5
« Reply #61 on: May 25, 2023, 03:08:13 PM »

Below is the first part of randomfail(). It seems to me that variable "season" cannot modify the rate of failure. It's supposed to double the probability for desert and winter maps. But "enginerandom" is always determined when "season" = 0; the value of 500 (for desert/winter) is applied AFTERWARD, where it has no role to play.  And even then, each system is tested against a particular value, which intrinsically has the same probability of matching, which here is 1 in 1,000.

Code: [Select]
    private void randomfail()
    {
        Random random = new Random();
        int randomvalue = random.nextInt(1000);
        int enginenum = random.nextInt(3);
        int enginenumlog = enginenum + 1;
        float f = World.Rnd().nextFloat();
        float season = 0.0F;
        float enginerandom = (float)randomvalue - season;  //(0 to 1000) - 0, or 0 to 1000; (0 to 1000) - 500, or 500 to -500
        if(World.cur().camouflage == 2 || World.cur().camouflage == 1)  //desert or winter
            season = 500F;
        else
            season = 0.0F;
        if(enginerandom == 10F)
        {
            ((FlightModelMain) (super.FM)).EI.engines[0].setEngineStops(this);
            super.playSound("weapon.MGunMk108s", true);
        }


Not tested, but something like this (which can use cleaning up for elegance!) would double the chance of failure for desert and winter maps, where the probability becomes 1 in 500 versus 1 in 1,000 for all other maps:

Code: [Select]
    private void randomfail()
    {
        Random random = new Random();
        int randomvalue;
        if(World.cur().camouflage == 2 || World.cur().camouflage == 1)
{
randomvalue = random.nextInt(500);
float enginerandom = (float)randomvalue;
}
        else
{
randomvalue = random.nextInt(1000);
float enginerandom = (float)randomvalue;
}
        int enginenum = random.nextInt(3);
        int enginenumlog = enginenum + 1;
        float f = World.Rnd().nextFloat();
        if(enginerandom == 10F)
        {
            ((FlightModelMain) (super.FM)).EI.engines[0].setEngineStops(this);
            super.playSound("weapon.MGunMk108s", true);
        }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Tokyo_Express_420

  • member
  • Offline Offline
  • Posts: 167
Re: Random Failures Mod public beta 0.5
« Reply #62 on: May 28, 2023, 09:52:19 AM »

Is this just theory or will it be adaptable for 4.12?

- Tokyo Express
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6051
Re: Random Failures Mod public beta 0.5
« Reply #63 on: May 28, 2023, 10:45:31 AM »

'Theory' from me so far.  ;)  I have a number of ongoing projects on my plate, they being of higher priority. I took a quick look at this purely out of curiosity about this old thread revived. If this were still the headier days of several years ago, with greater involvement in the modding scene, it's likely one or more peeps hereabouts would jump on it.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: 1 ... 3 4 5 [6]   Go Up
 

Page created in 0.048 seconds with 26 queries.