Jump to content
sader1992

Utility: F_Randomizer randomize and split array into arrays

Recommended Posts

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 [email protected] 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 [email protected],1,2,3,4,5,6,7,8,9,10,11,12;
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "" + [email protected][[email protected]];
	}
	debugmes "================================================";
	debugmes "Split and randomize the elements of [email protected] into [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] arrays";
	debugmes "================================================";
	
	F_Randomizer([email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]);
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	
	for([email protected]=0;[email protected]<getarraysize([email protected]);[email protected]++){
		debugmes "[email protected] " + [email protected][[email protected]];
	}
	debugmes "==================================================================================";
end;
}

 

the best place to put the function in is at the end of rathena/npc/other/Global_Functions.txt file


  • Submitter
  • Submitted
    08/20/2020
  • Category
  • Video
  • Content Author
    sader1992

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.