Jump to content

Rydygier

Member
  • Content Count

    4448
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by Rydygier

  1. This part of sqf file executed with EH "handledamage": _gcheck = _target getvariable [_gname,0]; (_target is an object, _gname is a string and 0 is 0). causing an RPT error: Error position: <getvariable [_gname,0] Error getvariable: array type, string needed It seems, that it doesn't recognize alternative getvariable syntax. Why?
  2. Well. If so, I have to find another way. If there is any. Thanks for help.
  3. Yes, _gname is a string for sure. Tried with other strings too. I tried code similar to your in sqf activated by trigger: gname = "myVariable"; what = sold1 getVariable [gname,4]; sleep 5; diag_log format ["%1",what]; and same error occurs. Maybe alternative syntax was introduced after Arma 2 1.10, which I use?
  4. Thanks, but I need default value for an undefined variable, so standard syntax here is not an option and so am trying to use this: object getVariable [name, defaultValue] with the described effect.
  5. Prepared similar situation: Trigger is activated when west is present. Until I'm not in its range, helicopter does nothing. When I enter in a trigger radius, helicopter takes off and flies to the next waypoint. It works every time. Many times I used this in my missions. If this does not work, it means that problem lies elsewhere. Maybe in trigger condition? Or maybe I misunderstood something...
  6. Try to connect with this trigger waypoint located almost in the same place as the helicopter (eg a few meters away from him) and the next waypoint place where helicopter has to fly when trigger is activated.
  7. I did some tests, it looks like that SQF scripts work fine. So here's version of addon based on SQF files: NBT_TDS In addition to folder "addons" there are two more: "lessoneshotkill" and "moreoneshotkill". Each of them contains .pbo of the same name (so be careful to not mix them, I suggest simply copy preferred file to folder "addons" overwriting previous one), but in the second case has been greatly increased chance of destroying a tank after first armor penetration (reduced chance for non-killing penetration by tripling average final damage in case of succesful armor penetration). It seems to me that this version is more realistic, but case that someone preferred previous one, in folder "lessoneshotkill" I left a file with old values. By default in folder "addons" is version "more". I think this is enough for now. Must sometimes play this game, not only write scripts for it... For now wish you good fun with this addon. Report here, please, any comments and ideas.
  8. Also recently explored SQF syntax enough to prepare, probably crude, version SQF (NBTank.sqf, CrewDS.sqf, NBRandomizer.sqf, "towards" wait until "turning problems" are resolved, and I have no idea, what else can I do with that... :/ There is no respose in my forum topic about this problem). This is mission with two tanks, for illustrative purposes and for testing. If will not be detected any errors, finally version of "addon" will be based on these files in place of SQS. TDS_test5.utes Beneath code: NBTank.sqf: /* Sqf version of Nice_Boat's Tank Damage System by Rydygier Init for each armored vehicle, for which TDS should to handle damage: this addEventHandler ["handledamage", {null = _this execVM "NBTank.sqf"}] Also needed initialized NBRandomizer.sqf (crucial) and, for best effect, CrewDS.sqf. */ _selection = _this select 1; if not ((_selection == "") or (_selection == "PAS_P") or (_selection == "PAS_L") or (_selection == "wheel_1_1_steering") or (_selection == "wheel_1_2_steering") or (_selection == "wheel_1_3_steering") or (_selection == "wheel_1_4_steering") or (_selection == "wheel_2_1_steering") or (_selection == "wheel_2_2_steering") or (_selection == "wheel_2_3_steering") or (_selection == "wheel_2_4_steering") or (_selection == "VEZ") or (_selection == "ZBRAN")) exitwith {}; _target = _this select 0; _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; _varcomp = str (_target); if (_target getvariable ("GCheck" + _varcomp) != 1) then { _target setvariable [("PAUSE" + _varcomp),0,true]; _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] }; _top = 0; _DT = damage _target; _weapon = currentWeapon _attacker; if ((_damage > 0.7) and (_selection == "PAS_P") and (NBRand100 > 90)) then {_target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]}; if ((_damage > 0.7) and (_selection == "PAS_L") and (NBRand100B > 90)) then {_target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]} else {if ((_damage > 0.6) and (_selection == "wheel_1_1_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_1_2_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_1_3_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_1_4_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_2_1_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_2_2_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_2_3_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]}; if ((_damage > 0.6) and (_selection == "wheel_2_4_steering") and (NBRand100 > 80)) then {_target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]}}; _bullexc = ["B_30mmA10_AP","B_20mm_AP","B_20mm_AA","B_23mm_AA","B_23mm_HE","B_23mm_AP","B_23mm_APHE","B_25mm_HE","B_25mm_HEI","B_25mm_APDS","B_30mm_AP","B_30mm_HE","B_30mm_AA","G_40mm_HE","VIL_B_30mm_ros","ibr_aden30_gunpods"]; {if (_ammo isKindof _x) exitwith {_except = 1}} foreach _bullexc; if ((_ammo isKindof "BulletCore") and (_except != 1)) exitwith {}; _bullexc = nil; _highadv = ((getposASL _attacker) select 2) - ((getposASL _target) select 2); if (damage _target >= 1) then {_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; if (_DHatan == -1) then {_DHatan = 0}; _TcheckA = 9/(1+ _DHatan); _dX = ((getPos _attacker) select 0) - ((getPos _target) select 0); _dY = ((getPos _attacker) select 1) - ((getPos _target) select 1); if (_dX == 0) then {_dX = 1}; if (_dY == 0) then {_dY = 1}; if (_highadv == 0) then {_highadv = 1}; _EWroll = _Tbank select 0; _NSroll = _Tbank select 1; if (((abs _dX) > (abs _dY)) and (_dX > 0)) then {_TcheckL = -_EWroll} else {if (((abs _dX) <= (abs _dY)) and (_dY > 0)) then {_TcheckL = -_NSroll} else {if (((abs _dX) > (abs _dY)) and (_dX <= 0)) then {_TcheckL = _EWroll} else {if (((abs _dX) <= (abs _dY)) and (_dY <= 0)) then {_TcheckL = _NSroll}}}}; _ang = _dX atan2 _dY; _dif = (_ang - getDir _target); //if (_selection == "") and ((_target getvariable ("PAUSE" + _varcomp)) != 1) and ((driver _target) != player) then {[_ang, _target,_attacker,_varcomp] exec "towards.sqs"}; if (_dif < 0) then {_dif = 360 + _dif}; if (_dif > 180) then {_dif = _dif - 360}; _difA = abs _dif; _armorCE = 0; _armorKE = 0; _surviv = 0; _sidePKE = 0;_sidePCE = 0;_rearPKE = 0;_rearPCE = 0;_topPKE = 0;_topPCE = 0;_bottomPKE = 0; if (_target isKindOf "ibr_T55") then {_armorCE = 215; _armorKE = 215; _surviv = 17; _sidePKE = 0.53;_sidePCE = 0.53;_rearPKE = 0.28;_rearPCE = 0.28;_topPKE = 0.14;_topPCE = 0.14;_bottomPKE = 0.25} else {if (_target isKindOf "M1A2_TUSK_MG") then {_armorCE = 1035; _armorKE = 720; _surviv = 30;_sidePKE = 0.54;_sidePCE = 0.62;_rearPKE = 0.11;_rearPCE = 0.17;_topPKE = 0.06;_topPCE = 0.04;_bottomPKE = 0.42} else {if (_target isKindOf "M1A1") then {_armorCE = 1035; _armorKE = 720; _surviv = 26; _sidePKE = 0.44;_sidePCE = 0.43;_rearPKE = 0.1;_rearPCE = 0.08;_topPKE = 0.06;_topPCE = 0.04;_bottomPKE = 0.28} else {if (_target isKindOf "ZSU_Base") then {_armorCE = 9.5; _armorKE = 9.5; _surviv = 10; _sidePKE = 1;_sidePCE = 1;_rearPKE = 1;_rearPCE = 1;_topPKE = 1;_topPCE = 1;_bottomPKE = 0.74} else {if (_target isKindOf "2S6M_Tunguska") then {_armorCE = 15; _armorKE = 15; _surviv = 10; _sidePKE = 0.93;_sidePCE = 0.93;_rearPKE = 0.93;_rearPCE = 0.93;_topPKE = 0.73;_topPCE = 0.73;_bottomPKE = 0.93} else {if (_target isKindOf "T34") then {_armorCE = 85; _armorKE = 75; _surviv = 16; _sidePKE = 0.63;_sidePCE = 0.56;_rearPKE = 0.27;_rearPCE = 0.24;_topPKE = 0.27;_topPCE = 0.24;_bottomPKE = 0.53} else {if (_target isKindOf "T72_Base") then {_armorCE = 490; _armorKE = 390; _surviv = 20; _sidePKE = 0.24;_sidePCE = 0.38;_rearPKE = 0.18;_rearPCE = 0.16;_topPKE = 0.1;_topPCE = 0.08;_bottomPKE = 0.51} else {if (_target isKindOf "T90") then {_armorCE = 1165; _armorKE = 815; _surviv = 24; _sidePKE = 0.48;_sidePCE = 0.73;_rearPKE = 0.11;_rearPCE = 0.08;_topPKE = 0.11;_topPCE = 0.21;_bottomPKE = 0.25} else {if (_target isKindOf "AAV") then {_armorCE = 27.5; _armorKE = 27.5; _surviv = 12; _sidePKE = 1.16;_sidePCE = 1.16;_rearPKE = 0.82;_rearPCE = 0.82;_topPKE = 0.91;_topPCE = 0.91;_bottomPKE = 1.1} else {if (_target isKindOf "BMP2_Base") then {_armorCE = 36.5; _armorKE = 36.5; _surviv = 12; _sidePKE = 0.51;_sidePCE = 0.51;_rearPKE = 0.48;_rearPCE = 0.48;_topPKE = 0.44;_topPCE = 0.44;_bottomPKE = 0.82} else {if (_target isKindOf "BMP3") then {_armorCE = 41.5; _armorKE = 41.5; _surviv = 13; _sidePKE = 0.61;_sidePCE = 0.61;_rearPKE = 0.45;_rearPCE = 0.45;_topPKE = 0.39;_topPCE = 0.39;_bottomPKE = 1.2} else {if ((_target isKindOf "BRDM2_Base") or (_target isKindOf "BRDM2_ATGM_base") or (_target isKindOf "VIL_brdm_m96d")) then {_armorCE = 10.5; _armorKE = 10.5; _surviv = 11; _sidePKE = 0.67;_sidePCE = 0.67;_rearPKE = 0.67;_rearPCE = 0.67;_topPKE = 0.67;_topPCE = 0.67;_bottomPKE = 0.67} else {if (_target isKindOf "BTR90_Base") then {_armorCE = 34; _armorKE = 34; _surviv = 12; _sidePKE = 0.6;_sidePCE = 0.6;_rearPKE = 0.6;_rearPCE = 0.6;_topPKE = 0.6;_topPCE = 0.6;_bottomPKE = 0.59} else {if (_target isKindOf "LAV25_Base") then {_armorCE = 32.5; _armorKE = 32.5; _surviv = 11; _sidePKE = 0.62;_sidePCE = 0.62;_rearPKE = 0.55;_rearPCE = 0.55;_topPKE = 0.62;_topPCE = 0.62;_bottomPKE = 0.62} else {if (_target isKindOf "VIL_LEO2A4") then {_armorCE = 905; _armorKE = 620; _surviv = 26; _sidePKE = 0.27;_sidePCE = 0.46;_rearPKE = 0.13;_rearPCE = 0.22;_topPKE = 0.08;_topPCE = 0.13;_bottomPKE = 0.4} else {if (_target isKindOf "VIL_new_PT91") then {_armorCE = 915; _armorKE = 625; _surviv = 24; _sidePKE = 0.47;_sidePCE = 0.4;_rearPKE = 0.17;_rearPCE = 0.17;_topPKE = 0.1;_topPCE = 0.1;_bottomPKE = 0.4} else {if (_target isKindOf "VIL_t72M1_wp") then {_armorCE = 515; _armorKE = 415; _surviv = 20; _sidePKE = 0.45;_sidePCE = 0.51;_rearPKE = 0.21;_rearPCE = 0.17;_topPKE = 0.12;_topPCE = 0.1;_bottomPKE = 0.4} else {if (_target isKindOf "VIL_rosomak") then {_armorCE = 150; _armorKE = 70; _surviv = 12; _sidePKE = 0.8;_sidePCE = 0.67;_rearPKE = 0.7;_rearPCE = 0.5;_topPKE = 0.4;_topPCE = 0.13;_bottomPKE = 0.8} else {if (_target isKindOf "VIL_OSA_PLOT") then {_armorCE = 10; _armorKE = 10; _surviv = 10; _sidePKE = 1;_sidePCE = 1;_rearPKE = 1;_rearPCE = 1;_topPKE = 1;_topPCE = 1;_bottomPKE = 1} else {if (_target isKindOf "VIL_DANA") then {_armorCE = 35; _armorKE = 35; _surviv = 8; _sidePKE = 0.57;_sidePCE = 0.57;_rearPKE = 0.57;_rearPCE = 0.57;_topPKE = 0.57;_topPCE = 0.57;_bottomPKE = 0.57} else {if (_target isKindOf "VIL_2s1_PL") then {_armorCE = 30; _armorKE = 30; _surviv = 8; _sidePKE = 0.67;_sidePCE = 0.67;_rearPKE = 0.33;_rearPCE = 0.33;_topPKE = 0.33;_topPCE = 0.33;_bottomPKE = 0.5} else {if (_target isKindOf "VIL_bmp1_wp") then {_armorCE = 35; _armorKE = 35; _surviv = 10; _sidePKE = 0.71;_sidePCE = 0.71;_rearPKE = 0.57;_rearPCE = 0.57;_topPKE = 0.29;_topPCE = 0.29;_bottomPKE = 1} else {if (_target isKindOf "VIL_bwp2000_wp") then {_armorCE = 55; _armorKE = 55; _surviv = 13; _sidePKE = 0.5;_sidePCE = 0.5;_rearPKE = 0.1;_rearPCE = 0.1;_topPKE = 0.1;_topPCE = 0.1;_bottomPKE = 0.4} else {if (_target isKindOf "ibr_LEO1A5") then {_armorCE = 380; _armorKE = 335; _surviv = 18; _sidePKE = 0.3;_sidePCE = 0.42;_rearPKE = 0.21;_rearPCE = 0.17;_topPKE = 0.09;_topPCE = 0.08;_bottomPKE = 0.3} else {if (_target isKindOf "MLRS") then {_armorCE = 17.5; _armorKE = 17.5; _surviv = 8; _sidePKE = 0.57;_sidePCE = 0.57;_rearPKE = 0.57;_rearPCE = 0.57;_topPKE = 0.57;_topPCE = 0.57;_bottomPKE = 0.57} else {if (_target isKindOf "GAZ_Vodnik") then {_armorCE = 10.5; _armorKE = 10.5; _surviv = 10; _sidePKE = 0.67;_sidePCE = 0.67;_rearPKE = 0.67;_rearPCE = 0.67;_topPKE = 0.67;_topPCE = 0.67;_bottomPKE = 0.95} else {if (_target isKindOf "GAZ_Vodnik_HMG") then {_armorCE = 10.5; _armorKE = 10.5; _surviv = 10; _sidePKE = 0.67;_sidePCE = 0.67;_rearPKE = 0.67;_rearPCE = 0.67;_topPKE = 0.67;_topPCE = 0.67;_bottomPKE = 0.95}}}}}}}}}}}}}}}}}}}}}}}}}}}; _kinetic = false; _chemical = false; _explosive = false; _penetration = 0; switch true do { case (_ammo isKindOf "shellCore") : { if (_ammo isKindOf "Sh_105_HE") exitwith {_penetration = 62.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "Sh_100_HE") exitwith {_penetration = 70 + NBRand10; _explosive = true}; if (_ammo isKindOf "Sh_120_HE") exitwith {_penetration = 567.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "Sh_120_SABOT") exitwith {_penetration = 805 + NBRand50; _kinetic = true}; if (_ammo isKindOf "Sh_122_HE") exitwith {_penetration = 30 + NBRand25; _explosive = true}; if (_ammo isKindOf "Sh_125_HE") exitwith {_penetration = 81.5 + NBRand50; _explosive = true}; if ((_ammo isKindOf "Sh_125_SABOT") and (_weapon == "D81")) exitwith {_penetration = 515 + NBRand50; _kinetic = true}; if ((_ammo isKindOf "Sh_125_SABOT") and (_weapon == "2A46M")) exitwith {_penetration = 785 + NBRand50; _kinetic = true}; if (_ammo isKindOf "Sh_85_HE") exitwith {_penetration = 35 + NBRand10; _explosive = true}; if (_ammo isKindOf "Sh_85_AP") exitwith {_penetration = 82.5 + NBRand25; _kinetic = true}; if (_ammo isKindOf "VIL_NPL_AP120mm") exitwith {_penetration = 575 + NBRand50; _chemical = true}; if (_ammo isKindOf "VIL_NPL_SB120mm") exitwith {_penetration = 835 + NBRand50; _kinetic = true}; if (_ammo isKindOf "VIL_NPL_HE120mm") exitwith {_penetration = 87.5 + NBRand25; _explosive = true}; if ((_ammo isKindOf "VIL_NPL_SB125mm") and (_attacker isKindOf "VIL_tankERA")) exitwith {_penetration = 645 + NBRand50; _kinetic = true}; if ((_ammo isKindOf "VIL_NPL_AP125mm") and (_attacker isKindOf "VIL_tankERA")) exitwith {_penetration = 775 + NBRand50; _chemical = true}; if (_ammo isKindOf "VIL_NPL_HE125mm") exitwith {_penetration = 97.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "VIL_NPL_SB125mm") exitwith {_penetration = 405 + NBRand50; _kinetic = true}; if (_ammo isKindOf "VIL_NPL_AP125mm") exitwith {_penetration = 475 + NBRand50; _chemical = true}; //if (_ammo isKindOf "VIL_NPL_AP125mm") exitwith {_penetration = 500 + NBRand50; _chemical = true}; if (_ammo isKindOf "VIL_HE152mm") exitwith {_penetration = 112.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "VIL_HE122mm") exitwith {_penetration = 102.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "VIL_HEAT122mm") exitwith {_penetration = 435 + NBRand50; _chemical = true}; if (_ammo isKindOf "vilas_AP73mm") exitwith {_penetration = 375.5 + NBRand25; _chemical = true}; if (_ammo isKindOf "vilas_HE73mm") exitwith {_penetration = 55 + NBRand10; _explosive = true}; if (_ammo isKindOf "VIL_NPL_sb60mm") exitwith {_penetration = 107.5 + NBRand25; _kinetic = true}; if (_ammo isKindOf "VIL_NPL_he60mm") exitwith {_penetration = 15 + NBRand10; _explosive = true}; if (_ammo isKindOf "VIL_NPL_Uni60mm") exitwith {_penetration = 80 + NBRand10; _chemical = true}; if (_ammo isKindOf "VIL_NPL_ap60mm") exitwith {_penetration = 132.5 + NBRand25; _chemical = true}; if (_ammo isKindOf "ibr_Sh_105_SABOT_leo") exitwith {_penetration = 505 + NBRand50; _kinetic = true}; if (_ammo isKindOf "ibr_BM_8_100mm_HVAPDS") exitwith {_penetration = 207.5 + NBRand25; _kinetic = true}; if (_ammo isKindOf "ibr_BK_17_100mm_HEAT") exitwith {_penetration = 275 + NBRand10; _chemical = true}; if (_ammo isKindOf "ibr_OF_32_100mm_HE") exitwith {_penetration = 70 + NBRand10; _explosive = true} }; case (_ammo isKindOf "rocketCore") : { if (_ammo isKindOf "R_Hydra_HE") exitwith {_penetration = 15 + NBRand10; _explosive = true}; if (_ammo isKindOf "R_57mm_HE") exitwith {_penetration = 5 + NBRand10; _explosive = true}; if (_ammo isKindOf "R_80mm_HE") exitwith {_penetration = 25 + NBRand10; _explosive = true}; if (_ammo isKindOf "R_S8T_AT") exitwith {_penetration = 405 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_M136_AT") exitwith {_penetration = 395 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_RPG18_AT") exitwith {_penetration = 350 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_PG7VR_AT") exitwith {_penetration = 625 + NBRand50; _chemical = true}; if ((_ammo isKindOf "R_PG7VL_AT") or (_ammo isKindOf "VIL_PG7M_ammo")) exitwith {_penetration = 475 + NBRand50; _chemical = true}; if ((_ammo isKindOf "R_PG7V_AT") or (_ammo isKindOf "VIL_PG7KO_ammo")) exitwith {_penetration = 305 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_OG7_AT") exitwith {_penetration = 5 + NBRand10; _explosive = true}; if (_ammo isKindOf "R_PG9_AT") exitwith {_penetration = 275 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_OG9_HE") exitwith {_penetration = 19 + NBRand10; _explosive = true}; if (_ammo isKindOf "R_SMAW_HEAA") exitwith {_penetration = 505 + NBRand50; _chemical = true}; if (_ammo isKindOf "R_SMAW_HEDP") exitwith {_penetration = 55 + NBRand10; _chemical = true}; if (_ammo isKindOf "R_GRAD") exitwith {_penetration = 20 + NBRand100; _explosive = true}; if (_ammo isKindOf "R_MLRS") exitwith {_penetration = 550 + NBRand100; _explosive = true} }; case (_ammo isKindOf "missileCore") : { if (_ammo isKindOf "M_Javelin_AT") exitwith {_penetration = 775 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_Stinger_AA") exitwith {_penetration = 25 + NBRand10; _explosive = true}; if (_ammo isKindOf "vil_Sidewinder_OSA") exitwith {_penetration = 207.5 + NBRand25; _explosive = true}; if ((_ammo isKindOf "M_Sidewinder_AA") or (_ammo isKindOf "ibr_AIM9M_AA")) exitwith {_penetration = 85 + NBRand10; _explosive = true}; if ((_ammo isKindOf "M_Strela_AA") or (_ammo isKindOf "VIL_grom_AA")) exitwith {_penetration = 15 + NBRand10; _explosive = true}; if (_ammo isKindOf "M_Igla_AA") exitwith {_penetration = 20 + NBRand10; _explosive = true}; if (_ammo isKindOf "M_AT5_AT") exitwith {_penetration = 625 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_AT13_AT") exitwith {_penetration = 925 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_TOW_AT") exitwith {_penetration = 775 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_TOW2_AT") exitwith {_penetration = 950 + NBRand100; _chemical = true}; if (_ammo isKindOf "M_AT10_AT") exitwith {_penetration = 625 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_AT11_AT") exitwith {_penetration = 875 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_Hellfire_AT") exitwith {_penetration = 1350 + NBRand100; _chemical = true}; if (_ammo isKindOf "M_Vikhr_AT") exitwith {_penetration = 950 + NBRand100; _chemical = true}; if ((_ammo isKindOf "M_Maverick_AT") or (_ammo isKindOf "ibr_AGM65_AG")) exitwith {_penetration = 1750 + NBRand100; _chemical = true}; if (_ammo isKindOf "M_R73_AA") exitwith {_penetration = 85 + NBRand10; _explosive = true}; if (_ammo isKindOf "M_Ch29_AT") exitwith {_penetration = 4150 + NBRand100; _explosive = true}; if (_ammo isKindOf "M_AT2_AT") exitwith {_penetration = 450 + NBRand100; _chemical = true}; if (_ammo isKindOf "M_AT6_AT") exitwith {_penetration = 535 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_AT9_AT") exitwith {_penetration = 895 + NBRand50; _chemical = true}; if (_ammo isKindOf "M_9M311_AA") exitwith {_penetration = 137.5 + NBRand25; _explosive = true}; if (_ammo isKindOf "VILNPL_at3_sagger") exitwith {_penetration = 495 + NBRand50; _chemical = true} }; case (_ammo isKindOf "laserbombCore") : { if (_damage < 0.6) exitwith {}; if (_damage > 1) then {_top = 1}; if (_ammo isKindOf "ibr_GBU12_LGB") exitwith {_penetration = 2950 + NBRand100; _explosive = true}; if (_ammo isKindOf "Bo_FAB_250") exitwith {_penetration = 3350 + NBRand100; _explosive = true} }; default { if (_ammo == "mine") exitwith {_penetration = 687.5 + NBRand25; _explosive = true}; if (_ammo == "mineE") exitwith {_penetration = 245 + NBRand10; _explosive = true}; if ((_ammo == "pipebomb") or (_ammo == "timebomb")) exitwith { _penetration = 100 + NBRand100; _explosive = true}; if (_ammo isKindOf "B_20mm_AP") exitwith { _penetration = 20 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_20mm_AA") exitwith { _penetration = 20 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_23mm_AA") exitwith { _penetration = 24 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_23mm_HE") exitwith { _penetration = 12 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_23mm_AP") exitwith { _penetration = 24 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_23mm_APHE") exitwith { _penetration = 18 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_25mm_HE") exitwith { _penetration = 13 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_25mm_HEI") exitwith { _penetration = 13 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_25mm_APDS") exitwith { _penetration = 23 + NBRand10; _kinetic = true}; if ((_ammo isKindOf "B_30mm_AP") and (_weapon == "2A42")) exitwith { _penetration = 57 + NBRand10; _kinetic = true}; if ((_ammo isKindOf "B_30mm_AP") and (_weapon == "2A72")) exitwith { _penetration = 80 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_30mmA10_AP") exitwith { _penetration = 64 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_30mm_HE") exitwith { _penetration = 16 + NBRand10; _kinetic = true}; if (_ammo isKindOf "B_30mm_AA") exitwith { _penetration = 16 + NBRand10; _kinetic = true}; if (_ammo isKindOf "G_30mm_HE") exitwith { _penetration = 5 + NBRand10; _kinetic = true}; if (_ammo isKindOf "G_40mm_HE") exitwith { _penetration = 6 + NBRand10; _kinetic = true}; if (_ammo isKindOf "VIL_B_30mm_ros") exitwith {_penetration = 10 + NBRand10; _chemical = true}; if (_ammo isKindOf "ibr_aden30_gunpods") exitwith {_penetration = 50 + NBRand10; _kinetic = true} } }; switch true do { case (_kinetic) : { _penetration = _penetration + ((((1000 - (_attacker distance _target))/100) * 0.02) * _penetration); if ((_selection == "VEZ") and (_penetration > (_armorKE * NBRand50*0.03)) and (NBRand100 > 90)) then {_target setvariable [("TUR" + _varcomp),1,true]}; if ((_selection == "ZBRAN") and (_penetration > (_armorKE * NBRand50B*0.03)) and (NBRand100B > 90)) then {_target setvariable [("GUN" + _varcomp),1,true]}; if not (_selection == "") exitwith {}; _commH = _commH + _damage * NBrand100/70; _drvrH = _drvrH + _damage * NBrand100B/70; _gunnH = _gunnH + _damage * NBrand100C/70; _armorKE = _armorKE + (NBrand25 * (_armorKE/20) - NBrand10 * (_armorKE/20)); if ((_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1)) then {_top = 1} else {if ((((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20)) then {_top = 1} else {if ((((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20)) then {_top = 1}}}; if (_top == 1) then {_armorKE = _armorKE * _topPKE}; if ((_top != 1) and (_difA > 45) and (_difA <= 135)) then {_armorKE = _armorKE * _sidePKE}; if ((_top != 1) and (_difA > 135)) then {_armorKE = _armorKE * _rearPKE}; if (((_penetration > _armorKE) and (NBRand100 > 50)) or (NBRand100 > 95)) then {commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH}; if ((_penetration < _armorKE) and (NBRand100 < 99)) exitwith { player sideChat format["TRG: %1 Arm: KE %2 Pen: SABOT %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn }; _target setDamage _DT + _damage*(_penetration/_armorKE)*(NBRand50/(3*_Surviv)); if (_target getvariable ("TRP" + _varcomp) == 1) then { _target setHit ["PAS_P", 1]}; if (_target getvariable ("TRL" + _varcomp) == 1) then { _target setHit ["PAS_L", 1]}; if (_target getvariable ("TUR" + _varcomp) == 1) then { _target setHit ["VEZ", 1]}; if (_target getvariable ("GUN" + _varcomp) == 1) then { _target setHit ["ZBRAN", 1]}; if (_target getvariable ("WL11" + _varcomp) == 1) then { _target setHit ["wheel_1_1_steering", 1]}; if (_target getvariable ("WL12" + _varcomp) == 1) then { _target setHit ["wheel_1_2_steering", 1]}; if (_target getvariable ("WL13" + _varcomp) == 1) then { _target setHit ["wheel_1_3_steering", 1]}; if (_target getvariable ("WL14" + _varcomp) == 1) then { _target setHit ["wheel_1_4_steering", 1]}; if (_target getvariable ("WL21" + _varcomp) == 1) then { _target setHit ["wheel_2_1_steering", 1]}; if (_target getvariable ("WL22" + _varcomp) == 1) then { _target setHit ["wheel_2_2_steering", 1]}; if (_target getvariable ("WL23" + _varcomp) == 1) then { _target setHit ["wheel_2_3_steering", 1]}; if (_target getvariable ("WL24" + _varcomp) == 1) then { _target setHit ["wheel_2_4_steering", 1]}; _DT = damage _target; if true exitwith { player sideChat format["TRG: %1 Arm: KE %2 Pen: SABOT %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn } }; case (_chemical) : { if ((_selection == "VEZ") and (_penetration > (_armorCE * NBRand50*0.03)) and (NBRand100 > 90)) then {_target setvariable [("TUR" + _varcomp),1,true]}; if ((_selection == "ZBRAN") and (_penetration > (_armorCE * NBRand50B*0.03)) and (NBRand100B > 90)) then {_target setvariable [("GUN" + _varcomp),1,true]}; if not (_selection == "") exitwith {}; _commH = _commH + _damage * NBrand100/70; _drvrH = _drvrH + _damage * NBrand100B/70; _gunnH = _gunnH + _damage * NBrand100C/70; _armorCE = _armorCE + (NBrand25 * (_armorCE/20) - NBrand10 * (_armorCE/20)); if ((_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1)) then {_top = 1} else {if ((((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20)) then {_top = 1} else {if ((((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20)) then {_top = 1}}}; if (_ammo isKindOf "M_Javelin_AT") then {_top = 1}; if (_top == 1) then {_armorCE = _armorCE * _topPCE}; if ((_top != 1) and (_difA > 45) and (_difA <= 135)) then {_armorCE = _armorCE * _sidePCE}; if ((_top != 1) and (_difA > 135)) then {_armorCE = _armorCE * _rearPCE}; if (((_penetration > _armorCE) and (NBRand100 > 50)) or (NBRand100 > 95)) then {commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH}; if ((_penetration < _armorCE) and (NBRand100 < 99)) exitwith { player sideChat format["TRG: %1 Arm: CE %2 Pen: HEAT %3 Dmg: %5",_target,_armorCE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn }; _target setDamage _DT + _damage*(_penetration/_armorCE)*(NBRand50/(3*_Surviv)); if (_target getvariable ("TRP" + _varcomp) == 1) then { _target setHit ["PAS_P", 1]}; if (_target getvariable ("TRL" + _varcomp) == 1) then { _target setHit ["PAS_L", 1]}; if (_target getvariable ("TUR" + _varcomp) == 1) then { _target setHit ["VEZ", 1]}; if (_target getvariable ("GUN" + _varcomp) == 1) then { _target setHit ["ZBRAN", 1]}; if (_target getvariable ("WL11" + _varcomp) == 1) then { _target setHit ["wheel_1_1_steering", 1]}; if (_target getvariable ("WL12" + _varcomp) == 1) then { _target setHit ["wheel_1_2_steering", 1]}; if (_target getvariable ("WL13" + _varcomp) == 1) then { _target setHit ["wheel_1_3_steering", 1]}; if (_target getvariable ("WL14" + _varcomp) == 1) then { _target setHit ["wheel_1_4_steering", 1]}; if (_target getvariable ("WL21" + _varcomp) == 1) then { _target setHit ["wheel_2_1_steering", 1]}; if (_target getvariable ("WL22" + _varcomp) == 1) then { _target setHit ["wheel_2_2_steering", 1]}; if (_target getvariable ("WL23" + _varcomp) == 1) then { _target setHit ["wheel_2_3_steering", 1]}; if (_target getvariable ("WL24" + _varcomp) == 1) then { _target setHit ["wheel_2_4_steering", 1]}; _DT = damage _target; if true exitwith { player sideChat format["TRG: %1 Arm: CE %2 Pen: HEAT %3 Dmg: %5",_target,_armorCE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn } }; case (_explosive) : { if ((_selection == "VEZ") and (_penetration > (_armorKE * NBRand50*0.03)) and (NBRand100 > 90)) then {_target setvariable [("TUR" + _varcomp),1,true]}; if ((_selection == "ZBRAN") and (_penetration > (_armorKE * NBRand50B*0.03)) and (NBRand100B > 90)) then {_target setvariable [("GUN" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "PAS_P") and (NBRand100 > 20)) then {_target setHit ["PAS_P", 1]; _target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "PAS_L") and (NBRand100B > 20)) then {_target setHit ["PAS_L", 1]; _target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]} else {if ((_ammo == "mine") and (_selection == "wheel_1_1_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_1_2_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_1_3_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_1_4_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_2_1_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_2_2_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_2_3_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]}; if ((_ammo == "mine") and (_selection == "wheel_2_4_steering") and (NBRand100 > 10)) then {_target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]}}; if ((_ammo == "mineE") and (_selection == "PAS_P") and (NBRand100 > 25)) then {_target setHit ["PAS_P", 1]; _target setHit ["PAS_P", 1];_target setvariable [("TRP" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "PAS_L") and (NBRand100B > 25)) then {_target setHit ["PAS_L", 1]; _target setHit ["PAS_L", 1];_target setvariable [("TRL" + _varcomp),1,true]} else {if ((_ammo == "mineE") and (_selection == "wheel_1_1_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_1_1_steering", 1];_target setvariable [("WL11" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_1_2_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_1_2_steering", 1];_target setvariable [("WL12" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_1_3_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_1_3_steering", 1];_target setvariable [("WL13" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_1_4_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_1_4_steering", 1];_target setvariable [("WL14" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_2_1_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_2_1_steering", 1];_target setvariable [("WL21" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_2_2_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_2_2_steering", 1];_target setvariable [("WL22" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_2_3_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_2_3_steering", 1];_target setvariable [("WL23" + _varcomp),1,true]}; if ((_ammo == "mineE") and (_selection == "wheel_2_4_steering") and (NBRand100 > 15)) then {_target setHit ["wheel_2_4_steering", 1];_target setvariable [("WL24" + _varcomp),1,true]}}; if not (_selection == "") exitwith {}; _armorKE = _armorKE + (NBrand25 * (_armorKE/20) - NBrand10 * (_armorKE/20)); if ((_dif >= -45) and (_dif < 45) and (_Dhatan > 20) and (_Tpitch < (_DHatan/120)) and (NBRand100C > 1)) then {_top = 1}; if ((((_dif > -180) and (_dif <= -135)) or ((_dif > 135) and (_dif <= 180))) and (_Dhatan > 20) and (_Tpitch > -(_DHatan/120)) and (NBRand100C > 20)) then {_top = 1}; if ((((_dif >= 45) and (_dif < 135)) or ((_dif > -135) and (_dif <= -45))) and (_Dhatan > 20) and (_TcheckL < (_DHatan/120)) and (NBRand100C > 20)) then {_top = 1}; if ((_top != 1) and (_difA > 45) and (_difA <= 135)) then {_armorKE = _armorKE * _sidePKE}; if ((_top != 1) and (_difA > 135)) then {_armorKE = _armorKE * _rearPKE}; if ((_ammo == "mine") or (_ammo == "mineE")) then {_armorKE = _armorKE * _bottomPKE}; if ((_top == 1) and not ((_ammo == "mine") or (_ammo == "mineE") or (_ammo == "pipebomb") or (_ammo == "timebomb"))) then {_armorKE = _armorKE * _topPKE}; _commH = _commH + _damage * NBrand100/70; _drvrH = _drvrH + _damage * NBrand100B/70; _gunnH = _gunnH + _damage * NBrand100C/70; if (((_penetration > _armorKE) and (NBRand100 > 50)) or (NBRand100 > 95)) then {commander _target setdamage _commH;driver _target setdamage _drvrH;gunner _target setdamage _gunnH}; if ((_penetration < _armorKE) and (NBRand100 < 99)) exitwith { player sideChat format["TRG: %1 Arm: KE %2 Pen: EXPL %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn }; _target setDamage _DT + _damage*(_penetration/_armorKE)*(NBRand50/(3*_Surviv)); if (_target getvariable ("TRP" + _varcomp) == 1) then { _target setHit ["PAS_P", 1]}; if (_target getvariable ("TRL" + _varcomp) == 1) then { _target setHit ["PAS_L", 1]}; if (_target getvariable ("TUR" + _varcomp) == 1) then { _target setHit ["VEZ", 1]}; if (_target getvariable ("GUN" + _varcomp) == 1) then { _target setHit ["ZBRAN", 1]}; if (_target getvariable ("WL11" + _varcomp) == 1) then { _target setHit ["wheel_1_1_steering", 1]}; if (_target getvariable ("WL12" + _varcomp) == 1) then { _target setHit ["wheel_1_2_steering", 1]}; if (_target getvariable ("WL13" + _varcomp) == 1) then { _target setHit ["wheel_1_3_steering", 1]}; if (_target getvariable ("WL14" + _varcomp) == 1) then { _target setHit ["wheel_1_4_steering", 1]}; if (_target getvariable ("WL21" + _varcomp) == 1) then { _target setHit ["wheel_2_1_steering", 1]}; if (_target getvariable ("WL22" + _varcomp) == 1) then { _target setHit ["wheel_2_2_steering", 1]}; if (_target getvariable ("WL23" + _varcomp) == 1) then { _target setHit ["wheel_2_3_steering", 1]}; if (_target getvariable ("WL24" + _varcomp) == 1) then { _target setHit ["wheel_2_4_steering", 1]}; _DT = damage _target; if true exitwith { player sideChat format["TRG: %1 Arm: KE %2 Pen: EXPL %3 Dmg: %5",_target,_armorKE,_penetration,_damage,_DT]; _commH = damage _comm; _drvrH = damage _drvr; _gunnH = damage _gunn } }; default {if true exitwith {}}; }; NBRandomizer.sqf: /* sqf version of Nice_boat's NBRandomizer by Rydygier init (to initialize only once, at the beginning): null = [] execVM "NBRandomizer.sqf"; */ while {true} do { NBRand10 = random 10; NBRand25 = random 25; NBRand50 = random 50; NBRand50B = random 50; NBRand100 = random 100; NBRand100B = random 100; NBRand100C = random 100; sleep 0.01 }; and CrewDS.sqf: /* sqf version of Crew Damage System by Rydygier init (to initialize only once, at the beginning): null = [] execVM "CrewDS.sqf"; */ _i = 0; while {true} do { _tcount = ("tank" counttype vehicles); _tanks = []; _ix = 0; for [{_i = 0},{(_i <= _tcount-1)},{_i = _i + 1}] do { if ((vehicles select _i) isKindOf "tank") then {_tanks = _tanks + [vehicles select _i]} }; {{_x removeallEventHandlers "Handledamage"} foreach crew _x} foreach allunits; {{_x removeallEventHandlers "Handledamage";_ix = _x addEventHandler ["Handledamage", ""]} foreach crew _x} foreach _tanks; sleep 0.5 }; As you can see, there is a problem. Do not invent better way to protect crew from injury, which has received even without armor penetration ("allowdamage false" here fails, so script checks two times per second, who is currently sitting in vehicle and gives him an empty EH "handledamage", which makes it immune to normal damage, but instead wound "assigns" to the crew NBtank.sqf). CrewDS.sqf must also remove EH's from all those who got out of vehicle. Unfortunately, this removes EH along with all other "handledamage" type EH's. Maybe someone knows way to remove only chosen EH of specific type from unit, even though index of EH is not constant?
  9. Recently wrote a script for own use, using, as usual, SQS syntax. However, I would like learn at practical example also SQF syntax, that is, they say, better (BTW, actually why is it better?). Would someone "translate" for me this script to SQF, so I (and also maybe some other folks) can compare and use them? There is used fourth-level looping and numerous goto's, so simply getting lost in unfamiliar to me syntax when I try to convert this script. Purpose of this script is to create a global variable (an array) containing specified number of positions ensuring field of view in desired direction(s) at chosen distance. For testing purposes also indicates them using markers. I use it mostly for automatic (setpos) deployment units such static weapons, snipers, etc. In certain circumstances it may also indicate rooftops of buildings. It's based on some "(getposASL select 2) comparing" routines. Maybe even someone would have an idea how to improve it? Particularly valuable would be reduction of working time. Now, depending on settings, scan can take long. Here it is: ; if done, scanready become 1 Scanready = 0 ; desired directions are "1" (using other values may give interesting effects perhaps), other are "0". With more than two at once rather not found any good position _N = 1 _S = 0 _E = 1 _W = 0 ; desired hight difference factor (not difference itself) for adjacent steps (required steepness) _level0 = 60 ; maximum number of good spots to find _Nplaces = 50 ; desired distance of not blocked by terrain view from scanned point _LOS = 320 ; loop: if not enough spots found (less than _Nplaces value), script repeats scan with reduced steepness factor within defined limits #again ;initial scan-step (in meters) between scanned point and LOS-testing point _step2 = 2.5 ; steepness factor reduction, now it becomes currently considered hight difference between scanned and testing spots in meters _level0 = _level0/2 hintsilent "Scanning..." ;half of lenght and width of scanned sector (rectangular) _L = 300 _Wd = 300 ;defining of scanned point coordinates variables _X = 0 _Y = 0 ; distance between scanned spots. The larger area to scan, the greater distances between scanned points, and therefore less thorough scanning _step = (_L + _Wd)/40 ; definig global array with "good posts" goodpos1 = [] #start _a = -_step ; loop for horizontal line change (from south to north) #startY _a = _a + _step _y = ((getpos player) select 1) - _Wd +_a ? _Y >= ((getpos player) select 1) + _Wd : goto "exit" _b = -_step ; loop for given horizontal (west - east) line points scan #startX _b = _b + _step; _step2 = 5 _X = ((getpos player) select 0) - _L +_b; ? _X >= ((getpos player) select 0) + _L : goto "startY"; _mark = [_X,_Y]; ; loop for a single point scan for growing distances (subsequent _step2 value is doubling of preceding _step2 value, so it's not linear growth) #step2 _level = _Level0/(1 + (10/_step2)) _step2 = 2*_step2 _marker1 = createTrigger["EmptyDetector",_mark]; _marker2 = createTrigger["EmptyDetector",[_X-_step2,_Y]]; _marker3 = createTrigger["EmptyDetector",[_X+_step2,_Y]]; _marker4 = createTrigger["EmptyDetector",[_X,_Y-_step2]]; _marker5 = createTrigger["EmptyDetector",[_X,_Y+_step2]]; ? (((getposASL _marker1) select 2) <= (((getposASL _marker2) select 2)+_level)*_W) or (((getposASL _marker1) select 2) <= (((getposASL _marker3) select 2)+_level)*_E) or (((getposASL _marker1) select 2) <= (((getposASL _marker4) select 2)+_level)*_S) or (((getposASL _marker1) select 2) <= (((getposASL _marker5) select 2)+_level)*_N) : deletevehicle _marker1;deletevehicle _marker2;deletevehicle _marker3;deletevehicle _marker4;deletevehicle _marker5;goto "startX" ? (_step2 >= _LOS) : goto "found" deletevehicle _marker1 deletevehicle _marker2 deletevehicle _marker3 deletevehicle _marker4 deletevehicle _marker5 goto "step2" ; if good spot found, it is added to goodpos1 array (3D format position array, which is nested inside goodpos1 array) and some marking on the map fo testing purposes #found goodpos1 = goodpos1 + [position _marker1] _good = createMarker[(str _a)+(str _b),_marker1]; _good setMarkerShape "ICON"; ((str _a)+(str _b)) setMarkerType "DOT"; deletevehicle _marker1 deletevehicle _marker2 deletevehicle _marker3 deletevehicle _marker4 deletevehicle _marker5 ? (count goodpos1 >= _Nplaces) : goto "exit" goto "startX" #exit ; final check, if it is enough chosen spots. If not, and if steepness is still large enough, script repeats scan with halfed steepness) ? (count goodpos1 < _Nplaces) and (_level0 >= 6) : goto "again" player sidechat format ["Scan complete: %1 places found",count goodpos1] Scanready = 1 exit I will be grateful for any help. Of course, feel free to experiment with variables and to use code for your own purposes, if needed.
  10. Thanks to knowledge derived here: http://forums.bistudio.com/showthread.php?t=124589 I've prepared an addon version of TDS (requires CBA). This is a test version, I will be grateful if anyone will test, how it works with some tank battle scenario. Addon doesn't contain component "towards" which at this stage does not work well enough because of the above-mentioned problems with rotating tanks. It contains file "NBTank2.sqs" with debug (sidechat). If after hitting tank debug didn't appear, it means that addon is not working (for me it works). TDS addon needs some (5-7) seconds to initialize. "NBT_TDS" currently support tanks and other armored vehicles from original game, vehicles from "Duala Isle" addon (both afrenian and molatian army) and from addon "Modern Polish Army and Police" by Vilas. There isn't a ".bisign" file, because procedure described here ("step nine"): http://community.bistudio.com/wiki/Mondkalb%27s_Addon_Tutorial for me not working. Maybe it's some OS (Vista 64-bit) issue. Here it is: NBT_TDS
  11. @benreeper Surely SQS is, or at least was in my case, a great introduction to writing scripts. So, my own attempt. I will not say it was easy to force this code to work. Sweat and tears. Syntax full of brackets and semicolons is one thing, but longest I was looking for error, which consisted in fact, that variable "isgood" was local, which for some reason made ​​it invisible outside the loop. It works now, but perhaps it's far from optimum. Something could be done better? Simpler? Something is missing or is unnecessary? /* Terrain scanner for spots with good field of view in chosen direction(s) init: null = [Number of needed spots,first direction ("N" "S" "E" "W"),second direction for "N" or "S" only ("E" or "W", optional),free LOS distance in meters, halfed lenght of scanned for spots area (in meters, rectangular), halfed area width] execVM "Spotscan.sqf"; The larger area to scan, the greater distances between scanned points, and therefore less thorough scanning. eg.: null = [50,"N","W",640,300,300] execVM "Spotscan.sqf" or: null = [50,"S","",100,500,200] execVM "Spotscan.sqf" */ _spotsneeded = _this select 0; _windroseOne = _this select 1; _windroseTwo = _this select 2; _scanRange = _this select 3; _sectorLenght = _this select 4; _sectorWidth = _this select 5; _step = (_sectorLenght + _sectorWidth)/40; _isdone = false; _true = true; goodspots = []; hintsilent "Scanning..."; for [{_steepnessInitial = 9},{(_steepnessInitial >= 1) and not (_isdone)},{_steepnessInitial = _steepnessInitial/1.5}] do { for [{_Y = ((getpos markscan) select 1) - _sectorWidth},{_Y <= ((getpos markscan) select 1) + _sectorWidth},{_Y = _Y + _step}] do { for [{_X = ((getpos markscan) select 0) - _sectorLenght},{_X <= ((getpos markscan) select 0) + _sectorLenght},{_X = _X + _step}] do { _scannedSpot = [_X,_Y]; for [{_probeStep = 2.5;isgood = true},{(_probeStep <= _scanRange) and isgood},{_probeStep = 2*_probeStep}] do { _steepnessActual = _steepnessInitial/(1 + (10/_probeStep)); _centralSpot = createTrigger["EmptyDetector",_scannedSpot]; _probeNorth = createTrigger["EmptyDetector",[_X,_Y+_probeStep]]; _probeSouth = createTrigger["EmptyDetector",[_X,_Y-_probeStep]]; _probeEast = createTrigger["EmptyDetector",[_X+_probeStep,_Y]]; _probeWest = createTrigger["EmptyDetector",[_X-_probeStep,_Y]]; switch (_windroseOne) do { case "N" : { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeNorth) select 2)+_steepnessActual)) exitwith {isgood = false}; switch (_windroseTwo) do { case "E": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeEast) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith {isgood = true} }; case "W": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeWest) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith {isgood = true} }; default {if _true exitwith {isgood = true}} } }; case "S": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeSouth) select 2)+_steepnessActual)) exitwith {isgood = false}; switch (_windroseTwo) do { case "E": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeEast) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith{isgood = true} }; case "W": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeWest) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith {isgood = true} }; default {if _true exitwith {isgood = true}} } }; case "E": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeEast) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith {isgood = true} }; case "W": { if (((getposASL _centralSpot) select 2) <= (((getposASL _probeWest) select 2)+_steepnessActual)) exitwith {isgood = false}; if _true exitwith {isgood = true} }; default {if _true exitwith {isgood = false}} }; deletevehicle _centralSpot; deletevehicle _probeNorth; deletevehicle _probeSouth; deletevehicle _probeEast; deletevehicle _probeWest }; if isgood then { goodspots = goodspots + [_scannedSpot]; _goodmark = createMarker[(str _X)+(str _Y),_scannedSpot]; _goodmark setMarkerShape "ICON"; ((str _X)+(str _Y)) setMarkerType "DOT" }; if ((count goodspots) >= _Spotsneeded) exitwith {_isdone = true} } } }; player sidechat format ["Scan complete: %1 places found",count goodspots]; isgood = nil;
  12. It's probably mostly a question of "goto", which preserves a certain way of thinking about code and looping. I am firmly rooted in it, because I was taught what is called "Turbo Pascal". I remember, that I liked there to use similar commands. So this is a matter of shifting to a different way of thinking, what comes to me with difficulty. Maybe I'm too old for such revolutions? :) Still, I will try. Moreover, not always I know, how to use SQF to achieve something, that can easily be done in the SQS. I think that without SQS, I never have learned to write scripts for this game.
  13. @PVPScene Thanks, but I read it. Despite this, "translate" a more complex code seems to outgrow my current possibilities. Of course I intend to increase my knowledge and practice in this and this is what I could use an extensive comparative example. @Muzzleflash Thanks a lot, I'll look at this. So in fact there is no special qualitative difference (eg, efficiency) between the SQS and SQF? Good to know. An interesting thing... To me is much more understandable SQS syntax. Probably because it reminds me a more programming languages, which I have been taught in school, long ago. :)
  14. Or try this: 1. Place a trigger without any condition, perhaps with a eg. 10 second countdown, in the city center; 2. Name it "town1"; 3. Following put in its activation field: {_x switchlight "off"} foreach (position town1 nearObjects ["Streetlamp",900]); (radius value and name are optional of course). (Tried in Chernagorsk, it works)
  15. I made myself in an accessible place a shortcut to "C: \ Users \ Rydygier \ AppData \ Local \ ArmA 2 \ arma2.RPT" (on Vista) and thanks to this I have access to all error reports written. Very useful thing indeed, both to eliminate errors and to use command "diag_log" for testing purposes.
  16. Rydygier

    scripts

    If I understand correctly, what is needed... for example simple stopgap; "cheer.sqs": _soldier = _this select 0 _soldier setmimic "smile" _first = 0 #waiting1 _i = random 100 ? (_i > 50) : goto "start" ~0.5 goto "waiting1" #start _rnd0 = random 100 _rnd1 = round (random 28) + 1 _rnd2 = round (random 5) + 1 ? (_rnd0 > 50) and (_first == 0) : _soldier switchmove ("c7a_bravoTOerc_idle" + str _rnd1); _first = 1 ? (_rnd0 <= 50) and (_first == 0) : _soldier switchmove ("c7a_bravoTOerc_idle" + str _rnd2); _first = 1 ? (_rnd0 > 50) : _soldier playmove ("c7a_bravoTOerc_idle" + str _rnd1) ? (_rnd0 <= 50) : _soldier playmove ("c7a_bravoTOerc_idle" + str _rnd2) #waiting2 ~5 _i = random 100 ? (_i > 75) : goto "start" goto "waiting2" And init field of every unit, which has to cheer: [this] exec "cheer.sqs" other moves here: http://community.bistudio.com/wiki/ArmA2:_Moves As for the shouting, you can add to the script some "say3d" commands, perhaps also with randomization: Say3D But it requires sound files in yours mission folder and corresponding entries in file "description.ext" similar to this: class CfgSounds { sounds[] = {}; class Yeah { name = "Yeah"; sound[] = {"Yeah.ogg", 1, 1}; titles[] = {}; }; class Yeah2 { name = "Yeah2"; sound[] = {"Yeah2.ogg", 1, 1}; titles[] = {}; }; }; then add to "cheer.sqs" something like this directly above #waiting2: _rnd3 = random 100 ? (_rnd3 < 10) : _soldier say3d "Yeah" ? (_rnd3 >= 10) and (_rnd3 < 20) : _soldier say3d "Yeah2" etc...
  17. Quiet here... I understand that there is no way to force command "sendsimplecommand" ("stop") to work properly. It's a pity. In that case plan "B". I can turn tank with mentioned command "setdir", but I need animations and sound of tracks. Command "animate" requires name of animation. What is the name of track animations? Where to look for proper sound? Is "command Say3d" suitable for this purpose?
  18. 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.
  19. Added to "towardA.sqs" this code: #start _enemies = [] ~1 ? ((_tank countenemy [_tank findnearestenemy _tank]) == 0) : goto "exit" _neartanks = nearestObjects [_tank, ["Tank"], 1500] _j = -1 #scanloop _j = _j + 1 ? ((_j+1) > (count _neartanks)) : goto "exitscan" _tankJ = _neartanks select _j ? (((side _tankJ) getFriend (side _tank)) >= 0.6) or ((_tank knowsabout _tankJ) < 0.5) or (str (gunner _tankJ) == "<NULL-OBJECT>") or !(canFire _tankJ) : goto "scanloop" _enemies = _enemies + [_tankJ] ~0.01 goto "scanloop" #exitscan ? ((count _enemies) == 0) : goto "exit" _Cenem = count _enemies _rndm = (round (random _Cenem)) - 1 ? (_rndm < 0) : _rndm = 0 _enemyT = _enemies select _rndm Here's how it now works: - is created list of all tanks within a radius of 1500 meters; - Are removed from this list those vehicles, of which crew does not know or know too little, those that are not hostile, and those in which gunner place is empty (eg immobilised, therefore abandoned, or when gunner get killed) and those, whose gun and/or turret is disabled (i don't know, if it works, if MG's are still operational); - Other vehicles are added to list of "_enemies", in order from nearest, containing potential threats known to the crew - An element of that "_enemies" list, toward which tank hull will turn is randomized (irrational factor, variant with some predominance of choice nearest enemy, eg for two enemies on list, three times in four attempts (75%) to be selected closest enemy, if I am not mistaken, for 3 foes on list 50% and so on) - Irrespective of this, tank also rotates toward vehicle, that hit him. - "doWatch" and "doTarget" are back, this time in "towardsA.sqs", but script still does not affect, that to what tank shoots Here is demonstration, such as before and second, requiring "Duala Isle" map, but better presenting, how script works on a vast plain: TDS_test4 Utes & Duala Tested on Arma 2 1.10 without addons and with Duala Isle addon. (On duala BLUFOR propably loses, is outnumbered) EDIT: I suppose that because of circumstances of command "knowsabout" (KnowsAbout) tank stops rotating towards enemies after two minutes from death of commander because of loss of knowledge about enemies. Unless something has changed since commented on this command in the wiki.
  20. In Arma 2 1.10 M1A2 usually just turns towards enemies and shoots. Without "dowatch" and "dotarget" script in no way affects behavior of turrets. Well, it's BETA patch...
  21. Turret I did not notice this, but removed two lines from the script: "_target doTarget _attacker" and "_target doWatch _attacker". Here is: TDS_test3b3 Is there any difference in behaviour? Reflex is easy to adjust, if needed. :)
  22. Unfortunately, this command appears only in the OA, which I do not have, so I can not try. However, I see a similar command, simpler, "setvelocity". Perhaps it is useful. Thanks for the clue. EDIT: "setvelocity" changes only motion vector, not affect orientation, so can't use them, but try in editor to put yourself as car driver, and put this into its init field: "this setVelocity [-5, 20, 10]" or "this setVelocity [120, 120, 120]". Enjoy. I really have to find some use for this wonderful command. :)
  23. Addon instead script would be great, but I have no idea how to do addons at all, and how to convert to addon this particular script. It is therefore a request for someone better in these matters, to which I join enthusiastically. Second issue is an interesting challenge. And not easy. Assessment of risks is sometimes very complex and not necessarily rational thought processes. It seems to me that game is used for AI purposes a parameter of risk degree, but I'm not sure where I saw it and whether it can be applied here. I'll think about it.
×