Jump to content
Sign in to follow this  
ViciousViper

Remove all weapons on the ground

Recommended Posts

Hello!

Im using a script that generate on specific places loot. ( random weapons) and they are respawning, but the problem is, i only can repeat the script

but i need to delete all the stuff before spawning new stuff. So before new loot spawn, all the "old" loot will be removed by a script.

but i cant find one :s

The onliest one ive found isnt working.

The loot spawn script creates random loot(for example 1 dmr, 1 dmr mag, 2 ak mags add watch).

The mission is on whole utes.

Thank you for the help in advance.

Share this post


Link to post
Share on other sites
_clear = nearestObjects [cl1,["weaponholder"],1250];
for "_i" from 0 to count _clear - 1 do {
deleteVehicle (_clear select _i);
sleep 0.056;
};

this is what I use for that purpose. "cl1" is a game logic name and the "1250" is the radius from cl1 that you want cleared.

Share this post


Link to post
Share on other sites
_clear = nearestObjects [cl1,["weaponholder"],1250];
for "_i" from 0 to count _clear - 1 do {
deleteVehicle (_clear select _i);
sleep 0.056;
};

this is what I use for that purpose. "cl1" is a game logic name and the "1250" is the radius from cl1 that you want cleared.

How do i use this?

Do i need a script?

Is it a trigger?

I would be cool if i can use this on domination and my problem here http://forums.bistudio.com/showthread.php?152545-Vehicle-Loadout-Script-only-for-restricted-vehicles so i don't need to change this script

Share this post


Link to post
Share on other sites

It may be better to run it form script but it may work from a trigger, if you know where the vehicles are being spawned then place the trigger over the area

repeating

cond

round (time %1)==1

on act

null=[thistrigger] spawn {_clear = nearestObjects [_this select 0,["weaponholder"],50];   for "_i" from 0 to count _clear - 1 do {   deleteVehicle (_clear select _i);   sleep 0.056;   };};

you could just do it in a gamelogic init

null=[this] spawn { while {true} do {_clear = nearestObjects [_this select 0,["weaponholder"],50];   for "_i" from 0 to count _clear - 1 do {   deleteVehicle (_clear select _i);   sleep 0.056;}; sleep 5;};};

don't forget to adjust the radius the smaller the number the better, ["weaponholder"],50];

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Thx i test it but if i use this i can't open the Inventory in the Area which is bad because i need this on the whole Base. So i have to edit the vehicle loadout script if i found out how

Share this post


Link to post
Share on other sites

Yea I forgot when you open gear it spawns a weaponholder, You could try a distance check where it only removes weapons when no player is in the area

in gamelogic

null=[this] spawn { while {true} do {sleep 1;_clear = nearestObjects [_this select 0,["weaponholder"],50];   for "_i" from 0 to count _clear - 1 do { if (player distance  (_clear select _i) >50) then { deleteVehicle (_clear select _i);   sleep 0.056;};}; sleep 5;};};

Share this post


Link to post
Share on other sites

Read the problem which i have here http://forums.bistudio.com/showthread.php?152545-Vehicle-Loadout-Script-only-for-restricted-vehicles so this would never work on a domination public server because there is always a player in the base ;)

Also there are so many stuff after someone use a wrong car on the loadout that we need a instant restart because nothing work anymore

Share this post


Link to post
Share on other sites
Yea I forgot when you open gear it spawns a weaponholder, You could try a distance check where it only removes weapons when no player is in the area

in gamelogic

null=[this] spawn { while {true} do {sleep 1;_clear = nearestObjects [_this select 0,["weaponholder"],50];   for "_i" from 0 to count _clear - 1 do { if (player distance  (_clear select _i) >50) then { deleteVehicle (_clear select _i);   sleep 0.056;};}; sleep 5;};};

Well, its still not working, the gear is just hanging outthere, as usual. Your script &/ init does not remove Weapons on the ground

---------- Post added at 16:27 ---------- Previous post was at 16:26 ----------

_clear = nearestObjects [cl1,["weaponholder"],1250];
for "_i" from 0 to count _clear - 1 do {
deleteVehicle (_clear select _i);
sleep 0.056;
};

this is what I use for that purpose. "cl1" is a game logic name and the "1250" is the radius from cl1 that you want cleared.

Yea, i put this into a script and my mission runs the script ( at least no script error) but it doesnt remove weapons. The gear is till there.

Share this post


Link to post
Share on other sites

As they both work fine for me it's either something your doing wrong or your after something different.

Share this post


Link to post
Share on other sites
As they both work fine for me it's either something your doing wrong or your after something different.

Your init is working well, but i need it as a script, becaue i want to repeat the script every 1795 second ( because the loot spawn every 1800 seconds, and if the loot isnt removed, the loot is inside another loot)

Share this post


Link to post
Share on other sites
Your init is working well, but i need it as a script, becaue i want to repeat the script every 1795 second ( because the loot spawn every 1800 seconds, and if the loot isnt removed, the loot is inside another loot)

Yeah it work not as script but i found one in the arma 3 section which worked but you have the same Gear problem here every 1795 seconds. I need a cleanup every 0.056 second so i can't use this scripts :(

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]; // Message Boy in the right upper corner

// delay goes here

sleep 30;

};

-> http://forums.bistudio.com/showthread.php?149250-In-area-delete-all-objects-on-the-ground&p=2331627&viewfull=1#post2331627

Share this post


Link to post
Share on other sites

This only work 1 time, i need it to repaet itself every 1795 seconds...

---------- Post added at 17:26 ---------- Previous post was at 17:22 ----------

well, like i said before, the script only works once, not multiple times, Fuck.

Share this post


Link to post
Share on other sites
This only work 1 time, i need it to repaet itself every 1795 seconds...

---------- Post added at 17:26 ---------- Previous post was at 17:22 ----------

well, like i said before, the script only works once, not multiple times, Fuck.

How do you call the script?

I test it with an trigger and the option

Acivation: Anybody and Repeatedly

Edited by Shona

Share this post


Link to post
Share on other sites
How do you call the script?

I test it with an trigger and the option

Acivation: Anybody and Repeatedly

i tried you version with the trigger, in the Act ini box i pasted this

_start = diag_tickTime; { deleteVehicle _x; } forEach allDead; { deleteVehicle _x; } forEach nearestObjects [getpos player,["WeaponHolder","GroundWeaponHolder"],14000]; sleep 5;

its wrong, inst it?

Share this post


Link to post
Share on other sites

yes it is wrong =)

Put the whole code in a cleanup.sqf

then make a trigger

Acivation: Anybody (or BLUFOR) and Repeatedly

On Act.: null = execVM "cleanup.sqf"

If you need your 1795 seconds the change the "sleep 30;" to "sleep 1795;"

EDIT:

Sorry i made a mistake in the On Act. part

Edited by Shona

Share this post


Link to post
Share on other sites
yes it is wrong =)

Put the whole code in a cleanup.sqf

then make a trigger

Acivation: Anybody (or BLUFOR) and Repeatedly

On Act.: null = this execVM "cleanup.sqf"

If you need your 1795 seconds the change the "sleep 30;" to "sleep 1795;"

Ive got it, made a huge mistake by the script by sel. his script works if your 50 meters away from gear onr the ground( that i wasnt, lol)

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  

×