Limitless0

Delete Bodies in near Spawns Zones faster

4 posts in this topic

FPS lowers when there are so many bodies piled up in spawn zones. So i modified the garbage collector to despawn bodies within 5 minutes if they are near spawn zones. But seems like it doesn't work at all. No errors, bodies just despawn at the same rate.

 

Here is my modified code:

ExileServer_system_garbageCollector_unscheduled_deleteAllDead.sqf

 

private["_lifeTime","_diedAt"];
_lifeTime = 60 * getNumber (configFile >> "CfgSettings" >> "GarbageCollector" >> "Ingame" >> "AllDead" >> "lifeTime");
{
	_diedAt = _x getVariable ["ExileDiedAt", -1];
	if (_diedAt isEqualTo -1) then 
	{
		_x setVariable ["ExileDiedAt", time];
	}
	else 
	{
		if ([_x, 500] call ExileClient_util_world_isSpawnZoneInRange) then 
		{
			_lifeTime = 600;
		};
		if ((time - _diedAt) >= _lifeTime) then
		{
			_x call ExileServer_system_garbageCollector_deleteObject;
		};
	};
}
forEach allDead;

 

I feel like i have provided enough information needed. If anyone want to point me to the right direction, please let me know how to get this to work.

Share this post


Link to post
Share on other sites

That's because ExileClient_util_world_isSpawnZoneInRange requires a position and a range. _x was just giving it the current object of the forEach loop array. The below code should work. 

[(position _x), 500] call ExileClient_util_world_isSpawnZoneInRange

Let me know if that works. 

Share this post


Link to post
Share on other sites
Advertisement
3 hours ago, WolfkillArcadia said:

That's because ExileClient_util_world_isSpawnZoneInRange requires a position and a range. _x was just giving it the current object of the forEach loop array. The below code should work. 


[(position _x), 500] call ExileClient_util_world_isSpawnZoneInRange

Let me know if that works. 

I used :

getPos _x

position _x

Both do not work.

Share this post


Link to post
Share on other sites
5 hours ago, Limitless0 said:

I used :


getPos _x

position _x

Both do not work.

I just confirmed that it's working properly, so I highly suggest seeing if it's even entering that if statement. Try adding 

diag_log "The dead body is in a spawn zone";

inside your if statement. This will log to your server RPT if it's entering your if statement. 

Last resort if it is entering your if statement. Sometimes ArmA likes to be stupid, so let's try forcing it to behave. 

if ([(position _x), 500] call ExileClient_util_world_isSpawnZoneInRange) then 
{
    if ((time - _diedAt) >= 600) then
    {
        _x call ExileServer_system_garbageCollector_deleteObject;
    };
} else {
    if ((time - _diedAt) >= _lifeTime) then
    {
    	_x call ExileServer_system_garbageCollector_deleteObject;
    };
}

 

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.