sader1992 Posted August 19, 2020 Group: Content Moderator Topic Count: 55 Topics Per Day: 0.01 Content Count: 1691 Reputation: 716 Joined: 12/21/14 Last Seen: 3 hours ago Share Posted August 19, 2020 View File F_Randomizer randomize and split array into arrays this function can be used to randomize and split thr first array passed in to it to the other arrays Warning! the main array size must be divided by the count of the other arrays for example , you have .@main size 4, you should not send 3 arrays cuz 4/3 = 1 and 1 left , it will fail! the example npc from the photo is included in the file also here it is - script Randomizer_test -1,{ OnInit: debugmes "================================================"; setarray .@main,1,2,3,4,5,6,7,8,9,10,11,12; for(.@i=0;.@i<getarraysize(.@main);.@i++){ debugmes "" + .@main[.@i]; } debugmes "================================================"; debugmes "Split and randomize the elements of .@main into .@a .@b .@c .@d .@e .@f .@g arrays"; debugmes "================================================"; F_Randomizer(.@main,.@a,.@b,.@c,.@e,.@f,.@g); for(.@i=0;.@i<getarraysize(.@a);.@i++){ debugmes ".@a " + .@a[.@i]; } for(.@i=0;.@i<getarraysize(.@b);.@i++){ debugmes ".@b " + .@b[.@i]; } for(.@i=0;.@i<getarraysize(.@c);.@i++){ debugmes ".@c " + .@c[.@i]; } for(.@i=0;.@i<getarraysize(.@e);.@i++){ debugmes ".@e " + .@e[.@i]; } for(.@i=0;.@i<getarraysize(.@f);.@i++){ debugmes ".@f " + .@f[.@i]; } for(.@i=0;.@i<getarraysize(.@g);.@i++){ debugmes ".@g " + .@g[.@i]; } debugmes "=================================================================================="; end; } the best place to put the function in is at the end of rathena/npc/other/Global_Functions.txt file Submitter sader1992 Submitted 08/20/2020 Category Utilities Video Content Author sader1992 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.