Jump to content
  • 0

setDamage


adrianna

Question

Im currently working on own missions, works so far, but i have a problem with destroying buildings, some will destroy completly, others not (like hangars, some barns, fuel tanks etc.)

_dRadius = (getPosATL _bomb) nearObjects 50;
{_x setDamage 1} forEach _dRadius;
{_x setdamage 1} forEach vehicles;

also tried

{_bomb setdamage 1;} foreach (nearestobjects [getpos _bomb, [],50]);

or

[_bomb,50,42,[]] call bis_fnc_destroyCity;

someone know a solution?

thx

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Im currently working on own missions, works so far, but i have a problem with destroying buildings, some will destroy completly, others not (like hangars, some barns, fuel tanks etc.)

_dRadius = (getPosATL _bomb) nearObjects 50;
{_x setDamage 1} forEach _dRadius;
{_x setdamage 1} forEach vehicles;

also tried

{_bomb setdamage 1;} foreach (nearestobjects [getpos _bomb, [],50]);

or

[_bomb,50,42,[]] call bis_fnc_destroyCity;

someone know a solution?

thx

 

// Static effects damage to buildings
_array = _target nearObjects ["Static", 50];
{_x setDammage ((getDammage _x) + 1.0)} forEach _array;

// NonStrategic effects damage to buildings
_array = _target nearObjects ["NonStrategic", 50];
{_x setDammage ((getDammage _x) + 1.0)} forEach _array
Link to comment
Share on other sites

  • 0

THX Foamy and thx for your FMIssions too ;)

 

No, it didnt work like i want.

The Hangars are destroyed, but after reconnect they are still there, same with trees (trees are client side, right?)

if you are destroying map objects, i.e. objects/building that are actually part of the map, you will have to set the damage for every joining player. I.e. you must call your function or setdamage loop on player loading. You can do this by adding it to server_playerLogin.sqf.

 

This is how I destroyed the benches in the Chernarus NWAF barracks.

 

sqrver_playerLogin.sqf

if (worldName == "chernarus") then {
	([4654,9595,0] nearestObject 145259) setDamage 1;
	([4654,9595,0] nearestObject 145260) setDamage 1;
};

The first array is the position and instead of using a location I used the object ID, obtained from the .wrp.

https://community.bistudio.com/wiki/nearestObject

Link to comment
Share on other sites

  • 0

THX icomrade!

 

But the server already send the status of some object/building to clients, but not all.

I also dont understand, when i use a AS50 and destroy a building, the server send correct informations to clients also after reconnect (u see explosion/burn/smoke on reconnect), but not an all!

Link to comment
Share on other sites

  • 0

Get this working ;)

Did a little mistake, Foamys post is working perfectly.

 

Thanx to all!

 

 

 

 

Thread can be closed

 

Keep in mind that piece of code can be used to apply damage to just about anything and can be used in many different ways. Just change the "Static" to whatever, "Land" "Man" "Air" etc etc... adjust the range and you can even alter the damage section and put in check conditions etc etc. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...