Jump to content
Guest

kill disembarked crews (solved)

Recommended Posts

Guest

Ive eliminated this problem from happening 90% of the time, but it still occurs from time to time, so i want to eliminate it fully

 

This is a vehicle-based mission and all units are using vehicles, i need a script to repeatedly check if any BLUFOR infantry units exist, and to kill them if they are not in a vehicle. need it to be running the whole scenario

 

thonks

 

EDIT:SOLVED IT
after consulting a couple of peeps, this script worked


unitCheckLoop = true;
while {_unitCheckLoop} do {
  {
     if (vehicle _x == _x) then
    {
     deleteVehicle _x;
    };
  } foreach (units blufor);
    sleep 60;
};

 

---

Though due to the presence of a respawn script in my mission i had to change the deletevehicle to "_x setdamage 1;" and it still worked fine

Share this post


Link to post
Share on other sites
{

 if(vehicle _x == _x) then // is on foot?
{

 deleteVehicle _x;

};

} foreach (units blufor);

 

put that script in a loop. should do it

Share this post


Link to post
Share on other sites
38 minutes ago, stanhope said:

Would a getout event handler not be better?

 

yes but depends on how he is spawning the tanks.

Share this post


Link to post
Share on other sites
Guest
7 hours ago, gc8 said:

 

yes but depends on how he is spawning the tanks.

Im using Dreadpirate's Editor Based Unit Spawning script, so the units appear in the editor, but in scenario they seem to be deleted at start, only to appear when their respective trigger activates

 

8 hours ago, gc8 said:

{

 if(vehicle _x == _x) then // is on foot?
{

 deleteVehicle _x;

};

} foreach (units blufor);

 

put that script in a loop. should do it

Im not sure how to do loops but ill try to the best of my ability

tonks

Share this post


Link to post
Share on other sites
Guest

I've tried this, and the game says there's an issue with _x being an undefined variable

 

while {true} do {

 if (vehicle _x == _x) then
{

 deleteVehicle _x;

};

sleep 60;

} foreach (units blufor);

Share this post


Link to post
Share on other sites
Guest

_unitCheckLoop = true;
while {_unitCheckLoop} do {
  {
     if (vehicle _x == _x) then
    {
     deleteVehicle _x;
    };
    sleep 60;
  } foreach (units blufor);
};

 

In a discord server someone gave me the above script, shows no errors but doesn't do anything

Share this post


Link to post
Share on other sites

At a guess, it's because units blufor isn't returning any units. Is there a group that you've called blufor?

Share this post


Link to post
Share on other sites
Guest
6 minutes ago, beno_83au said:

At a guess, it's because units blufor isn't returning any units. Is there a group that you've called blufor?

No need, i got it fixed, this works

 

unitCheckLoop = true;
while {_unitCheckLoop} do {
  {
     if (vehicle _x == _x) then
    {
     deleteVehicle _x;
    };
  } foreach (units blufor);
    sleep 60;
};

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

×