sarogahtyp 1108 Posted July 20, 2017 error position? maybe u just copy the message out of ur rpt? Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 here's an image of error.https://ibb.co/bsEM0Q where do i find *.rpt ? (sry for my noobiness) Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 I think my brain parsed it without the easy to use rpt paste... this: [_RBconvoy1, _RBconvoy2] should be a list (array) of strings ["String1", String2, ... ] in ur case its a list of arrays. Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 3 minutes ago, dlegion said: where do i find *.rpt ? (sry for my noobiness) https://community.bistudio.com/wiki/Crash_Files Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 ah thanks man ! so...hem...what should i do exactly to have the desired result? Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 i should declare a string and not an array, right ? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 what u did is; 1. defining 4 arrays of strings 2. selecting randomly 2 of those and assigning it those 2 to variables 3. u did put both variables in an array again. resulting in something like this: [["String1", "String2", "StringN"], ["String33", "String21", "String47"]] I think I've a solution. not very clean but should work: _num1 = count _RBconvoy1; _num2 = count _RBconvoy2; _result_array =[]; if (_num1 > _num2) then { { _RBconvoy1 pushBack _x; } count _RBconvoy2; _result_array = _RBconvoy1; } else { { _RBconvoy2 pushBack _x; } count _RBconvoy1; _result_array = _RBconvoy2; }; and then u should use _result_array instead off that which produced the error... Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 i've tried this: _RBcar = "B_MRAP_01_hmg_F","B_MRAP_01_gmg_F"; _RBconvoy1 = selectRandom [_RBcar]; // random select an array to spawn _RBconvoy2 = selectRandom [ _RBaaa, _RBcar]; _Ga3 = [[ getPos Bres1 select 0, (getPos Bres1 select 1) +0, 1],WEST,[_RBconvoy1]] call BIS_fnc_spawnGroup; ...but it spawn just 1 MRAP (instead of 2!) dunno whats wrong.....gives no error... Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 ahh thanks man ! i try to merge it in my code! thanks ! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 (edited) had a mistake in it... here all together: _RBapc = ["B_APC_wheeled_01_cannon_F","B_engineer_F", "B_medic_F", "B_soldier_AT_F","B_soldier_M_F","B_ghillie_sard_F","B_soldier_AA_F","B_soldier_AR_F","B_soldier_GL_F"]; _RBtank = ["B_MBT_01_TUSK_F","B_engineer_F", "B_medic_F", "B_soldier_AT_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_GL_F" ]; _RBaaa = ["B_APC_tracked_01_AA_F"]; _RBcar = ["B_MRAP_01_hmg_F","B_MRAP_01_gmg_F"]; _RBconvoy1 = selectRandom [_RBapc, _RBtank, _RBaaa, _RBcar]; // random select an array to spawn _RBconvoy2 = selectRandom [_RBapc, _RBtank, _RBaaa, _RBcar]; _num1 = count _RBconvoy1; _num2 = count _RBconvoy2; _result_array = []; //decide which array is bigger ad add the smaller one to it to save some //performance because it would be more operation to add the bigger array to the smaller. if (_num1 > _num2) then { //loop through all elements of _RBconvoy2 { // add current element to _RBconvoy1 _RBconvoy1 pushBack _x; true //a safety true } count _RBconvoy2; // _RBconvoy1 is the result in this if then part therefore let _result_array point to it _result_array = _RBconvoy1; } else { //loop through all elements of _RBconvoy1 { // add current element to _RBconvoy2 _RBconvoy2 pushBack _x; true //a safety true } count _RBconvoy1; // _RBconvoy2 is the result in this if then part therefore let _result_array point to it _result_array = _RBconvoy2; }; _Ga3 = [[ getPos Bres1 select 0, (getPos Bres1 select 1) +0, 1],WEST,_result_array] call BIS_fnc_spawnGroup; Edited July 20, 2017 by sarogahtyp fixed undefined variable, added comments Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 really thanks man ! i tested it...it gives an error about "undefined variable line 36 : _result_array cant understand why...its defined in the script!! Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 i never used "case", dont know well what is it, but maybe do something like: select random (CASE1, CASE2, CASE3) CASE1 = spawn X Y Z K Q CASE2 = spawn A B CASE3 = spawn C D E can be a working solution ? EDIT: would be not total random, but a bit of variety its better than nothing ! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 It's not as much I can see on my mobile... Before the first if statement put just_result_array=[];sent from mobile using Tapatalk Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 huge thanks for your help man ! good news, it works ! really thanks man, you found trouble even without being able to test! great!!! Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 3 minutes ago, dlegion said: huge thanks for your help man ! good news, it works ! really thanks man, you found trouble even without being able to test! great!!! yeah my aim in future is to don't even play the game and just parse the sources with my brain. Just need the source code from BI ;-) Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 well...i'm really sorry to boring you again....but i wish you see how fun is this! as soon as it spawns, being more than 1 vehicle, it gets a collision problem and explodes, pushing into the air the vehicles, the soldiers, all in flames...its a nice view for the eyes...but terrible for gameplay! maybe you know a simple solution to spread out a bit the spawned vehicles ? thanksssssssss Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 1 minute ago, sarogahtyp said: yeah my aim in future is to don't even play the game and just parse the sources with my brain. Just need the source code from BI ;-) Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 3 minutes ago, dlegion said: well...i'm really sorry to boring you again....but i wish you see how fun is this! as soon as it spawns, being more than 1 vehicle, it gets a collision problem and explodes, pushing into the air the vehicles, the soldiers, all in flames...its a nice view for the eyes...but terrible for gameplay! maybe you know a simple solution to spread out a bit the spawned vehicles ? thanksssssssss should be possible with the 4th parameter which can pass relative positions to spawn position... but I can't do that today because my work is over in some minutes... maybe another one could figure it out or I ll try it tomorrow. Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 perfect! thanks man for all your help !! now i will try to stydy your code so maybe i understand it completely :) thankssssss! 1 Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 20, 2017 15 minutes ago, dlegion said: perfect! thanks man for all your help !! now i will try to stydy your code so maybe i understand it completely :) thankssssss! added some comments to make it a bit easier... Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 you're a saint ! i was just breaking my brain trying to understand it !! huge thanks again man! really appreciated !! Share this post Link to post Share on other sites
pierremgi 4889 Posted July 20, 2017 [_RBconvoy1, _RBconvoy2] _RBconvoy1 + _RBconvoy2 Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 uuhhh, explain better please! pleaseeeeee! Share this post Link to post Share on other sites
pierremgi 4889 Posted July 20, 2017 3 minutes ago, dlegion said: uuhhh, explain better please! pleaseeeeee! Sorry I just replied to your error, clicking on star (new comment) and I didn't see all your conversation with Sarogahtyp. The question was: ...it returns an error, saying that he expect a string and i (evil person) give him an array. The answer is simple: You pass an array of arrays. Just add them instead, and all is fine. You will have your units in the same group. I suppose that was the reason to not spawn 2 different groups. Share this post Link to post Share on other sites
dlegion 98 Posted July 20, 2017 yes! can you please make an example of that code? i'm keeping get lost in missing [ or not needed ; ecc ! thanks ! Share this post Link to post Share on other sites