Taxen0 15 Posted November 26, 2012 Hello, I want to make a unit able to somewhat repair vehicles, at least patch them up. I figured that I could use the "object setHit["part",value]" command and that seems to work, but now I need to be able to see if the part is damaged at all so I can choose to hide the action if it's already working, or it's too damaged, etc. getHit seems to have been removed so what can be done? I am using the Ambient Combat Module so I'm guessing eventhandlers would be difficult to add? Thanks! Share this post Link to post Share on other sites
kylania 568 Posted November 26, 2012 Make the unit an Engineer. Keep things simple, that is already build in. Share this post Link to post Share on other sites
Taxen0 15 Posted November 26, 2012 That was the first thing I tried, but I did not see any action for it. So I'm guessing ace could messing with that in some way, thanks for the fast reply Share this post Link to post Share on other sites
Gunter Severloh 4067 Posted November 26, 2012 Heres a script, which has 3 features, rearm, repair, and refuel, like a farp, has a demo mission: Vehicle Rearming Point http://www.armaholic.com/page.php?id=7158 Share this post Link to post Share on other sites
Taxen0 15 Posted November 27, 2012 The script is not quite what I'm looking for, but it helped me get going. now I need to know what parts are the most important ones, like "motor". I found the translation list but its so long and I don't know what you really need from there. I don't want to use setdamage because I don't want to repair hull, and wheels. I found this: this addEventHandler ["dammaged", "hint format['part damaged - %1',_this select 1]"]; in some thread but how can I modify it so I can see all damaged parts after, lets say a rpg blast, and not just the latest? Share this post Link to post Share on other sites
hogmason 2 Posted November 27, 2012 if you want players to be ably to repair damage vehicles this is what i use it allows engineers to repair them you will need to change the classname to match the one you are using ill highlight that part in red. in your init.sqf [player] execVM "vehiclerepair.sqf"; vehiclerepair.sqf if ! isdedicated then { if (count _this > 1) then { (_this select 1) playMove "ActsPercSnonWnonDnon_carFixing2"; sleep 7; (_this select 0) setDammage 0; (_this select 0) setFuel 1; }; if (!isNil ("vehicleRepairInitiated")) exitWith {}; vehicleRepairInitiated = true; waitUntil {sleep 1; alive player}; while {true} do { { if (!(_x getVariable ["RepairsInitiated", false])) then { _id = _x addAction ["Repair Vehicle", "vehiclerepair.sqf", [], 1, false, true, "", "(getDammage _target) < 1 AND (getDammage _target) > 0 AND (typeOf _this) == '[color="#FF0000"]aawInfantryEngineer[/color]' AND (vehicle _this) == _this"]; _x setVariable ["RepairsInitiated", true, false]; }; } foreach vehicles; sleep 5; }; }; hope this helps Share this post Link to post Share on other sites
Taxen0 15 Posted November 27, 2012 Thanks a lot hogmanson! It's not exactly like I wanted it, I just want to fix all parts in a vehicle (ground or air), like rotors and engines, and steering componets. but not the wheels (ace have a function for that) But this works good so I will use it until I can figure out an other way, some day =) I modified it like this if anyone is interested: if ! isdedicated then { _veh = _this select 0; if (count _this > 1) then { (_this select 1) playMove "ActsPercSnonWnonDnon_carFixing2"; sleep 32; if(alive (_this select 1)) then { _damage = 0.7; _damage = getDammage _veh; if(getDammage _veh < 0.7) then { _damage = getDammage _veh; }; _veh setDammage _damage; }; }; if (!isNil ("vehicleRepairInitiated")) exitWith {}; vehicleRepairInitiated = true; waitUntil {sleep 1; alive player}; while {true} do { { if (!(_x getVariable ["RepairsInitiated", false])) then { _id = _x addAction ["Repair Vehicle", "vehiclerepair.sqf", [], 1, false, true, "", "(getDammage _target) < 1 AND (!canMove _target) AND (typeOf _this) == 'USMC_SoldierS_Engineer' AND (vehicle _this) == _this AND (fuel _target > 0) AND (_this distance _target < 4)"]; _x setVariable ["RepairsInitiated", true, false]; }; } foreach vehicles; sleep 5; }; }; now you have to be close to the vehicle that you want to repair, and it does not get back to full hp, also you can only repair a vehicle if its damaged enough so it cant move. still makes the tire exchange from ace redundant, but the non engineers can use that instead. Share this post Link to post Share on other sites
melbo 3 Posted June 9, 2013 Sorry for resurrecting this thread, but if you had multiple specific classes you wanted to use this how would you add their class names in? Share this post Link to post Share on other sites