Home   Help Search Login Register  

Author Topic: cargo space  (Read 678 times)

0 Members and 1 Guest are viewing this topic.

basil_rs2

  • Guest
cargo space
« on: 15 Jul 2003, 15:56:48 »
how to check remaining cargo space without
filling vehicle with temp units and check which
unit wont get in ?
 ???

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:cargo space
« Reply #1 on: 16 Jul 2003, 03:27:11 »
I'm assuming you're talking about people in the vehicle, rather than 'cargo' (eg. weapons/magazines ;))

You can use the feature:

crew vehicle

to return an array of all units in the vehicle (which you can then count). To get an array of all in cargo, try:

(crew vehicle - [driver vehicle, gunner vehicle ])

Anyway, hope that helps you out ;)

[size=0.5]Edit: Oops... forgot ze bracket[/size]
« Last Edit: 16 Jul 2003, 03:28:09 by Sui »

basil_rs2

  • Guest
Re:cargo space
« Reply #2 on: 16 Jul 2003, 22:24:23 »
yes i mean people in vehicle but how to check an empty vehicle ?
crew vehicle works fine. ;)

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:cargo space
« Reply #3 on: 17 Jul 2003, 02:50:27 »
Ahh... you want to get the capacity of a vehicle (I think I understand now ;D)...

I suggest you check out the Editor's Depot, specifically Plank's Vehicle Capacity List ;)

basil_rs2

  • Guest
Re:cargo space
« Reply #4 on: 19 Jul 2003, 22:33:10 »
assumed I donÂ't know the vehicle name :

Code: [Select]
; // [this] exec "cap_check.sqs"

_veh      = _this select 0
_dumbobj  = "BISCamelPilot"
_pos      = [((getpos _veh) select 0) + 20, (getpos _veh) select 1]

_dumbunits = []
_space    = 0

_i = 0

#loo

  _dumb = _dumbobj createVehicle _pos
  _dumbunits = _dumbunits + [_dumb]

  ~0.1
  _dumb moveincargo _veh
  ~0.1

  if(_dumb in (crew _veh)) then { _space = _space + 1 } else { goto "exit" }

  ~0.1
  _i = _i + 1

goto "loo"

#exit

 "_x action[""EJECT"",vehicle _x]; deleteVehicle _x" foreach _dumbunits

 hint format["%1  seats remaining", _space]
 exit

any other ideas ?

Unnamed

  • Guest
Re:cargo space
« Reply #5 on: 20 Jul 2003, 16:46:51 »
Hi,

You could try this, it's a bit clunky mind you.

Function GetCapacity.sqf:

Code: [Select]

_CurrVehicle = _This select 0;

_Vehicles = ["M1 Abrams","Vulcan","Truck5tRepair","T80"];
_Capacities = [3,2,3,3];

_Capacity = -1;
_iLoop = 0;

? !(TypeOf(_CurrVehicle) in _Vehicles)) : Exit;

While (_iLoop <= (Count _Vehicles)) do
   {
   if (TypeOf(_CurrVehicle) == (_Vehicles select _iLoop)) then
      {
      _Capacity = (_Capacities select _iLoop);
      Exit;
      };
   Else
      {
      _iLoop = _iLoop + 1;
      };
   };
_Capacity


I have written it in the form of a function, but a standard sqs script would do.

I have not run the code  ::), so there will be errors in it. But you get the idea?

Just add the vehicles you want to include in your mission.

Regards