Jump to content
Sign in to follow this  
tambovskya

In area delete all objects on the ground.

Recommended Posts

Is it possible to have a script that will delete anything that is on the ground? I don't mean vehicles, I mean gear, and weapons. Also delete wrecks, and dead units.

Share this post


Link to post
Share on other sites
_start = diag_tickTime;
{ deleteVehicle _x; } forEach allDead;
{ deleteVehicle _x; } forEach nearestObjects [getpos player,["WeaponHolder","GroundWeaponHolder"],14000]
hint format ["Server cleanup took %1 seconds",diag_tickTime - _start];

  • Like 1

Share this post


Link to post
Share on other sites

Now hes going to ask what do i do with that code,

how is it called?

where do i put it?

how do i create this?

is it a script?

how do i create a script?

if its a script where do i put the script?

do i put it in the player init line?

to I create a trigger, and add the code in that?

or a module and add the code to that, what?

Details!

Not everyone knows what to do with the codes.

  • Like 1

Share this post


Link to post
Share on other sites
Now hes going to ask what do i do with that code,

how is it called?

where do i put it?

how do i create this?

is it a script?

how do i create a script?

if its a script where do i put the script?

do i put it in the player init line?

to I create a trigger, and add the code in that?

or a module and add the code to that, what?

Details!

Not everyone knows what to do with the codes.

haha ya like me!

I would assume this would be some kind of loop though.

Share this post


Link to post
Share on other sites

You can set it as an addAction like I did.

The code above should be saved as an sqf file (cleanup.sqf for example).

I utilize this as an addAction on a flag object in game.

The init line of the flag should be:

this addAction ["Clean Up","cleanup.sqf"];

Share this post


Link to post
Share on other sites

I know what to do with the script. I'm learning little by little about how to use, and combine the commands.

Thank you.

The question I do have is:

How would I init the .sqf repeatedly? Maybe every 30 seconds.

Share this post


Link to post
Share on other sites
while {true} do {
   // code goes here

   // delay goes here
   sleep 30;
};

Share this post


Link to post
Share on other sites

Anyone know the despawn bodies script for MP? I've searched high and low for the thread and cant find it

Share this post


Link to post
Share on other sites
Anyone know the despawn bodies script for MP? I've searched high and low for the thread and cant find it

What do you mean despawn?

Share this post


Link to post
Share on other sites
while {true} do {
   // code goes here

   // delay goes here
   sleep 30;
};

Just so others can see how this will work.


while {true} do {
   // code goes here
_start = diag_tickTime;
{ deleteVehicle _x; } forEach allDead;
{ deleteVehicle _x; } forEach nearestObjects [getpos player,["WeaponHolder","GroundWeaponHolder"],14000]
hint format ["Server cleanup took %1 seconds",diag_tickTime - _start];  


   // delay goes here
   sleep 30;
};

Holmes stated he uses this with add action function.

I was assuming more of a automatic execution of the code while the mission/server runs.

Could said code be placed in the Init.sqf and executed that way?

It would free up the player having to run over to a object to clean up the server.

Share this post


Link to post
Share on other sites
In a TDM game make the bodies disapear after player death.

init.sqf

if (!isDedicated) then {
waitUntil {!isNull player};
player addEventHandler ["Respawn",{
	(_this select 1) spawn {
		sleep 60;  // delay before body sinks into ground (seconds)
		hidebody _this;
		sleep 5;
		deleteVehicle _this;
	};
}];
};

Share this post


Link to post
Share on other sites

I know this is old but im using it so it must be still relevant. After alot of testing I found out that you CANNOT use a marker as the position used at the end of the syntax on the nearestobjects function ! Even if you have the marker as a named variable. I am currently using an eden editor trigger to determine when to run the script similar to what @aeroson had posted. so I figured what the heck ill just name the trigger a variable name and see if that works and it did. I dont know if that is a bug or not because another scirpt using similar functions but in spawn mode is basically calling a marker as not only its position but its radius.
A general question I still have is looking at the syntax of the nearestobject i did not need to include the get pos for the variable I was placing a radius around, I also got errors for it. It looks to me that the first param in the nearestobject is setup to "get a pos" of whatever variable you name or just strait up location. I could be wrong and its pretty likely I am. But If I could make this work on a marker that I already have on the map that would just be swell, so if anyone has the minds for that...it be all cool to post it and whatnot. Thanks.

Edited by mechanical
I hit enter before I was done
  • Like 1

Share this post


Link to post
Share on other sites

If I'm reading it right you need  to replace   getpos yourobjectname  and use getmarkerpos "yourmarkername"

 


 

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
Sign in to follow this  

×