Jump to content
  • 0

Log vehicle destruction [TUT / How To)


WGC GeekGarage

Question

So we have some issue with players on our servers going around just to destroy vehicles in bases which is against our server rules (pointless destruction of objects). I was thinking if it was possible to some how incorporate some code in server_updateObject.sqf so you can use the diag_log to see who damaged and or killed a vehicle?

 

i was thinking about using the "_object_damage" and "_object_killed" function in server_updateObject.sqf to also have the player logged via diag_log?

 

Any one have some solutions to this.

 

i was thinking that the log in RPT file should look like this: "VehicleDest: Player [name] damaged/destroyed vehicle [classname/displayname] at location [coords]"

 

you could always just use the "mapgridposition" to get ingame coords

 

If logging vehicle damage and destruction with player who did it another way i don't see please let me know. logging with the ID of the vehicle is just fine, but if you can have classname and or display name that would be fine too.

 

I just can't wrap my head around how to do it?

 

Running dedicated server so got full access to all files you want me to edit :)

Link to comment
Share on other sites

Recommended Posts

  • 0
This is an example of the above codes output
 
 9:28:27 "Object Killed - Vehicle = 3f81b040# 1075750: skodovka.p3d REMOTE Selection array = [["motor",0.43112],["karoserie",1],["palivo",0.0352178],["wheel_1_1_steering",1],["wheel_2_1_steering",1],["wheel_1_2_steering",1],["glass1",0.684492],["glass3",0.0307561],["glass4",0.0724676]]"
Link to comment
Share on other sites

  • 0

Cool thanks for that.

Info I am looking for just like OP is who did damage to what vehicle at what worldspace.

diag_log format["Vehicle %1 killed by %2 at vehicle position %3", _unit, _killer, (getPos _unit)];

 

if you want to get hitpoints for vehicle parts you would need to use code from _object_killed in servrer_updateObject.sqf. I wouldn't recommend adding too much to this function as it will slow down vehicle saving.

 

Edit: you can convert the position to coordinates using this site http://snuletek.org/arma2coordcalc/

 

you will need to edit the positon a little:

 

[0,[X,Y,Z]]

 

0 is rotation so it doesn't matter in getting position (leave as 0). [X,Y,Z] are the output in the debug code, so it doesn't need to be changed, it just needs to be nested.

 

Edit 2: you can use this command (mapGridPosition), which I just found out about, to get a coordinate position. Although I would stick to the original debug line since all other debug code in your RPT uses engine position instead of coordinates.

 

 diag_log format["Vehicle %1 killed by %2 at vehicle position %3", _unit, _killer, (mapGridPosition (getPos _unit))];

Link to comment
Share on other sites

  • 0

diag_log format["Vehicle %1 killed by %2 at vehicle position %3", _unit, _killer, (mapGridPosition getPos _unit)];

 

use this to convert directly to ingame coords in your log. Am i overlooking some thing, but that function isn't used when some one destroys vehicles (tried hived and non hived). works fine if a players destroys a wall or any other buildable object but not cars. 

Link to comment
Share on other sites

  • 0

diag_log format["Vehicle %1 killed by %2 at vehicle position %3", _unit, _killer, (mapGridPosition getPos _unit)];

 

use this to convert directly to ingame coords in your log. Am i overlooking some thing, but that function isn't used when some one destroys vehicles (tried hived and non hived). works fine if a players destroys a wall or any other buildable object but not cars. 

Yup, I overlooked that it's used for building parts...

 

You'll need to edit this file and make it transfer _killer, then add that debug code to in _object_killed in server_UpdateObject.sqf

https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/compile/vehicle_handleKilled.sqf

 

Just make the conditional code read like this

if (isServer) then {
	[_unit, "killed", _killer] call server_updateObject;
} else {
	PVDZE_veh_Update = [_unit, "killed", _killer];
	publicVariableServer "PVDZE_veh_Update";
};

Then you can use this debug line in _object_killed function.

diag_log format["Vehicle %1 killed by %2 at vehicle position %3", _object, (getPlayerUID (_this select 2)), (mapGridPosition (getPos _object))];

Notice I changed it to the player's UID since the old code would just give you the player's in-game unit assignment, that's really not usable.

Link to comment
Share on other sites

  • 0

this is working nicely, thx! I just changed it to this to get player name

 

diag_log format["Vehicle %1 killed by %2 (%3) at vehicle position %4", _object, _killer, (getPlayerUID  _killer), (mapGridPosition (getPos _object))];

 

 

and in server_updateObject.sqf  at the top, added

_killer = _this select 2;

right below

_object =  _this select 0;

This should give you an output looking like this:

 3:54:59 "Vehicle 32774100# 1070939: m1035_transport.p3d REMOTE killed by B 1-1-F:1 (O_oGuru) (xxxxxxxxx) REMOTE at vehicle position 003106"
Link to comment
Share on other sites

  • 0

Btw, still getting a ton of these:

 

"Vehicle 2f4990c0# 1059051: suv.p3d REMOTE killed by any () at vehicle position 129025"

 

and very few of these:

 

"Vehicle B 1-1-E:1 (Everman) REMOTE killed by any () at vehicle position 076090"

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...