Jump to content
atmo

Increasing 'AllDead' and 'AllDeadmen' collections during game - can't deleteVehicle

Recommended Posts

8 hours ago, killzone_kid said:


This command will just get ignored

You right... I copy and pasted then wrong thing...

{
	{(vehicle _x) deleteVehicleCrew _x} foreach crew _x;
	deleteVehicle _x;
} forEach allDead;

I didn't reload the mission just looked through a likely candidate from my folders.... I was in a bit of a rush so my apologies. I do promise to set up a test mission. It isn't going to happened tonight (14th.... jeez)….

 

Atmo

Edited by atmo
spelling

Share this post


Link to post
Share on other sites

Ah,

 

@magicsrp

 

So; finally, I got back to this.. Sorry. 

 

It seems you must have a pause between two passes of deleting stuff...

[] spawn {
	while {true} do {
		scriptName "Cleanup";
		sleep 5;
		
		_before = count allDead;
		// First pass - delete all vehicle crews in allDead collection
		{
			{(vehicle _x) deleteVehicleCrew _x} foreach crew _x;
		} forEach allDead;
		
		// MUST pause - each deletion above is done *next* frame
		sleep 1;
		
		// Second pass - now delete the vehicles.
		{
			deleteVehicle _x;
		} forEach allDead;
		
		diag_log format ["AllDead : %1 : %2", _before, count AllDead];
		
		hint format["AllDead : %1, %2", _before, count allDead];
		
	};
};

I forgot I had done that, I should correct the previous post

 

A test mission is at,,,,Stress Test GC

 

Let me know if it works your end. Sorry about being so late.... so so busy... !

Atmo

Share this post


Link to post
Share on other sites

Hmmm...

To me, a simple loop with :

{ deleteVehicle _x} forEach allDead;

is enough (TESTED) I tested it, blowing an MRAP with a Titan missile.

 

Note: It takes 30 sec for allDead, or allDeadMen, to shift the unit identity (like [B Alpha 1-2:1,B Alpha 1-2:2]) , here the crew of the MRAP (but also the vehicle with the same B Alpha 1-2:2 as the effectiveCommander.

into:

 [B Alpha 1-2:1,1d42130d1c0# 1675084: b_soldier_01.p3d] and B Alpha 1-2:1 for vehicle (cursorObject)

then, [1d29cb7d100# 1675081: b_soldier_01.p3d,1d42130d1c0# 1675084: b_soldier_01.p3d] and 1d2c874e040# 1675074: mrap_01_hmg_f.p3d for the vehicle

 

If you deleteVehicle at once (when allDead still returns the identity instead of p3d), it's OK.

If you wait, your method or mine is not enough. A p3d unit will remain.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

If you deleteVehicle at once (when allDead still returns the identity instead of p3d), it's OK.

If you wait, your method or mine is not enough. A p3d unit will remain.

 

So how to do this ?

Maybe with an eventhandler killed ?

Share this post


Link to post
Share on other sites

But generally this means so else that it will be deleted at once in front of the player eyes.

Can it be different ?

Share this post


Link to post
Share on other sites
33 minutes ago, GEORGE FLOROS GR said:

But generally this means so else that it will be deleted at once in front of the player eyes.

Can it be different ?

I guess not for blown vehicle crew. that's the problem. If a corpse is visible, so you can delete it when you want. The weird starts with vanished crew, not so vanished as you can count them in alldeadMen and delete them also with deleteVehicle. They seems to stay at vehicle position and they are not hidden. So,... here is my limit of understanding.

  • Like 1

Share this post


Link to post
Share on other sites
21 minutes ago, pierremgi said:

I guess not for blown vehicle crew.

 

Since it's all about the crew,

 

if we put them out with a EH damage and

{ unassignVehicle _x } forEach crew _vehiclename;

add the units a dead animation and kill them in a certain distance ?

Would this be working ?

Share this post


Link to post
Share on other sites
On ‎1‎/‎6‎/‎2019 at 7:56 PM, atmo said:

 

In particular notice

 


"allDead: 2, class: I_soldier_F, netID 2:390, object 2185c0413c0# 1813778: ia_soldier_01.p3d, crew [2185c0413c0# 1813778: ia_soldier_01.p3d], vehicle 2185c0413c0# 1813778: ia_soldier_01.p3d"

where the .p3d object is it's own crew (and vehicle!)......you can now delete these if you delete the crew and then it becomes a <NULL-object>

 

 

 

 

Yes, @pierremgi The issue I think I noticed was that sometimes, as above, objects seem to be their own crew..... This self referencing, I think, is the crux if the problem, but it seems to be able to delete <Null Objects> (thank god!) So the solution I have shown to work is 

 

in the first pass DeleteVehicleCrew - this will delete them *on the next frame* so you wait a bit and then *deleteVehicle*… Of course it shouldn't matter and you do it all together it will just wait until the next loop of deleteVehicle to delete the ones without a crew. (then the pd3 *will* be deleted).

 

 

As an aside you obviously can control what and who gets deleted you can put a timestamp on the object or test how far it is from a player etc before trying to delete it....

 

in "Killed" EH

// Set a time killed variable onto the killed unit.
// We can use this in our cleanup script.
_killed setVariable ["TOD", Servertime]; // TOD = Time Of Death

then 

// Dead
{
	_TOD = _x getVariable ["TOD", 0]; // Time Of Death - variable added in the 'Killed' Event Handler.
	//diag_log format ["allDead: %1, class %2, TOD %3, %4", _forEachIndex, typeOf _x, _TOD, _serverTime - _TOD];
	if (_serverTime - _TOD > 600) then {
		{(vehicle _x) deleteVehicleCrew _x} foreach crew _x;
	};
	//_netID = _x call BIS_fnc_netId;
	//_object = _netID call BIS_fnc_objectFromNetID;
	//diag_log format ["allDead: %1, class: %2, netID %3, object %4, crew %5, vehicle %6", _forEachIndex, typeOf _x, _netID, _object, crew _x, vehicle _x];
} forEach allDead;
		
// MUST pause - each deletion above is done *next* frame (only if we really want it to show - obviously in the next pass it would delete it....just that *at least one frame must have passed for it to be deleted....*)
sleep 1;

// Second pass - now delete the vehicles.
{
	deleteVehicle _x;
} forEach allDead;

etc etc.. that bit is trivial.

 

Atmo

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×