Jump to content

F_Randomizer randomize and split array into arrays 1.0.0

Sign in to follow this  

2 Screenshots

About This File

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




×
×
  • Create New...

Important Information

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