snkman 351 Posted July 17, 2007 Hey guy's, well i have a script called with: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[ge1,[ge2,ge3],[gw1]] exec "myScript.sqs" ge1,ge2,ge2 and gw1 are groups Now in myScript.sqs i have: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _friends = _this select 1 _enemys = _this select 2 But "myScript.sqs" only allows units to pick the leader of the groups so i need a way to split all thous groups into units again or select the leader of the groups "ge1,ge2,ge3 and gw1" How can i do this? I tryed with: myScript.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _friends = _this select 1 _enemys = _this select 2 _unit = unit select 0 _friend = _friends select0 _enemys = _enemys select 0 and myScript.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _friends = _this select 1 _enemys = _this select 2 _unit = unit in units group _unit _friend = _friends in units group _friends _enemys = _enemys in units group _enemys But it didn't work... Someone knows a solution for this? Share this post Link to post Share on other sites
baddo 0 Posted July 17, 2007 Have you seen the leader command? Share this post Link to post Share on other sites
snkman 351 Posted July 17, 2007 Yes i have and it works but only with the first group "ge1" So if i have: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[ge1,[ge2,ge3],[gw1]] exec "myScript.sqs" and in the script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _friends = _this select 1 _enemys = _this select 2 _unit = leader _unit _friends = leader _friends _enemys = leader _enemys And i make a debug with: titletext[format ["\n\n\n %1 ",_unit], "Plain down"] the leader of the group is shown ( EAST 1-1A:1 ) But if i make a debug with the _friends i only get the whole groups ( EAST 1-1B, EAST 1-1C ) same to _enemys ( WEST 1-1A ) Share this post Link to post Share on other sites
baddo 0 Posted July 17, 2007 This problem appears because you have not gone deep enough into your array. You have nested arrays so you must do more select commands to pick the groups from the subarrays. If you have an array: [ge1,[ge2,ge3],[gw1]] passed to the script, then you could get the leader of ge1 by doing: leader (_this select 0) to get the leader of ge2 you will need to do: leader ((_this select 1) select 0) and so on. Study more about arrays. Share this post Link to post Share on other sites
snkman 351 Posted July 17, 2007 Pretty nice Baddo Finally the script starts working correctly without error messages. The way i choosed is a little bit strange but anyway it works so it should be okay till i found a better ont <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _friends = _this select 1 _enemys = _this select 2 _array1 = leader ((_this select 1) select 0) _array2 = leader ((_this select 1) select 1) _unit = leader _unit _friends = [_array1,_array2] _enemys = leader player THX Baddo Share this post Link to post Share on other sites