halex1316 3 Posted December 21, 2017 car sethit ["wheel_1_1_steering", 1]; car sethit ["wheel_1_2_steering", 1]; car sethit ["wheel_2_1_steering", 1]; car sethit ["wheel_1_2_steering", 1]; _hit1 = car getHit "wheel_1_1_steering"; _hit2 = car getHit "wheel_1_2_steering"; _hit3 = car getHit "wheel_2_1_steering"; _hit4 = car getHit "wheel_1_2_steering"; carDamaged = true; carRepaired = false; if ((_hit1 > .1) && (_hit2 > .1) && (_hit3 > .1) && (_hit4 > .1)) then {carDamaged = false}; while {true} do { sleep 1; while {carDamaged} do { sleep 5; carRepaired = false; }; while {!carDamaged} do { carRepaired = true; }; }; I'm trying to do a check for the tires on a vehicle. I want to create a task that requires that each tire be repaired. I'm hesitant to just do a check on the overall damage of the vehicle, because I only want to make sure that the tires (which are destroyed at the start of the script) become fixed. But for some reason, the first if is coming back as false, even though all of the _hit values should be 0, making them less than the .1 requirement. Any ideas? Share this post Link to post Share on other sites
mrcurry 470 Posted December 21, 2017 1. Damage setHit works similar to setDamage:? 1=100% damage 0.5=50% damage 0=0% damage Your if will always return true and set carDamaged to false since all _hitX will always be greater than 0.1. P.s. _hit2 and _hit4 refers to the same part Those nested while's seem a bit odd but I'm gonna assume you're handling the variables somewhere else. Share this post Link to post Share on other sites
halex1316 3 Posted December 21, 2017 Oh shit, you're right. For some reason, I was thinking that getHit would pull the HP of the part, which if the HP was 0, which I thought would mean that if it still had HP left, I defined it as the car not being damaged. I was thinking about it all backward. Thanks for the catch on _hi2 and _hit4. Share this post Link to post Share on other sites