Jump to content
Sign in to follow this  
ColonelKernel

Change a vehicle's variable when it's empty

Recommended Posts

Hi. How can I change a vehicle's variable when it's empty? (dynamically through the mission)

Share this post


Link to post
Share on other sites
13 minutes ago, pierremgi said:

which one?

I want to add this variable to all empty vehicles on the map (preferably player side vehicles):

addVariable ['QS_ST_drawEmptyVehicle',TRUE,TRUE])

It's for the Soldier Tracker script.

 

Share this post


Link to post
Share on other sites

Does the soldier tracker handle the detection if a vehicle is empty or not?

Then it would be as easy as putting this into the vehicles init field:

this setVariable ['QS_ST_drawEmptyVehicle',TRUE,TRUE];

 

Cheers

Share this post


Link to post
Share on other sites
8 minutes ago, Grumpy Old Man said:

Does the soldier tracker handle the detection if a vehicle is empty or not?

Then it would be as easy as putting this into the vehicles init field:


this setVariable ['QS_ST_drawEmptyVehicle',TRUE,TRUE];

 

Cheers

I don't think so. What's the alternative? For example, can I use nearestObjects to find the vehicles?

Share this post


Link to post
Share on other sites
0 = [] spawn {
  while {true} do {
     _allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};
     {
       _x setVariable ["QS_ST_drawEmptyVehicle",true,true];
     } foreach _allEmptyVehs;
  sleep 2;
  };
};

 

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, pierremgi said:

0 = [] spawn {
  while {true} do {
     _allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};
     {
       _x setVariable ["QS_ST_drawEmptyVehicle",true,true];
     } foreach _allEmptyVehs;
  sleep 2;
  };
};

 

Thanks! I'll give it a shot!

Share this post


Link to post
Share on other sites
12 minutes ago, pierremgi said:

0 = [] spawn {
  while {true} do {
     _allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};
     {
       _x setVariable ["QS_ST_drawEmptyVehicle",true,true];
     } foreach _allEmptyVehs;
  sleep 2;
  };
};

 

It works! Thanks a lot!

Share this post


Link to post
Share on other sites
30 minutes ago, pierremgi said:

0 = [] spawn {
  while {true} do {
     _allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};
     {
       _x setVariable ["QS_ST_drawEmptyVehicle",true,true];
     } foreach _allEmptyVehs;
  sleep 2;
  };
};

 

Now that I try it in a mission with a lot of empty elements (crates, vehicles, structures, etc) the game slows down a lot when I open the map. Maybe I should speak with the script creator.

Share this post


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

Now that I try it in a mission with a lot of empty elements (crates, vehicles, structures, etc) the game slows down a lot when I open the map. Maybe I should speak with the script creator.

 

If you don't need to mark crates, weapons lying on ground (dead men), replace:

_allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};

by

_allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle" && !(_x isKindfOf "wepaonHloderSimulated") }};

 

the code is running once for all empty vehicles. That means a hard work at start if plenty of edited vehicles, Then the loop will work on spawned vehicles, much lighter.

For the map, it's up to you for displaying all icons at once or in a player radius for example.

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

 

If you don't need to mark crates, weapons lying on ground (dead men), replace:

_allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle"}};

by

_allEmptyVehs = vehicles select {count crew _x == 0 && isNil {_x getVariable "QS_ST_drawEmptyVehicle" && !(_x isKindfOf "wepaonHloderSimulated") }};

 

the code is running once for all empty vehicles. That means a hard work at start if plenty of edited vehicles, Then the loop will work on spawned vehicles, much lighter.

For the map, it's up to you for displaying all icons at once or in a player radius for example.

Now that you mentioned weapons lying around, it made me think of an idea I had a while ago (not related to this topic)

Is it possible to change the order of items in AI Action Menu? (the one that is shown by pressing key 6) There are too many take weapon actions that I don't even get to do what I actually want!

Share this post


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

Now that you mentioned weapons lying around, it made me think of an idea I had a while ago (not related to this topic)

Is it possible to change the order of items in AI Action Menu? (the one that is shown by pressing key 6) There are too many take weapon actions that I don't even get to do what I actually want!

Truly, I don't know.

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  

×