Jump to content
Sign in to follow this  
Craig_VG

Delete units that are a certain distance away from player

Recommended Posts

Hey everyone!

I am wondering how you delete units that are a certain distance away from the player.

This script should be run at an interval, but I can do that myself... :)

Regards and thanks

bobtom

Share this post


Link to post
Share on other sites

Place trigger

Condition: true

On act: 0=[] spawn {while {true} do {sleep 1;{if (_x distance player>1000) then {deleteVehicle _x}} forEach allUnits}}

Share this post


Link to post
Share on other sites
This would do it:

cB AI Unit Caching Demo

http://www.armaholic.com/page.php?id=10102

Hey, I seem to be having some issues with this script. I was wondering if anyone could give me some pointers or answers if they had time.

Situation: Making an ARMA 2 mission, with many AI units that spawn at intervals all over the map. Uses these two missions and mods:

a) A zombie sandbox survival mission http://www.armaholic.com/page.php?id=12014

b) A undead mod/ addon. http://www.armaholic.com/page.php?id=9207

1. I first tried to run AI Caching utility in Arma 2 (non-oa) as I am trying to make a mission that all my friends can play (only some of them have OA). The caching did not work. However, when I tried to run the caching for the demo mission provided and the mission I made and exported from Arma 2 to OA, it worked perfectly. Is it possible to make this utility work for arma 2 as well?

2. How often does the counter that appears on the top right of the screen adjust/ 'refresh'? Is it based off of time? Is it based off how much distance travelled? Also, every time the counter shows up, is that when new AIs have been triggered to be 'un-cached'?

3. I am trying to add the first artillery method shown in this video: (

) to my mission that is AI intensive. It uses the secops manager module and the artillery module to call in artillery through the radio menu. The issue i am having is that when I play it on my mission, even with the caching turned on and working, it takes forever for my transmissions to teach HQ then the artillery pieces. For example, when I select the support option and then select a firemission, I have to wait around 20 seconds for a reply from HQ asking for coordintes, and another minute or so for my coordinates to verify. The FPS is fine, just a long long delay in the menu options and dialogue. Can anyone advise on a new method or a solution? Preferably arma 2 friendly?

Thanks,

Alex

Share this post


Link to post
Share on other sites

Its a script made for Arma2, most scripts, unless designed specifically for certain units in a game will work.

For example I have used scripts from Arma1 with no problems.

The cB AI Unit Caching Demo

http://www.armaholic.com/page.php?id=10102

was made for Arma2.

Make sure you have as its says in the instructions:

Usage:

Put the following in your INIT.SQF file:

0 = [1000] execVM "modules\CEP_Caching\main.sqf";

Make sure you add the functions module in your mission, and put the

0 = [1000] execVM "modules\CEP_Caching\main.sqf";

in your INIT.SQF

you can change that number the 1000 to a smaller number if need be.

I use this script in a few missions i build.

If your building missions for Mp the note or hint at the top right of the screen wont showup as it does in SP.

Share this post


Link to post
Share on other sites

His problem was that he forgot a ; in his .sqf file so it never got to your script exec line. I think he has it working now....:o

Share this post


Link to post
Share on other sites

Hey guys,

When I run the test mission provided by the script download it does not work in Arma 2. There is a function module provided by the mission maker. It does not work in my mission either. However, when i run the same missions in ARMA 2 OA it works. Any idea what gives? Also my SOM module has a lot of delay, any ideas?

Share this post


Link to post
Share on other sites
Hey guys,

When I run the test mission provided by the script download it does not work in Arma 2. There is a function module provided by the mission maker. It does not work in my mission either. However, when i run the same missions in ARMA 2 OA it works. Any idea what gives? Also my SOM module has a lot of delay, any ideas?

you should just run your game as Arma2 CO, not just A2 or OA.

Share this post


Link to post
Share on other sites
you should just run your game as Arma2 CO, not just A2 or OA.

I play with some friends that just have A2, will running arma2 CO allow them to play with me?

Share this post


Link to post
Share on other sites

yes, its the mission only that is determining if A2 or OA or CO owners can join the game.

if A2 content on map, like a module or unit, you need A2 to join, if OA stuff on map, you need OA if both types, you need CO (A2 + OA)

but if you host on your machine like a client server there will be issues i think, but for dedicated no problem, but then again, the same problem will happen for your friends so your kindof stuck here.

Share this post


Link to post
Share on other sites
yes, its the mission only that is determining if A2 or OA or CO owners can join the game.

if A2 content on map, like a module or unit, you need A2 to join, if OA stuff on map, you need OA if both types, you need CO (A2 + OA)

but if you host on your machine like a client server there will be issues i think, but for dedicated no problem, but then again, the same problem will happen for your friends so your kindof stuck here.

Alright, I will try and see if that works. It is odd that even the mission demo made by the script creator doesnt work when launched in arma 2 for me when testing.

Share this post


Link to post
Share on other sites

Alright, I need this to work for mulitplayer.

I am currently using:

if (!isServer) exitwith {};
private ["_dist"];
_dist = _this select 0;

While {true} do 
{
{
If ((_x distance s1 > _dist) && (_x distance s2 > _dist) && (_x distance s3 > _dist) && (_x distance s4 > _dist) && (_x distance s5 > _dist) && (_x distance s6 > _dist) && (_x distance s7 > _dist) && (_x distance s8 > _dist) && (_x distance s9 > _dist) && (_x distance s10 > _dist) && (_x distance s11 > _dist) && (_x distance s12 > _dist) && (side _x == resistance))
then {deletevehicle _x; hint "deleting person";};

} forEach Allunits;
Sleep 5;
};

It is kind of clunky and you need to manually add in the name of each player you want to use.

Can someone rewrite it to make it more efficient? Thanks!

Edited by bobtom

Share this post


Link to post
Share on other sites

I am looking for the exact thing, is there a scripting guru out there?

Share this post


Link to post
Share on other sites

something like this, it checks for all playable units range to _x:

While {true} do {
{
	_unit = _x;
	if ((side _unit) == resistance) then {
		if ( ({(_unit distance _x) > _dist} count playableUnits) == ({isplayer _x} count playableUnits) ) then {
			deletevehicle _unit;
			hint "deleting person";
		};
	};
} forEach Allunits;
Sleep 5;
};

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  

×