Jump to content

Foobee

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Posts posted by Foobee


  1. Since Arma 1.05, there's a new function, assignedVehicleRole.

    See it here

    The function returns detailed turret positions too biggrin_o.gif

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    _myArray = [];

    _myVehicle = XXXX;

    {

    if ( (count (assignedVehicleRole _x)>0) && ((assignedVehicleRole _x) select 0) == "Cargo") then

    {

    _myArray = _myArray + _x;

    };

    } forEach crew _myVehicle;

    (I did not test the code but you get the idea...)

    Edit: I revived this old thread as it is linked on a biki page (which I closed and can't find back...)


  2. Hello, you can randomize the select in the array :

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    _array = ["script_A.sqf","script_B.sqf","script_Z.sqf"];

    _script = _array select (random ((count _array) - 1));

    [...] execVM _script;

    ('old' syntax below)

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    _array = ["script_A.sqf","script_B.sqf","script_Z.sqf"]

    _script = _array select (random ((count _array) - 1))

    [...] exec _script

    'Random' returns real values, you can check about index rounding here.

    This code won't work on an empty array wink_o.gif

    Cheers

×