Vasily.B 529 Posted March 26, 2016 OK, since week i wanna upgrade this mod, so driver will jump out if component will be damaged enough (fully), so tank will be not able to move, right now even Under barrel grenade launchers can detonate next to vehicle, and drivers disembark.So i modified it like that :(vehicle _x) addEventHandler ["hit",{_veh = _this select 0;_d = driver _veh;if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRTrack" , "wheel_1_1_steering" , "wheel_1_2_steering" , "wheel_2_1_steering" , "wheel_2_2_steering"]["engine" , "LTrack" , "RTrack" , "LFWheel" , "RFWheel" , "RRWheel" , "LRWheel"][1 , 1 , 1 , 1 , 1 , 1 , 1]) exitWith {};_veh setVariable ["willBeRepaired", true];But dont know if its ok, i need more testing. If you could help me with that i would be thankful. Also, did i writed right wheel names? I was looking on google but could find anything good enough, to name good hitpoints. I wanna make this work for all vehicles, even modded. Off course there could be problem if modders will call wheels diferent, but it will be up to them to fix compatibility, for now lets just say, i'm interested to get it working with vanilla + RHS mod.EDIT:Arma is not making this easier :12:19:54 Error in expression <d = driver _veh;if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRT>12:19:54 Error position: <_veh ["HitEngine" , "HitLTrack" , "HitRT>12:19:54 Error Missing )12:19:54 File RTC\rtc\init.sqf, line 912:19:54 Error in expression <d = driver _veh;if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRT>12:19:54 Error position: <_veh ["HitEngine" , "HitLTrack" , "HitRT>12:19:54 Error Missing )12:19:54 File RTC\rtc\init.sqf, line 9EDIT 2:CORRECTED IT TO :if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRTrack" , "wheel_1_1_steering" , "wheel_1_2_steering" , "wheel_2_1_steering" , "wheel_2_2_steering"]["engine" , "LTrack" , "RTrack" , "LFWheel" , "RFWheel" , "RRWheel" , "LRWheel"][1 , 1 , 1 , 1 , 1 , 1 , 1]) exitWith {};But still :12:24:46 Error in expression <d = driver _veh;if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRT>12:24:46 Error position: <_veh ["HitEngine" , "HitLTrack" , "HitRT>12:24:46 Error Missing )12:24:46 File RTC\rtc\init.sqf, line 912:24:46 Error in expression <d = driver _veh;if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRT>12:24:46 Error position: <_veh ["HitEngine" , "HitLTrack" , "HitRT>12:24:46 Error Missing )12:24:46 File RTC\rtc\init.sqf, line 9I'm done, game not recognize where ( is starting and where ) is finishing, i cant work on this anymore.... Please help me, while i'm cooling down......Aktual state of mod/addon:0 = [] spawn {if (!isServer) exitWith {};{(vehicle _x) addEventHandler ["hit",{_veh = _this select 0;_d = driver _veh;if (_veh getVariable ["willBeRepaired", false]) exitWith {};_veh setVariable ["willBeRepaired", true];if (_d != _veh && alive _d && !(_veh iskindof "plane")) then {_d setCombatMode "COMBAT";_veh allowCrewInImmobile true;_d addBackpackGlobal "B_tacticalPack_mcamo";_d additemtobackpack "toolKit";[_d,_veh] spawn {_d = _this select 0;_veh = _this select 1;waitUntil {(_d findNearestEnemy _d) distance _d > 300};doGetOut _d;waitUntil {!(_d in _veh)};sleep 1;_d setVectorDir (getpos _d vectorFromTo getpos _veh);_d playMoveNow "Acts_carFixingWheel";sleep 10;_d switchMove "";if (alive _d) then {_veh setDamage 0;_veh setVariable ["willBeRepaired", false];};};}}];} foreach allUnits}; Share this post Link to post Share on other sites
Pennyworth 180 Posted March 26, 2016 You've edited the post a few times so I'm a little confused what the current state of the script is but a likely cause of the script error is this line. if (getHitPointDamage _veh ["HitEngine" , "HitLTrack" , "HitRTrack" , "wheel_1_1_steering" , "wheel_1_2_steering" , "wheel_2_1_steering" , "wheel_2_2_steering"]["engine" , "LTrack" , "RTrack" , "LFWheel" , "RFWheel" , "RRWheel" , "LRWheel"][1 , 1 , 1 , 1 , 1 , 1 , 1]) exitWith {}; That's not how getHitPointDamage works. The object should be in front of the getHitPointDamage (_veh getHitPointDamage). Also, the command only takes one parameter that is a string, not an array of strings. If I understand what you want correctly, you want the script to exit if the vehicle is not damaged, so I would do the following. _damageValues = (getAllHitPointsDamage _veh) select 2; _damagedParts = _damageValues select {_x != 0}; if(_damagedParts isEqualTo []) exitWith {}; This is using the command getAllHitPointsDamage, which returns three arrays, the first is an array of hit point names, second is an array of hit selection names, and the third is an array of damage values. So in this case the first line is selecting the array of damage values and setting it to a variable. The second line is selecting any values from the array of damage values that do not equal zero, and then saving that to an array. We are doing this because we want to know if anything is damaged, if one hit point is damaged the value will be greater than zero and thus the vehicle needs to be repaired. So on the third line we are checking if the damage parts array is equal to an empty array, if it does that means that no damage values was greater than zero, and thus we exit. If any part of the vehicle is damaged the array will not be empty and the script will continue. Share this post Link to post Share on other sites
Vasily.B 529 Posted March 26, 2016 Well actual state of script is : if getAllHitPointsDamage _veh; [ ["HitEngine" , "HitLTrack" , "HitRTrack" , "wheel_1_1_steering" , "wheel_1_2_steering" , "wheel_2_1_steering" , "wheel_2_2_steering"], ["Engine" , "LeftTrack" , "RightTrack" , "LeftFrontWheel" , "RightFrontWheel" , "RightRearWheel" , "LeftRearWheel"], [1 , 1 , 1 , 1 , 1 , 1 , 1] ] true, exitWith {}; _veh setVariable ["willBeRepaired", true];Al i want to do, is to make Crew disembark, when some parts become damaged, then crew (driver exacly) should repair broken componen and back to vehicle.Broken components, as condition to disembark, as you may see are : ["Engine" , "LeftTrack" , "RightTrack" , "LeftFrontWheel" , "RightFrontWheel" , "RightRearWheel" , "LeftRearWheel"], Share this post Link to post Share on other sites
six_ten 208 Posted March 29, 2016 Are you doing something like this: Realistic Tank Crew by vlad_8011 http://www.armaholic.com/page.php?id=30482 Share this post Link to post Share on other sites
Vasily.B 529 Posted March 29, 2016 Are you doing something like this: Realistic Tank Crew by vlad_8011 http://www.armaholic.com/page.php?id=30482 Actually its mine addon. Share this post Link to post Share on other sites