R> Can someone convert this script

Mad Child

New member
Messages
2
Points
0
As title says, can someone convert this script to be compatible with Hercules. Thanks in advance.

It's an old eA script I dug up. It's GM Oceans script IIRC.

Code:
-	script	CDR	-1,{ //whisper  npc:CDR   anything to activate the GM Menu,OnWhisperGlobal:if(getgmlevel() < 80){end;}menu "Add Monster to System",iAddMob,"Change Drop Rate",iChangeDrop,"Cancel",iCancel;iAddMob:if(getarraysize(.MobOkay_ID)>=128){next; mes "You cannot add any more mobs to this system."; close;}next;mes "Please input the Monster ID you wish to add to this system";input .@id;next;mes "Are you sure you want to add: "+strmobinfo(1,.@id)+" to the system?";menu "Yes",-,"Input new ID",iAddMob,"Cancel",iCancel;set .MobOkay_ID[getarraysize(.MobOkay_ID)+1],.@id;next;mes "The Monster: "+strmobinfo(1,.@id)+" has been added to the system.";close;iChangeDrop:next;mes "Current Drop Rate: "+100/.MaxDropChance+"%";mes "Please input the new drop rate.";mes "*Note - Drop rate is determined by: 100/DropRate %*";mes "1 = 100%, 10 = 10%, 100 = 1%, 1000 = 0.1%, 10000 = 0.01%";input .@newdropchance;if(.@newdropchance <= 0){next; mes "Invalid Number"; close;}set .MaxDropChance,.@newdropchance;next;mes "Drop Rate has been changed.";mes "Current Drop Rate: "+100/.MaxDropChance+"%";close;OnInterIfInitOnce:setarray .MobOkay_ID[0],1002,1004,1005,1007,1008,1009,1010; //Replace XXXX with the ID's of the monsters you want to be affected by this script. Add more as necessariy. *Note only supports 128 different monsters*set .MaxDropChance,10; // 1 = 100% | 10 = 10% | 100 = 1% | 1000 = 0.1% | 10000 = 0.01%  Basically, 100/.MaxDropChance = %end;OnNPCKillEvent:for(set @i,0; @i<getarraysize(.MobOkay_ID); set @i,@i+1){if (killedrid==.MobOkay_ID[@i]){goto iDropItemRate;}}end;iCancel:close;iDropItemRate:set @i,0;set @dropID,0;deletearray $@MobDrop_item[0],128;deletearray $@MobDrop_rate[0],128;set $@MobDrop_count,0;getmobdrops(killedrid);set .@MobDrop_count, $@MobDrop_count;copyarray .@MobDrop_item[0],$@MobDrop_item[0],.@MobDrop_count;copyarray .@MobDrop_rate[0],$@MobDrop_rate[0],.@MobDrop_count;goto iDropItemLoop;iDropItemLoop:set @i,rand(1,.MaxDropChance);if (@dropID == .@MobDrop_count){dispbottom "Success"; end;}if (@i==1 && .@MobDrop_rate[@dropID]<=1){getitem .@MobDrop_item[@dropID],1; if(@dropID==8){announce "[ "+strcharinfo(0)+" ]: got [ "+getitemname(.@MobDrop_item[@dropID])+" ] ( Chance: "+ (.MaxDropChance?"100%":"10%":"1%":"0.1%"|"0.01%") +" )",bc_all;} set @dropID,@dropID+1; goto iDropItemLoop;}if (@i<=.@MaxDropChance){set @dropID,@dropID+1; goto iDropItemLoop;}end;} 
 
Last edited by a moderator:
- script CDR -1,{ //whisper npc:CDR anything to activate the GM Menu,OnWhisperGlobal:if(getgmlevel() < 80){end;}menu "Add Monster to System",iAddMob,"Change Drop Rate",iChangeDrop,"Cancel",iCancel;iAddMob:if(getarraysize(.MobOkay_ID)>=128){next; mes "You cannot add any more mobs to this system."; close;}next;mes "Please input the Monster ID you wish to add to this system";input .@id;next;mes "Are you sure you want to add: "+strmobinfo(1,.@id)+" to the system?";menu "Yes",-,"Input new ID",iAddMob,"Cancel",iCancel;set .MobOkay_ID[getarraysize(.MobOkay_ID)+1],.@id;next;mes "The Monster: "+strmobinfo(1,.@id)+" has been added to the system.";close;iChangeDrop:next;mes "Current Drop Rate: "+100/.MaxDropChance+"%";mes "Please input the new drop rate.";mes "*Note - Drop rate is determined by: 100/DropRate %*";mes "1 = 100%, 10 = 10%, 100 = 1%, 1000 = 0.1%, 10000 = 0.01%";input .@newdropchance;if(.@newdropchance <= 0){next; mes "Invalid Number"; close;}set .MaxDropChance,.@newdropchance;next;mes "Drop Rate has been changed.";mes "Current Drop Rate: "+100/.MaxDropChance+"%";close;OnInterIfInitOnce:setarray .MobOkay_ID[0],1002,1004,1005,1007,1008,1009,1010; //Replace XXXX with the ID's of the monsters you want to be affected by this script. Add more as necessariy. *Note only supports 128 different monsters*set .MaxDropChance,10; // 1 = 100% | 10 = 10% | 100 = 1% | 1000 = 0.1% | 10000 = 0.01% Basically, 100/.MaxDropChance = %end;OnNPCKillEvent:for(set @i,0; @i<getarraysize(.MobOkay_ID); set @i,@i+1){if (killedrid==.MobOkay_ID[@i]){goto iDropItemRate;}}end;iCancel:close;iDropItemRate:set @i,0;set @dropID,0;deletearray $@MobDrop_item[0],128;deletearray $@MobDrop_rate[0],128;set $@MobDrop_count,0;getmobdrops(killedrid);set .@MobDrop_count, $@MobDrop_count;copyarray .@MobDrop_item[0],$@MobDrop_item[0],.@MobDrop_count;copyarray .@MobDrop_rate[0],$@MobDrop_rate[0],.@MobDrop_count;goto iDropItemLoop;iDropItemLoop:set @i,rand(1,.MaxDropChance);if (@dropID == .@MobDrop_count){dispbottom "Success"; end;}if (@i==1 && .@MobDrop_rate[@dropID]<=1){ getitem .@MobDrop_item[@dropID],1; if(@dropID==8) { announce "[ "+strcharinfo(0)+" ]: got [ "+getitemname(.@MobDrop_item[@dropID])+" ] ( Chance: " + (100 / .MaxDropChance) + "% )",bc_all; } set @dropID,@dropID+1; goto iDropItemLoop;} if (@i<=.@MaxDropChance) { set @dropID,@dropID+1; goto iDropItemLoop; }end;}
Here you are

 
@@Alayne

goto is depreciated, so thus the menu..

@@Mad Child

Here's the Script

Code:
-	script	CDR	-1,{ //whisper  npc:CDR   anything to activate the GM Menu,OnWhisperGlobal:if(getgmlevel() < 80){end;}switch(select("Add Monster to System","Change Drop Rate","Cancel")){	case 3:		close;	case 1:		while(1){			next;			mes "Please input the Monster ID you wish to add to this system";			input .@id;			next;			mes "Are you sure you want to add: "+strmobinfo(1,.@id)+" to the system?";			.@j = select("Yes","Input New ID","Cancel");			if (.@j==3)				close;			else if (.@j==2)				continue;			menu "Yes",-,"Input new ID",iAddMob,"Cancel",iCancel;			set .MobOkay_ID[getarraysize(.MobOkay_ID)+1],.@id;			next;			mes "The Monster: "+strmobinfo(1,.@id)+" has been added to the system.";			close;		}		end;	case 2:		next;		mes "Current Drop Rate: "+100/.MaxDropChance+"%";		mes "Please input the new drop rate.";		mes "*Note - Drop rate is determined by: 100/DropRate %*";		mes "1 = 100%, 10 = 10%, 100 = 1%, 1000 = 0.1%, 10000 = 0.01%";		input .@newdropchance;		if(.@newdropchance <= 0){			next;			mes "Invalid Number";			close;		}		set .MaxDropChance,.@newdropchance;		next;		mes "Drop Rate has been changed.";		mes "Current Drop Rate: "+100/.MaxDropChance+"%";		close;}OnInit:setarray .MobOkay_ID[0],1002,1004,1005,1007,1008,1009,1010; //Replace XXXX with the ID's of the monsters you want to be affected by this script. Add more as necessariy. *Note only supports 128 different monsters*set .MaxDropChance,10; // 1 = 100% | 10 = 10% | 100 = 1% | 1000 = 0.1% | 10000 = 0.01%  Basically, 100/.MaxDropChance = %end;OnNPCKillEvent:	.@j = 0;	for(.@i=0; .@i<getarraysize(.MobOkay_ID); .@i++){		if (killedrid==.MobOkay_ID[.@i]){			.@j=1;			break;		}	}	if (.@j==0)		end;	deletearray $@MobDrop_item[0],128;	deletearray $@MobDrop_rate[0],128;	set $@MobDrop_count,0;	getmobdrops(killedrid);	set .@MobDrop_count, $@MobDrop_count;	copyarray .@MobDrop_item[0],$@MobDrop_item[0],.@MobDrop_count;	copyarray .@MobDrop_rate[0],$@MobDrop_rate[0],.@MobDrop_count;	freeloop(1);	while(1){		set .@i,rand(1,.MaxDropChance);		if (.@dropID == .@MobDrop_count){			dispbottom "Success";			break;		}		if (.@i==1 && .@MobDrop_rate[.@dropID]<=1){			getitem .@MobDrop_item[.@dropID],1;			if(.@dropID==8)			{				announce "[ "+strcharinfo(0)+" ]: got [ "+getitemname(.@MobDrop_item[.@dropID])+" ] ( Chance: " + (100 / .MaxDropChance) + "% )",bc_all;			} 			.@dropID++;			continue;		}		if (.@i<=.@MaxDropChance){			.@dropID++;			continue;		}		break;	}	freeloop(0);	end;}
 
I'll test it when I get a chance. Thanks! I ran it in Haru's script checker and no error came back, and add to that, @@Dastgir you are well-known around the community for being a good dev, so I'm confident it'll work. 

@@Alayne

Thanks for the effort as well! I appreciate the quick response. 

Just tested...

Doesn't work T_T

When I select either one of these options "Add Monster to System","Change Drop Rate"

It just freezes my char and has a blank message instead of the message inside of the case.

 
Last edited by a moderator:
Back
Top