ligthert 21 Posted February 24, 2014 I can't seem to find anything on google or the biki, also my experiments have failed. I am trying to gather the available hitpoints available to a unit. If I do for example: getarray(configfile >> "CfgVehicles" >> "B_Soldier_02_f" >> "HitPoints") This returns [] After some investigation configfile >> "CfgVehicles" >> "B_Soldier_02_f" hitpoints doesn't show up, but is a tree on itself. Turning every attempt to use getArray moot. Does anybody know how I can fetch these hitpoints? Thanks in advance! :) Share this post Link to post Share on other sites
f2k sel 164 Posted February 24, 2014 I don't know if this is the only way but it does work, it's an old A2/OA script that someone made. null=this execvm "hitpoints.sqf" private [ "_blgs", "_blg", "_blgtyp", "_scts", "_hitmx","_sctcl", "_sct"]; _blgs = []; _blgtyp = typeOf _this; _scts = []; _hitmx = (count (configFile >> "CfgVehicles" >> _blgtyp >> "HitPoints")) - 1; for "_i" from 0 to _hitmx do { _sctcl = (configFile >> "CfgVehicles" >> _blgtyp >> "HitPoints") select _i; _sct = getText(_sctcl >> "name"); _scts = _scts + [_sct]; }; hint str _scts; Share this post Link to post Share on other sites
ligthert 21 Posted February 24, 2014 Awesome, thanks! :) I'll give it a try tomorrow! :D Share this post Link to post Share on other sites
ligthert 21 Posted February 26, 2014 Yeah it works! Thanks! I hope I can minimize this piece of code. Will post when finished. Share this post Link to post Share on other sites
das attorney 858 Posted February 27, 2014 private [ "_blgs", "_blg", "_blgtyp", "_scts", "_hitmx","_sctcl", "_sct"]; _blgs = []; _blgtyp = typeOf _this; _scts = []; _hitmx = (count (configFile >> "CfgVehicles" >> _blgtyp >> "HitPoints")) - 1; for "_i" from 0 to _hitmx do { _sctcl = (configFile >> "CfgVehicles" >> _blgtyp >> "HitPoints") select _i; _sct = getText(_sctcl >> "name"); _scts = _scts + [_sct]; }; hint str _scts; Out of boredom, I googled "_blgtyp". I thought it was one of the abstractions that Samatra does to his code (pointlessly I might add if you've got a copy of notepad++), but it turns out that it was from tcp: http://forums.bistudio.com/showthread.php?89184-Make-A-City-Town-Ruined-Destroyed-At-Mission-Start&p=1476017&viewfull=1#post1476017 Haven't seen him on these forums for a good while, which is a shame. Thanks for posting it up F2K SEL :) Share this post Link to post Share on other sites
ozdeadmeat 12 Posted February 3, 2015 (edited) Here is a working version of the same code for Arma 3 This will return an array of HitPart items on a specific vehicle. Here are 2 functions I wrote that appear to work. (shocking I know), Majority of smart stuff copied from F2K Sel. GetPartDmg = { private ["_objtype","_array","_hitC","_cfg","_PartN","_HitP"]; //To use: Vehicle call GetPartDmg; >> OutPut Array Similar to [["fuel_hit",0.5],["hull_hit",0.5],["engine_hit",0.5] etc etc] _objtype = typeOf _this; _array = []; _hitC = (count ((configFile >> "CfgVehicles" >> _objtype >> "HitPoints") call Bis_fnc_getCfgSubClasses)) - 1; for "_i" from 0 to _hitC do { _cfg = (configFile >> "CfgVehicles" >> _objtype >> "HitPoints") select _i; _PartN = getText(_cfg >> "name"); _HitP = _this getHit _PartN; _array set [_i,[_PartN,_HitP]]; }; _array }; SetPartDmg = { private ["_obj","_array","_count","_cfg","_PartN","_HitP"]; ////To use: [Vehicle,GETPartDmgArray] call SetPartDmg; This will set all the damage back to the way it was. _obj = _this select 0; _array = _this select 1; _count = (count _this) - 1; for "_i" from 0 to _count do { _hitP = _array select _i; _obj sethit _hitP; }; }; [/code] GetPartDmg returns an array of arrays for every hitpart on that particular vehicle. SetPartDmg uses the output of GetPartDmg and puts all the dmg back. Tested and working locally with Arma 3 NOTE: Does not work in Multiplayer. Will be changing the code to see if I can get it working. Edited February 6, 2015 by OzDeaDMeaT Share this post Link to post Share on other sites