Jump to content
  • 0

Vehicle damage


ViktorReznov

Question

_damage = getDammage _vehClass;
    _damaged = (_damage + 0.2);
    vehicle _vehClass setDamage _damaged;
    _damage2 = getDammage _vehClass;

that bit of code will indeed damage a vehicle but seems it is more intended for blowing it up rather than causing permanent damage. As soon as you enter vehicle after damaging it with that code it automagically repairs itself. How can I get persistent code? Is it with that get/setHit code? That seems terribly inefficient having to loop it to damage all parts concurrently.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
On Saturday, September 16, 2017 at 1:09 PM, ViktorReznov said:

_damage = getDammage _vehClass;
    _damaged = (_damage + 0.2);
    vehicle _vehClass setDamage _damaged;
    _damage2 = getDammage _vehClass;

that bit of code will indeed damage a vehicle but seems it is more intended for blowing it up rather than causing permanent damage. As soon as you enter vehicle after damaging it with that code it automagically repairs itself. How can I get persistent code? Is it with that gset/setHit code? That seems terribly inefficient having to loop it to damage all parts concurrently.

Seems Like youre missing a public var. Pvdz_veh_save maybe? Chech the update of vehicle service point by salival to get a reference of what i talking about.

Link to comment
Share on other sites

  • 0
3 hours ago, juandayz said:

Seems Like youre missing a public var. Pvdz_veh_save maybe? Chech the update of vehicle service point by salival to get a reference of what i talking about.

yea ive been really digging into that code and even with adding something like

PVDZ_veh_Save = [_vehicle,"damage"];
publicVariableServer "PVDZ_veh_Save";

im not getting it to function. infact, adding those extra code bits stops any damage from even occuring. I can make it happen and be visible and last for a minute, but then its reset. It fully restores it even after server restart.

 

Link to comment
Share on other sites

  • 0

_fn_dmg_veh = {
  _hitpoints = _vehicle call vehicle_getHitpoints;
  {
    _damage = [_vehicle,_x] call object_getHit;
    _selection = getText(configFile >> "cfgVehicles" >> _vehClass >> "HitPoints" >> _x >> "name");
    [_vehicle,_selection,(_damage +0.2)] call fnc_veh_handleDam;
  } forEach _hitpoints;
  PVDZ_veh_Save = [_vehicle,"damage"];
  publicVariableServer "PVDZ_veh_Save";
};

 

that does it nicely except for planes, so far in my testing they resist damage... actually all hull damage seems to resist this function. Planes dont get hull damage at all and on everything else the hull will indicate damage but not show....

Link to comment
Share on other sites

  • 0

So to clarify accurately, for all vehicles I tested except for planes, Vehicle will recieve damage and damage will persist through restart on all possible parts, however, the damage to the hull is not reflected on the model state. Body will look pristine even though hull damage is approaching 100%.

On planes, that above code does nothing to it. No damage reflected on the hull indicator, no damage reflected on the texture and that code will blow up a vehicle GUARANTEED after 5 executions(this is a brand new no damage vehicle), not on airplane. It literally does nothing to it.

The only code I can get to do damage to an airplane is the:

Spoiler

_damage = getDammage _vehicle;
    _damaged = (_damage + 0.2);
    vehicle _vehicle setDamage _damaged;
    _damage2 = getDammage _vehicle;

which will not persist after a restart but will blow it up GUARANTEED after 5 executions(this is a brand new no damage vehicle). It matters not on persisting after restart if I add these lines at after

PVDZ_veh_Save = [_vehicle,"damage"];
  publicVariableServer "PVDZ_veh_Save";

damage will not persist. Now I believe it has to do with damage to part vs damage to object and im working on figuring that out but any input from the community would be greatly appreciated!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...