Jump to content

Rydygier

Member
  • Content Count

    4805
  • Joined

  • Last visited

  • Medals

  • Medals

Posts posted by Rydygier


  1. Downloaded core. It seems that I know too little about config files to properly translate values ​​used in ACE's config.bin to RHA equivalent used in the TDS script. Unless ACE core contains separate file with corresponding values, which I simply missed. In addition, I am not sure whether ACE developers certainly have used more reliable source than me.

    BTW. In fact, I believe that we are largely stuck with guesswork, since key parameters modern equipment are simply kept secret, which is fully understandable. Therefore I see no chance for substantive resolution of endless and fruitless Internet wars such as, "M1A2 against T-90".


  2. I guess it is beacause BLUEFOR is more advancing there, and continually in moving, I deployed some still T-90 on airfield for demonstration purposes. Maybe try several times from different points of view. I will look at this issue closer tommorow.

    ---------- Post added at 09:52 PM ---------- Previous post was at 09:20 PM ----------

    ...Or even today. :) In this version better you can see how does it work and what limitations it has. M1A2 platoon is fighting for life.

    TDS_test3b

    Shortened pause between each script executions and improved drivers' reflex. Good night.


  3. Lately I tried various ways (SQS) to persuade a tank to set up front to the nearest or currently firing enemy vehicle, if it is kind of "tank". There are problems. Script is nearly finished except itself turning procedure. "Setdir" works, but only on level ground, because this command sets vehicle horizontally, regardless of the slope. Also this needs missing animations and sound of tracks. "Sendsimplecommand" (preffered method) works for "left" or "right". "Stop", even though the commander says this order, does not stop turning and tank rotates like carousel, endless. "Forward" also doesn't work. This isn't dependent on presence of player in crew. "doStop" does nothing too. Are there some other "simplecommands", that can stop turning, or it just doesn't work? Has anyone any idea? Is there any alternative for "setdir" to avoid "sloped terrain turning problem"?

    More details here:

    http://forums.bistudio.com/showthread.php?t=84673&page=11

    Will be grateful for any advice.


  4. I will try to prepare something, still "setdir" version suffers mentioned bug, when tank is turning on non-level, sloped ground. It may give quite funny effect. :)

    ---------- Post added at 08:26 PM ---------- Previous post was at 07:43 PM ----------

    Here you go:

    TDS_test3

    Some explanations:

    - Script will not start (and will stop) when a vehicle is moving to not interfere with his driving.

    - It may be noted that changing direction is followed unevenly. This is due to random factors associated with driver skill factor (selfcontrol under fire, reflex).

    - Vehicle does not change direction because of air units and infantrymen, even if they have antitank weapons. I'll think about whether to change or leave.

    - Ability to match towards work in two ways: when crew noticing enemy tank (requires presence of commander and driver, both AI), and when the tank is hit (only AI driver required he will not wait for order in this circumstance, I think).

    - Of course, when tank is under attack from many sides, crew must choose to which opponent will turn tank. Here reigns rule "the last word matters."

    PS Reduced chance of breaking track by 10 percent.


  5. T(h)anks for testing. Changed file to new one, there are some minor fixes, but still this piece of code is WIP and messy. BTW. I think, there is still too big chance for track damage. Too easy enemy can disable any tank, including Abrams, that way. AI's abandon vehicle in that case even, if they still can shoot with main gun and destroy attacker. Outside they quickly die by KM's, of course... Unfortunately I'm unfamiliar with AI behavior scrips, so can't do anything about those suicidal tendencies.


  6. As I mentioned before, I tried various ways to persuade a tank to set up front to the nearest or currently firing enemy vehicle, if it is kind of "tank". There are problems. Script is nearly finished except itself turning procedure. "Setdir" works, but only on level ground, because this command sets vehicle horizontally regardless of the slope. Also this needs missing animations and sound of tracks. "Sendsimplecommand" (preffered) works for "left" or "right". "Stop", even though the commander says this order, does not stop turning and tank rotates like carousel, endless. "Forward" also doesn't work. This isn't dependent on presence of player in crew. "doStop" does nothing too. Are there some other "simplecommands" or it just doesn't work? Has anyone any idea? Here it is presentation of "setdir" version on flat ground (but try to move tank on nearest slope, and watch then...):

    TDS_test2.utes


  7. Something like this?

    _somevar = 0;
    while {_somevar == 0} do {
    
    _unitsInTown = nearestObjects [(_logicArray select 0),["CAManBase"],250];
    _TownUnitCount = (count _unitsInTown);
    _maxUnitSize = 65;
    if (_TownUnitCount > _maxUnitSize) then {
       _unitsToDelete = _TownUnitCount - _maxUnitSize;
    
    for [{_n = 0},{_n <= _unitstodelete},{_n = _n+1}] do {
    deletevehicle (_unitsInTown select _n)
    };
    
     //if (debug) then {
       player sideChat format ["Removed %1 units from town",_unitsToDelete];
       //};
    };  
    
    sleep 1;
    };

    It will remove units starting from nearest to "_logicArray select 0" position, I believe.


  8. PvPscene, with heavy addons, like ACE, I have a problem, which is called "3 GB per month transfer limit." Extras weigh 1 GB. So it is, as you live to middle of nowhere.

    Kremator, in fact, I would grateful if someone will test it, point out mistakes and imperfections, etc. So I prepared a simple presentation with my version of this Nice_Boat's script (contains some debug):

    TDS_test.utes

    Below main "NBtank.sqs" script code itself, main question concerns RHA equivalent both for armor thickness values and projectiles penetration ability:

    _worktime = _time
    _target = _this select 0
    _selection = _this select 1
    _damage = _this select 2
    _attacker = _this select 3
    _ammo = _this select 4
    
    _comm = commander _target
    _drvr = driver _target
    _gunn = gunner _target
    
    _commH = damage _comm
    _drvrH = damage _drvr
    _gunnH = damage _gunn
    
    ;Script defines a unique global variables needed for storing damage of weapons, turret and traction.
    
    ~0.01
    _varcomp = str (_target)
    
    ? (_target getvariable ("GCheck" + _varcomp) == 1) : goto "skipvar"
    _target setvariable [("TRL" + _varcomp),0,true]
    _target setvariable [("TRP" + _varcomp),0,true]
    _target setvariable [("TUR" + _varcomp),0,true]
    _target setvariable [("GUN" + _varcomp),0,true]
    
    _target setvariable [("WL11" + _varcomp),0,true]
    _target setvariable [("WL12" + _varcomp),0,true]
    _target setvariable [("WL13" + _varcomp),0,true]
    _target setvariable [("WL14" + _varcomp),0,true]
    
    _target setvariable [("WL21" + _varcomp),0,true]
    _target setvariable [("WL22" + _varcomp),0,true]
    _target setvariable [("WL23" + _varcomp),0,true]
    _target setvariable [("WL24" + _varcomp),0,true]
    
    _target setvariable [("GCheck" + _varcomp),1,true]
    #skipvar
    _top = 0
    _DT = damage _target
    
    ;Trying to persuade to target, to set the front to the attacker. Hmm.
    
    _target doTarget _attacker
    _target doWatch _attacker
    
    _weapon = currentWeapon _attacker;
    
    ;traction damage check
    
    ? _damage > 0.7 and _selection == "PAS_P" and NBRand100 > 70 : _target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]
    ? _damage > 0.7 and _selection == "PAS_L" and NBRand100B > 70 : _target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_1_1_steering" and NBRand100 > 60 : _target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_1_2_steering" and NBRand100 > 60 : _target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_1_3_steering" and NBRand100 > 60 : _target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_1_4_steering" and NBRand100 > 60 : _target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_2_1_steering" and NBRand100 > 60 : _target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_2_2_steering" and NBRand100 > 60 : _target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_2_3_steering" and NBRand100 > 60 : _target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]
    ? _damage > 0.4 and _selection == "wheel_2_4_steering" and NBRand100 > 60 : _target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]
    
    ; setting variables needed to determination of the vertical hit angle, and the targets "skew" angle to check if top armor was hit.
    
    _highadv = ((getposASL _attacker) select 2) - ((getposASL _target) select 2);
    ? (damage _target >= 1) : _highadv = 1;
    _distF = [(position _attacker) select 0,(position _attacker) select 1,(getposASL _target) select 2] distance (getposASL _target)
    _Tpitch = ((vectordir _target) select 2)
    _Tbank = vectorUP  _target
    _DHatan = _highadv atan2 _distF
    ? (_DHatan == -1) : _DHatan = 0
    _TcheckA = 9/(1+ _DHatan)
    _dX = ((getPos _attacker) select 0) - ((getPos _target) select 0)
    _dY = ((getPos _attacker) select 1) - ((getPos _target) select 1)
    ? (_dX == 0) : _dX = 1
    ? (_dY == 0) : _dY = 1
    ? (_highadv == 0) : _highadv = 1
    _EWroll = _Tbank select 0
    _NSroll = _Tbank select 1
    
    ? ((abs _dX) > (abs _dY)) and (_dX > 0): _TcheckL = -_EWroll;goto "skip1"
    ? ((abs _dX) <= (abs _dY)) and (_dY > 0): _TcheckL = -_NSroll;goto "skip1"
    ? ((abs _dX) > (abs _dY)) and (_dX <= 0): _TcheckL = _EWroll; goto "skip1"
    ? ((abs _dX) <= (abs _dY)) and (_dY <= 0): _TcheckL = _NSroll
    
    ;Javelin case and elimination types of ammo, for which script should not do further calculations.
    
    #Skip1
    ? _ammo isKindOf "M_Javelin_AT" : _top = 1
    ? _ammo isKindOf "B_30mmA10_AP" or _ammo isKindOf "B_20mm_AP" or _ammo isKindOf "B_20mm_AA" or _ammo isKindOf "B_23mm_AA" or _ammo isKindOf "B_23mm_HE" or _ammo isKindOf "B_23mm_AP" or _ammo isKindOf "B_23mm_APHE" or _ammo isKindOf "B_25mm_HE" or _ammo isKindOf "B_25mm_HEI" or _ammo isKindOf "B_25mm_APDS" or _ammo isKindOf "B_30mm_AP" or _ammo isKindOf "B_30mm_HE" or _ammo isKindOf "B_30mm_AA" or _ammo isKindOf "G_40mm_HE" : goto "checkSide"
    ? _ammo isKindOf "BulletCore" and !(_ammo isKindOf "VIL_B_30mm_ros") and !(_ammo isKindOf "ibr_aden30_gunpods"): goto "exit"
    
    ;determination of horizontal hit angle
    
    #checkSide
    
    _ang = _dX atan2 _dY
    _dif = (_ang - getDir _target)
    
    ? (_dif < 0) : _dif = 360 + _dif
    ? (_dif > 180) : _dif = _dif - 360;
    _difA = abs _dif
    
    ;below are lists of variables for attacker and target possible used weapon and armor. _surviv needed for no-lethal penetrations
    
    ? _target isKindOf "ibr_T55" : _armorCE = 215; _armorKE = 215; _surviv = 17; goto "checkAmmo"
    ? _target isKindOf "M1A2_TUSK_MG" : _armorCE = 1205; _armorKE = 780; _surviv = 30; goto "checkAmmo"
    ? _target isKindOf "M1A1" : _armorCE = 850; _armorKE = 465; _surviv = 26; goto "checkAmmo"
    ? _target isKindOf "ZSU_Base" : _armorCE = 20; _armorKE = 20; _surviv = 10; goto "checkAmmo"
    ? _target isKindOf "2S6M_Tunguska" : _armorCE = 25; _armorKE = 25; _surviv = 10; goto "checkAmmo"
    ? _target isKindOf "T34" : _armorCE = 95; _armorKE = 95; _surviv = 16; goto "checkAmmo"
    ? _target isKindOf "T72_Base" : _armorCE = 420; _armorKE = 345; _surviv = 20; goto "checkAmmo"
    ? _target isKindOf "T90" : _armorCE = 1100; _armorKE = 700; _surviv = 24; goto "checkAmmo"
    ? _target isKindOf "AAV" : _armorCE = 60; _armorKE = 50; _surviv = 12; goto "checkAmmo"
    ? _target isKindOf "BMP2_Base" : _armorCE = 40; _armorKE = 40; _surviv = 12; goto "checkAmmo"
    ? _target isKindOf "BMP3" : _armorCE = 170; _armorKE = 120; _surviv = 13; goto "checkAmmo"
    ? _target isKindOf "BRDM2_Base" or _target isKindOf "BRDM2_ATGM_base" or _target isKindOf "VIL_brdm_m96d": _armorCE = 25; _armorKE = 25; _surviv = 11; goto "checkAmmo"
    ? _target isKindOf "BTR90_Base" : _armorCE = 120; _armorKE = 70; _surviv = 12; goto "checkAmmo"
    ? _target isKindOf "LAV25_Base" : _armorCE = 40; _armorKE = 40; _surviv = 11; goto "checkAmmo"
    ? _target isKindOf "VIL_LEO2A4" : _armorCE = 905; _armorKE = 620; _surviv = 26; goto "checkAmmo"
    ? _target isKindOf "VIL_new_PT91" : _armorCE = 915; _armorKE = 625; _surviv = 24; goto "checkAmmo"
    ? _target isKindOf "VIL_t72M1_wp" : _armorCE = 515; _armorKE = 415; _surviv = 20; goto "checkAmmo"
    ? _target isKindOf "VIL_rosomak" : _armorCE = 150; _armorKE = 70; _surviv = 12; goto "checkAmmo"
    ? _target isKindOf "VIL_OSA_PLOT" : _armorCE = 35; _armorKE = 35; _surviv = 10; goto "checkAmmo"
    ? _target isKindOf "VIL_DANA" : _armorCE = 35; _armorKE = 35; _surviv = 8; goto "checkAmmo"
    ? _target isKindOf "VIL_2s1_PL" : _armorCE = 30; _armorKE = 30; _surviv = 8; goto "checkAmmo"
    ? _target isKindOf "VIL_bmp1_wp" : _armorCE = 35; _armorKE = 35; _surviv = 10; goto "checkAmmo"
    ? _target isKindOf "VIL_bwp2000_wp" : _armorCE = 55; _armorKE = 55; _surviv = 13; goto "checkAmmo"
    ? _target isKindOf "ibr_LEO1A5" : _armorCE = 380; _armorKE = 335; _surviv = 18; goto "checkAmmo"
    
    #checkAmmo
    ? _ammo isKindOf "shellCore" : goto "checkShells"
    ? _ammo isKindOf "rocketCore" : goto "checkRockets"
    ? _ammo isKindOf "missileCore" : goto "checkMissiles"
    ? _ammo isKindOf "laserbombCore" : goto "checkbombs"
    
    ;Parameters of mines and explosive charges are set roughly, based on the weight of the explosive material. I did not find precise online data for this.
    
    ? _ammo == "mine" : _penetration = 70 + NBRand25; goto "explosive"
    ? _ammo == "mineE" : _penetration = 25 + NBRand10; goto "explosive"
    ? _ammo == "pipebomb" or _ammo == "timebomb" : _penetration = 100 + NBRand100; goto "explosive"
    ? _ammo isKindOf "B_20mm_AP" : _penetration = 120 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_20mm_AA" : _penetration = 45 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_23mm_AA" : _penetration = 50 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_23mm_HE" : _penetration = 1 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_23mm_AP" : _penetration = 80 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_23mm_APHE" : _penetration = 55 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_25mm_HE" : _penetration = 1 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_25mm_HEI" : _penetration = 2 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_25mm_APDS" : _penetration = 80 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_30mm_AP" and _weapon == "2A42" : _penetration = 80 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_30mm_AP" and _weapon == "2A72" : _penetration = 120 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_30mmA10_AP" : _penetration = 90 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_30mm_HE" : _penetration = 1 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "B_30mm_AA" : _penetration = 80 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "G_30mm_HE" : _penetration = 5 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "G_40mm_HE" : _penetration = 6 + NBRand10; goto "kinetic"
    ? _ammo isKindOf "VIL_B_30mm_ros" : _penetration = 10 + NBRand10; goto "chemical"
    ? _ammo isKindOf "ibr_aden30_gunpods" : _penetration = 50 + NBRand10; goto "kinetic"
    
    #checkShells
    ? _ammo isKindOf "Sh_105_HE" : _penetration = 30 + NBRand25; goto "explosive"
    ? _ammo isKindOf "Sh_100_HE" : _penetration = 30 + NBRand10; goto "explosive"
    ? _ammo isKindOf "Sh_120_HE" : _penetration = 30 + NBRand25; goto "explosive"
    ? _ammo isKindOf "Sh_120_SABOT" : _penetration = 1000 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "Sh_122_HE" : _penetration = 30 + NBRand25; goto "explosive"
    ? _ammo isKindOf "Sh_125_HE" : _penetration = 30 + NBRand50; goto "explosive"
    ? _ammo isKindOf "Sh_125_SABOT" and _weapon == "D81" : _penetration = 550 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "Sh_125_SABOT" and _weapon == "2A46M" : _penetration = 810 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "Sh_85_HE" : _penetration = 10 + NBRand10; goto "explosive"
    ? _ammo isKindOf "Sh_85_AP" : _penetration = 160 + NBRand25; goto "kinetic"
    ? _ammo isKindOf "VIL_NPL_AP120mm" : _penetration = 600 + NBRand50; goto "chemical"
    ? _ammo isKindOf "VIL_NPL_SB120mm" : _penetration = 860 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "VIL_NPL_HE120mm" : _penetration = 30 + NBRand10; goto "explosive"
    ? _ammo isKindOf "VIL_NPL_SB125mm" and _attacker isKindOf "VIL_tankERA" : _penetration = 670 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "VIL_NPL_AP125mm" and _attacker isKindOf "VIL_tankERA" : _penetration = 800 + NBRand50; goto "chemical"
    ? _ammo isKindOf "VIL_NPL_HE125mm" : _penetration = 30 + NBRand10; goto "explosive"
    ? _ammo isKindOf "VIL_NPL_SB125mm" : _penetration = 430 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "VIL_NPL_AP125mm" : _penetration = 500 + NBRand50; goto "chemical"
    ? _ammo isKindOf "VIL_NPL_AP125mm" : _penetration = 500 + NBRand50; goto "chemical"
    ? _ammo isKindOf "VIL_HE152mm" : _penetration = 40 + NBRand25; goto "explosive"
    ? _ammo isKindOf "VIL_HE122mm" : _penetration = 30 + NBRand25; goto "explosive"
    ? _ammo isKindOf "VIL_HEAT122mm" : _penetration = 460 + NBRand50; goto "chemical"
    ? _ammo isKindOf "vilas_AP73mm" : _penetration = 400 + NBRand25; goto "chemical"
    ? _ammo isKindOf "vilas_HE73mm" : _penetration = 20 + NBRand10; goto "explosive"
    ? _ammo isKindOf "VIL_NPL_sb60mm" : _penetration = 120 + NBRand25; goto "kinetic"
    ? _ammo isKindOf "VIL_NPL_he60mm" : _penetration = 5 + NBRand10; goto "explosive"
    ? _ammo isKindOf "VIL_NPL_Uni60mm" : _penetration = 85 + NBRand10; goto "chemical"
    ? _ammo isKindOf "VIL_NPL_ap60mm" : _penetration = 145 + NBRand25; goto "chemical"
    ? _ammo isKindOf "ibr_Sh_105_SABOT_leo" : _penetration = 530 + NBRand50; goto "kinetic"
    ? _ammo isKindOf "ibr_BM_8_100mm_HVAPDS" : _penetration = 220 + NBRand25; goto "kinetic"
    ? _ammo isKindOf "ibr_BK_17_100mm_HEAT" : _penetration = 280 + NBRand10; goto "chemical"
    ? _ammo isKindOf "ibr_OF_32_100mm_HE" : _penetration = 30 + NBRand10; goto "explosive"
    
    #checkRockets		
    ? _ammo isKindOf "R_Hydra_HE" : _penetration = 10 + NBRand10; goto "explosive"
    ? _ammo isKindOf "R_57mm_HE" : _penetration = 10 + NBRand10; goto "explosive"
    ? _ammo isKindOf "R_80mm_HE" : _penetration = 20 + NBRand10; goto "explosive"
    ? _ammo isKindOf "R_S8T_AT" : _penetration = 400 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_M136_AT" : _penetration = 420 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_RPG18_AT" : _penetration = 380 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_PG7VR_AT" : _penetration = 700 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_PG7VL_AT" or _ammo isKindOf "VIL_PG7M_ammo" : _penetration = 500 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_PG7V_AT" or _ammo isKindOf "VIL_PG7KO_ammo" : _penetration = 280 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_OG7_AT" : _penetration = 10 + NBRand10; goto "explosive"
    ? _ammo isKindOf "R_PG9_AT" : _penetration = 450 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_OG9_HE" : _penetration = 10 + NBRand10; goto "explosive"
    ? _ammo isKindOf "R_SMAW_HEAA" : _penetration = 600 + NBRand50; goto "chemical"
    ? _ammo isKindOf "R_SMAW_HEDP" : _penetration = 30 + NBRand10; goto "chemical"
    ? _ammo isKindOf "R_GRAD" : _penetration = 20 + NBRand100; goto "explosive"
    ? _ammo isKindOf "R_MLRS" : _penetration = 600 + NBRand100; goto "explosive"
    
    #checkMissiles
    ? _ammo isKindOf "M_Javelin_AT" : _penetration = 800 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_Stinger_AA" : _penetration = 30 + NBRand10; goto "explosive"
    ? _ammo isKindOf "vil_Sidewinder_OSA" : _penetration = 220 + NBRand25; goto "explosive"
    ? _ammo isKindOf "M_Sidewinder_AA" or _ammo isKindOf "ibr_AIM9M_AA": _penetration = 90 + NBRand10; goto "explosive"
    ? _ammo isKindOf "M_Strela_AA" or _ammo isKindOf "VIL_grom_AA": _penetration = 20 + NBRand10; goto "explosive"
    ? _ammo isKindOf "M_Igla_AA" : _penetration = 25 + NBRand10; goto "explosive"
    ? _ammo isKindOf "M_AT5_AT" : _penetration = 800 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_AT13_AT" : _penetration = 900 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_TOW_AT" : _penetration = 600 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_TOW2_AT" : _penetration = 1000 + NBRand100; goto "chemical"
    ? _ammo isKindOf "M_AT10_AT" : _penetration = 850 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_AT11_AT" : _penetration = 750 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_Hellfire_AT" : _penetration = 1400 + NBRand100; goto "chemical"
    ? _ammo isKindOf "M_Vikhr_AT" : _penetration = 1000 + NBRand100; goto "chemical"
    ? _ammo isKindOf "M_Maverick_AT" or _ammo isKindOf "ibr_AGM65_AG" : _penetration = 1250 + NBRand100; goto "chemical"
    ? _ammo isKindOf "M_R73_AA" : _penetration = 90 + NBRand10; goto "explosive"
    ? _ammo isKindOf "M_Ch29_AT" : _penetration = 750 + NBRand50; goto "explosive"
    ? _ammo isKindOf "M_AT2_AT" : _penetration = 500 + NBRand100; goto "chemical"
    ? _ammo isKindOf "M_AT6_AT" : _penetration = 650 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_AT9_AT" : _penetration = 100 + NBRand50; goto "chemical"
    ? _ammo isKindOf "M_9M311_AA" : _penetration = 150 + NBRand25; goto "explosive"
    ? _ammo isKindOf "VILNPL_at3_sagger" : _penetration = 520 + NBRand50; goto "chemical"
    
    ;The case of air bombs separately, because of their much greater strength and manner of "application" it to battlefield.
    
    #checkbombs
    ? _damage < 0.55 : goto "exit"
    ? _damage > 1 : _top = 1
    ? _ammo isKindOf "ibr_GBU12_LGB" : _penetration = 200 + NBRand25; goto "explosive"
    ? _ammo isKindOf "Bo_FAB_250" : _penetration = 200 + NBRand25; goto "explosive"
    goto "exit"
    
    
    #kinetic
    
    _penetration = _penetration + ((((1000 - (_attacker distance _target))/100) * 0.02) * _penetration)
    
    ? _selection == "VEZ" and _penetration > (_armorKE * NBRand50*0.03) and NBRand100 > 85 : _target setvariable [("TUR" + _varcomp),1,true]
    ? _selection == "ZBRAN" and _penetration > (_armorKE * NBRand50B*0.03) and NBRand100B > 85 :  _target setvariable [("GUN" + _varcomp),1,true]
    
    ;Eliminating further calculations for other, particular parts of target in order to Event Handler counted damage only once per hit.
    
    ? !(_selection == "") : goto "exit"
    
    ; calculating possibly crew injuries
    
    _commH = _commH + _damage * NBrand100/70
    _drvrH = _drvrH + _damage * NBrand100B/70
    _gunnH = _gunnH + _damage * NBrand100C/70
    
    ; Using a random factor to the armor to simulate the angle of hit or hits in the weaker spots
    
    _armorKE = _armorKE + (NBrand25 * (_armorKE/20) - NBrand10 * (_armorKE/20))
    
    ;effect of angle of hit to final value of the targets armor
    
    ? _difA > 45 and _difA <= 135 : _armorKE = _armorKE / 3
    ? _difA > 135 : _armorKE = _armorKE / 5
    ? (_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1) : _top = 1;
    ? (((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    ? (((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    ? _top == 1 : _armorKE = _armorKE / 6
    
    ; crew gets some injuries
    ~0.01
    ? ((_penetration > _armorKE) and (NBRand100 > 50)) or (NBRand100 > 95) : commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH
    ~0.01
    
    ;penetration check with some random factor, 1% for "luck" hit, and small debug
    
    ? _penetration < _armorKE and NBRand100 < 99 : player sideChat format["TRG: %1 Arm: KE %2 Pen: SABOT %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT];goto "exit0"
    
    ; finally target get some damage. Note _surviv variable influence. This damage value is removed from actual target's hit points only, if penetration occured. In many cases it means instant kill, but sometimes, especially for modern MBT's, non-lethal penetration may occurs and damage will be less than 1.
    
    _target setDamage _DT + _damage*(_penetration/_armorKE)*(NBRand50/(3*_Surviv));
    
    ;because damage is applied also for gun, turret and traction, below script restores its hit values remembered for that parts by global variables. Its neccesary to avoid miraculous recovery of malfunctioning parts
    
    ? (_target getvariable ("TRP" + _varcomp) == 1) :  _target setHit ["PAS_P", 1]
    ? (_target getvariable ("TRL" + _varcomp) == 1) :  _target setHit ["PAS_L", 1]
    
    ? (_target getvariable ("TUR" + _varcomp) == 1) :  _target setHit ["VEZ", 1]
    ? (_target getvariable ("GUN" + _varcomp) == 1) :  _target setHit ["ZBRAN", 1]
    
    ? (_target getvariable ("WL11" + _varcomp) == 1) :  _target setHit ["wheel_1_1_steering", 1]
    ? (_target getvariable ("WL12" + _varcomp) == 1) :  _target setHit ["wheel_1_2_steering", 1]
    ? (_target getvariable ("WL13" + _varcomp) == 1) :  _target setHit ["wheel_1_3_steering", 1]
    ? (_target getvariable ("WL14" + _varcomp) == 1) :  _target setHit ["wheel_1_4_steering", 1]
    ? (_target getvariable ("WL21" + _varcomp) == 1) :  _target setHit ["wheel_2_1_steering", 1]
    ? (_target getvariable ("WL22" + _varcomp) == 1) :  _target setHit ["wheel_2_2_steering", 1]
    ? (_target getvariable ("WL23" + _varcomp) == 1) :  _target setHit ["wheel_2_3_steering", 1]
    ? (_target getvariable ("WL24" + _varcomp) == 1) :  _target setHit ["wheel_2_4_steering", 1]
    _DT = damage _target
    player sideChat format["TRG: %1 Arm: KE %2 Pen: SABOT %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]
    goto "exit0"
    
    
    
    #chemical
    
    ? _selection == "VEZ" and _penetration > (_armorCE * NBRand50*0.03) and NBRand100 > 85 : _target setvariable [("TUR" + _varcomp),1,true]
    ? _selection == "ZBRAN" and _penetration > (_armorCE * NBRand50B*0.03) and NBRand100B > 85 : _target setvariable [("GUN" + _varcomp),1,true]
    ? !(_selection == "") : goto "exit"
    
    _commH = _commH + _damage * NBrand100/70
    _drvrH = _drvrH + _damage * NBrand100B/70
    _gunnH = _gunnH + _damage * NBrand100C/70
    
    _armorCE = _armorCE + (NBrand25 * (_armorCE/20) - NBrand10 * (_armorCE/20))
    
    
    ? _difA > 45 and _difA <= 135 : _armorCE = _armorCE / 3
    ? _difA > 135 : _armorCE = _armorCE / 5
    
    ? (_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1) : _top = 1;
    ? (((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    ? (((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    ? _top == 1 : _armorCE = _armorCE / 6
    ~0.01
    ? ((_penetration > _armorCE) and (NBRand100 > 50)) or (NBRand100 > 95) : commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH
    ~0.01
    
    ? _penetration < _armorCE  and NBRand100 < 99 : player sideChat format["TRG: %1 Arm: CE %2 Pen: HEAT %3 Dmg: %5",_target,_armorCE,_penetration,_damage,_DT];goto "exit0"
    _target setDamage _DT + _damage*(_penetration/_armorCE)*(NBRand50/(3*_Surviv));
    
    ? (_target getvariable ("TRP" + _varcomp) == 1) :  _target setHit ["PAS_P", 1]
    ? (_target getvariable ("TRL" + _varcomp) == 1) :  _target setHit ["PAS_L", 1]
    
    ? (_target getvariable ("TUR" + _varcomp) == 1) :  _target setHit ["VEZ", 1]
    ? (_target getvariable ("GUN" + _varcomp) == 1) :  _target setHit ["ZBRAN", 1]
    
    ? (_target getvariable ("WL11" + _varcomp) == 1) :  _target setHit ["wheel_1_1_steering", 1]
    ? (_target getvariable ("WL12" + _varcomp) == 1) :  _target setHit ["wheel_1_2_steering", 1]
    ? (_target getvariable ("WL13" + _varcomp) == 1) :  _target setHit ["wheel_1_3_steering", 1]
    ? (_target getvariable ("WL14" + _varcomp) == 1) :  _target setHit ["wheel_1_4_steering", 1]
    ? (_target getvariable ("WL21" + _varcomp) == 1) :  _target setHit ["wheel_2_1_steering", 1]
    ? (_target getvariable ("WL22" + _varcomp) == 1) :  _target setHit ["wheel_2_2_steering", 1]
    ? (_target getvariable ("WL23" + _varcomp) == 1) :  _target setHit ["wheel_2_3_steering", 1]
    ? (_target getvariable ("WL24" + _varcomp) == 1) :  _target setHit ["wheel_2_4_steering", 1]
    _DT = damage _target
    
    player sideChat format["TRG: %1 Arm: CE %2 Pen: HEAT %3 Dmg: %5",_target,_armorCE,_penetration,_damage,_DT]
    goto "exit0"
    
    #explosive
    ? _selection == "VEZ" and _penetration > (_armorKE * NBRand50*0.03) and NBRand100 > 85 : _target setvariable [("TUR" + _varcomp),1,true]
    ? _selection == "ZBRAN" and _penetration > (_armorKE * NBRand50B*0.03) and NBRand100B > 85 : _target setvariable [("GUN" + _varcomp),1,true]
    
    
    _armorKE = _armorKE + (NBrand25 * (_armorKE/20) - NBrand10 * (_armorKE/20))
    
    ; below mines, bombs and satchel charges cases
    
    ? (_ammo == "mine") or (_ammo == "mineE") : _armorKE = _armorKE / 8;
    ? (_ammo == "mine") or (_ammo == "mineE") (_ammo == "pipebomb") or (_ammo == "timebomb") :  goto "topskip"
    ? (_ammo isKindof "laserbombcore") : goto "topskip0"
    ? (_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1) : _top = 1;
    ? (((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    ? (((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20) : _top = 1;
    
    #topskip0
    ? _top == 1 : _armorKE = _armorKE / 6 
    #topskip
    ? (_ammo == "mine") and _selection == "PAS_P") and NBRand100 > 20 : _target setHit ["PAS_P", 1];  _target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]
    ? (_ammo == "mine") and _selection == "PAS_L") and NBRand100B > 20 : _target setHit ["PAS_L", 1]; _target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]
    
    ? (_ammo == "mine") and (_selection == "wheel_1_1_steering") and (NBRand100 > 10) : _target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_1_2_steering") and (NBRand100 > 10) : _target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_1_3_steering") and (NBRand100 > 10) : _target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_1_4_steering") and (NBRand100 > 10) : _target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_2_1_steering") and (NBRand100 > 10) : _target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_2_2_steering") and (NBRand100 > 10) : _target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_2_3_steering") and (NBRand100 > 10) : _target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]
    ? (_ammo == "mine") and (_selection == "wheel_2_4_steering") and (NBRand100 > 10) : _target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]
    
    ? (_ammo == "mineE") and _selection == "PAS_P") and NBRand100 > 25 : _target setHit ["PAS_P", 1];  _target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]
    ? (_ammo == "mineE") and _selection == "PAS_L") and NBRand100B > 25 : _target setHit ["PAS_L", 1]; _target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]
    
    ? (_ammo == "mineE") and (_selection == "wheel_1_1_steering") and (NBRand100 > 15) : _target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_1_2_steering") and (NBRand100 > 15) : _target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_1_3_steering") and (NBRand100 > 15) : _target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_1_4_steering") and (NBRand100 > 15) : _target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_2_1_steering") and (NBRand100 > 15) : _target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_2_2_steering") and (NBRand100 > 15) : _target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_2_3_steering") and (NBRand100 > 15) : _target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]
    ? (_ammo == "mineE") and (_selection == "wheel_2_4_steering") and (NBRand100 > 15) : _target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]
    
    ? _difA > 45 and _difA <= 135 : _armorKE = _armorKE / 3
    ? _difA > 135 : _armorKE = _armorKE / 5
    ? !(_selection == "") : goto "exit"
    _commH = _commH + _damage * NBrand100/70
    _drvrH = _drvrH + _damage * NBrand100B/70
    _gunnH = _gunnH + _damage * NBrand100C/70
    
    ~0.01
    ? ((_penetration > _armorKE) and (NBRand100 > 50)) or (NBRand100 > 95) : commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH
    ~0.01
    
    ? _penetration < _armorKE and NBRand100 < 99 : player sideChat format["TRG: %1 Arm: KE %2 Pen: EXPL %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT];goto "exit0"
    _target setDamage _DT + _damage*(_penetration/_armorKE)*(NBRand50/(3*_Surviv));
    
    ? (_target getvariable ("TRP" + _varcomp) == 1) :  _target setHit ["PAS_P", 1]
    ? (_target getvariable ("TRL" + _varcomp) == 1) :  _target setHit ["PAS_L", 1]
    
    ? (_target getvariable ("TUR" + _varcomp) == 1) :  _target setHit ["VEZ", 1]
    ? (_target getvariable ("GUN" + _varcomp) == 1) :  _target setHit ["ZBRAN", 1]
    
    ? (_target getvariable ("WL11" + _varcomp) == 1) :  _target setHit ["wheel_1_1_steering", 1]
    ? (_target getvariable ("WL12" + _varcomp) == 1) :  _target setHit ["wheel_1_2_steering", 1]
    ? (_target getvariable ("WL13" + _varcomp) == 1) :  _target setHit ["wheel_1_3_steering", 1]
    ? (_target getvariable ("WL14" + _varcomp) == 1) :  _target setHit ["wheel_1_4_steering", 1]
    ? (_target getvariable ("WL21" + _varcomp) == 1) :  _target setHit ["wheel_2_1_steering", 1]
    ? (_target getvariable ("WL22" + _varcomp) == 1) :  _target setHit ["wheel_2_2_steering", 1]
    ? (_target getvariable ("WL23" + _varcomp) == 1) :  _target setHit ["wheel_2_3_steering", 1]
    ? (_target getvariable ("WL24" + _varcomp) == 1) :  _target setHit ["wheel_2_4_steering", 1]
    _DT = damage _target
    player sideChat format["TRG: %1 Arm: KE %2 Pen: EXPL %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]
    
    #exit0
    
    _commH = damage _comm
    _drvrH = damage _drvr
    _gunnH = damage _gunn
    _dT = _time - _worktime
    
    ;debug to rpt - time work of script for efficiency testing 
    
    diag_log format ["script work time: %1",_dt]
    #exit
    
    exit

    "NBRandomizer.sqs":

    #loop
    NBRand10 = random 10
    NBRand25 = random 25
    NBRand50 = random 50
    NBRand50B = random 50
    NBRand100 = random 100
    NBRand100B = random 100
    NBRand100C = random 100
    ~0.01
    goto "loop"

    "crewnodamage.sqs", to make crew not died from a few unsuccessful hits:

    ;method for avoid normal (but far too big) damage applied to crew of hitted tank. Main script will handle this for its own. "Allow damage false" do not works for some reason. 
    ;This will cause problems, if non-vehicle (typeof "man" i think) units are with some other EH "handledamge". It will remove this EH from them. 
    
    _ix = 0
    _tanks = []
    _i = 0
    #loop0
    ? (_i == "tank" counttype vehicles) : goto "loop1"
    ? (vehicles select _i) isKindOf "tank" : _tanks = _tanks + [vehicles select _i]
    _i = _i + 1
    goto "loop0"
    #loop1
    ;diag_log _tanks
    ? (_i == 0) : goto "exit"
    
    #loop
    ? ("tank" counttype vehicles == 0) : goto "exit"
    {{_x removeallEventHandlers "Handledamage";} foreach crew _x} foreach allunits;
    {{_x removeallEventHandlers "Handledamage";_ix = _x addEventHandler ["Handledamage", ""]} foreach crew _x} foreach _tanks;
    
    ~0.5
    goto "loop"
    #exit
    exit
    

    and simple tank counter:

    #loop1
    _tanksumW = west countSide vehicles
    _tanksumE = east countSide vehicles
    ~1
    hintsilent format ["West %1 - East %2",_tanksumW,_tanksumE]
    goto "loop1"

    init of every armored unit remains unchanded:

    this addEventHandler ["handledamage", {_this exec "NBTank.sqs"}];

    but to abrams tanks I added this, found somewhere on this forum, to remove loader, who always get killed because of his stupidity:

    tankCrew = crew this; crewLoader = (tankCrew select 3); moveOut  crewLoader; deleteVehicle crewLoader;

    Also init of one of units or trigger activation field should contains this:

    [] exec "NBRandomizer.sqs";[] exec "counterT.sqs";[] exec "crewnodamage.sqs"

    (counter is optional of course)

    In the files I put some comments and discussed some problems. Today I will try perhaps more effective way to attacked lined up in front towards the attacker.


  9. I really like the concept of this script. It would be a pity that the subject had disappeared in the depths of oblivion, and from conversations with Nice_Boat I concluded, that he probably not planning to return to the subject. So I took the opportunity to finally learn the syntax (somehow easier for me to figure out in the SQS than SQF) and introduced numerous improvements according to my tastes and needs, such as matter of crew injuries, cases of non-lethal penetration, the way to a better representation of hits in the top armor, more complex model of damage support for more vehicles and weapons from selected addons or greater participation of random factor. My version is surely far from perfect, but it works. But I have some problem. Internet data about penetration and the thickness of the armor if they are not classified, that sometimes tend to be divergent. The values ​​vary depending on the source of up to several tens of percent. For example, reported for the Javelin ATGM ability to penetrate varies between 600 to 900 RHA ... In many cases I was forced to settle on values ​​taken from the game SP: MBT ... Does anyone know an online source of such information for any reason worthy of greater trust from the other?

×