Jump to content

qtdan

Members
  • Posts

    223
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by qtdan

  1. //===== rAthena Script =======================================
    //= saders All in one Random Option Script
    //= Free Script!!!!
    //===== By: ==================================================
    //= sader1992
    //= https://sader1992.com/
    //= https://rathena.org/board/profile/30766-sader1992/
    //= https://sader1992.com/?page=item&item=54
    //= For more , check out here >
    //= https://sader1992.com/?page=ra_services
    //= https://sader1992.com/?page=store
    //= https://rathena.org/board/profile/30766-sader1992/content/?type=downloads_file
    //===== Current Version: =====================================
    //= 1.0
    //===== Compatible With: ===================================== 
    //= rAthena Project
    //https://rathena.org/board/files/file/4309-all-in-one-random-options-script/
    //https://github.com/sader1992/sader_scripts
    //===== Update Log: =========================================
    //= Version 1.0 Creating the script.
    //===== Description: =========================================
    //= This is a Highly Custumizable random option script
    //= you can reuse the script by just creating a new file with different setting!.
    //= read and understand the settings.
    //============================================================
    prt_in,30,108,5	script	Random Option	10434,{
    	disable_items; function rnd;
    	switch(select("Insert Random Options:Allowed Items List")){
    		case 1:
    			mes "You must equip the item to appear here!";
    			for(.@i=0;.@i<EQI_MAX;.@i++){
    				if(getequipisequiped(.@i)) {
    					.@m1$ += (inarray(.item_list,getequipid(.@i)) != -1?"^11AD09":"^F73831") + F_getpositionname(.@i) + "-[" + getequipname(.@i) + "]^000000";
    					.@exist = true;
    				}
    				.@m1$ += ":";
    			}
    			if(!.@exist){
    				mes "You have to equip the item you want to insert the random options into!.";
    				end;
    			}
    			.@eq = select(.@m1$) -1;
    			clear;
    			.@id = getequipid(.@eq);
    			if(inarray(.item_list,.@id) == -1){
    				mes "Sorry , I cannot deal with this item!";
    				end;
    			}
    			.@gid = .it[.@id];
    			if(!.@gid){
    				mes "Something went wrong!";
    				end;
    			}
    			if(!getequiprandomoption(.@eq,0,ROA_ID)){
    				.@zeny = .nz[.@gid];
    				.@cashpoint = .nk[.@gid];
    				.@costumpoint = .nc[.@gid];
    				copyarray(.@item,getd(".ni_" + .@gid),getarraysize(getd(".ni_" + .@gid)));
    				copyarray(.@amount,getd(".na_" + .@gid),getarraysize(getd(".na_" + .@gid)));
    			}else{
    				if(!.g_reroll[.@gid]){
    					mes "Sorry , i cannot reroll the random options in this item!";
    					end;
    				}
    				.@zeny = .rz[.@gid];
    				.@cashpoint = .rk[.@gid];
    				.@costumpoint = .rc[.@gid];
    				copyarray(.@item,getd(".ri_" + .@gid),getarraysize(getd(".ri_" + .@gid)));
    				copyarray(.@amount,getd(".ra_" + .@gid),getarraysize(getd(".ra_" + .@gid)));
    			}
    			mes "Selected Item [" + getequipname(.@eq) + "]";
    			mes "==== Cost ====";
    			if(.@zeny) mes "Zeny: " + .@zeny;
    			if(.@cashpoint) mes "CashPoint: " + .@cashpoint;
    			if(.@costumpoint) mes .CustomPointsName$ + ": " + .@costumpoint;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				mes "(" + .@amount[.@i] + "pcs.) " + getitemname(.@item[.@i]) + " (" + .@item[.@i] + ")";
    			}
    			if(!.KeepItemData){
    				mes "^E01E00You will loss all the refine and cards in the item if you continue.^000000";
    			}
    			mes "Would you like to continue?";
    			if(select("Yes:No") == 2){
    				clear;
    				mes "Ok, see you next time!";
    				end;
    			}
    			clear;
    			if(Zeny < .@zeny){
    				mes "You don't have " + .@zeny + " Zeny";
    				.@close = true;
    			}
    			if(#CASHPOINTS < .@cashpoint){
    				mes "You don't have " + .@cashpoint + " CashPoints";
    				.@close = true;
    			}
    			if(getd(.CustomPointsVariable$) < .@costumpoint){
    				mes "You don't have " + .@costumpoint + " " + .CustomPointsName$;
    				.@close = true;
    			}
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					mes "You don't have (" + .@amount[.@i] + ") " + getitemname(.@item[.@i]);
    					.@close = true;
    				}
    			}
    			if(.@close) end;
    			.@r = getequiprefinerycnt(.@eq);
    			for(.@i=0;.@i<4;.@i++){
    				if(getequipcardid(.@eq,.@i)){
    					setd ".@c" + .@i,getequipcardid(.@eq,.@i);
    					.@re[getarraysize(.@re)] = true;
    				}
    			}
    			copyarray(.@opt_id,getd(".ro_id_" + .@gid + "_0"),getarraysize(getd(".ro_id_" + .@gid + "_0")));
    			copyarray(.@opt_mn,getd(".ro_mn_" + .@gid + "_0"),getarraysize(getd(".ro_mn_" + .@gid + "_0")));
    			copyarray(.@opt_mx,getd(".ro_mx_" + .@gid + "_0"),getarraysize(getd(".ro_mx_" + .@gid + "_0")));
    			for(.@i=1;.@i<6;.@i++){
    				copyarray(getd(".@opt_id" + .@i),getd(".ro_id_" + .@gid + "_" + .@i),getarraysize(getd(".ro_id_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mn" + .@i),getd(".ro_mn_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mn_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mx" + .@i),getd(".ro_mx_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mx_" + .@gid + "_" + .@i)));
    			}
    			for(.@i=1;.@i<6;.@i++){
    				if(rand(100) > getd(".s_" + .@i + "[" + .@gid + "]"))
    					break;
    				if(getd(".ro_id_" + .@gid + "_" + .@i)){
    					if(!getarraysize(getd(".@opt_id" + .@i))) break;
    					.@ndx = rand(getarraysize(getd(".@opt_id" + .@i)));
    					.@result_id = getd(".@opt_id" + .@i + "[" + .@ndx + "]");
    					.@result_vl = rnd(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),getd(".@opt_mx" + .@i + "[" + .@ndx + "]"));
    					deletearray(getd(".@opt_id" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mx" + .@i + "[" + .@ndx + "]"),1);
    				}else{
    					if(!.@opt_id) break;
    					.@ndx = rand(getarraysize(.@opt_id));
    					.@result_id = .@opt_id[.@ndx];
    					.@result_vl = rnd(.@opt_mn[.@ndx],.@opt_mx[.@ndx]);
    					if(!.g_reuse[.@gid]){
    						deletearray(.@opt_id[.@ndx],1);
    						deletearray(.@opt_mn[.@ndx],1);
    						deletearray(.@opt_mx[.@ndx],1);
    					}
    				}
    				if(.ex[.@result_id]){
    					for(.@i2=0;.@i2<getarraysize(.@r_id);.@i2++){
    						if(.ex[.@result_id] == .ex[.@r_id[.@i2]]){
    							.@reject = true;
    						}
    					}
    				}
    				if(!.@reject){
    					.@s1 = getarraysize(.@r_id);
    					.@r_id[.@s1] = .@result_id;
    					.@r_v[.@s1] = .@result_vl;
    				}else{
    					.@i--;
    					.@failsafe++;
    					if(.@failsafe > 50){
    						mes "Something went wrong , The server admin need to make sure that the config is done correctly!";
    						end;
    					}
    				}
    			}
    			if(Zeny < .@zeny) end;
    			if(#CASHPOINTS < .@cashpoint) end;
    			if(getd(.CustomPointsVariable$) < .@costumpoint) end;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					end;
    				}
    			}
    			// anti-hack
    			if (callfunc("F_IsEquipIDHack", .@eq, .@id) || callfunc("F_IsEquipCardHack", .@eq, .@c0, .@c1, .@c2, .@c3)) {
    				// anti-hack
    				emotion ET_FRET;
    				mes "Item Switch detected!";
    				end;
    			}
    			Zeny -= .@zeny;
    			#CASHPOINTS-= .@cashpoint;
    			setd(.CustomPointsVariable$,getd(.CustomPointsVariable$) - .@costumpoint);
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				delitem(.@item[.@i],.@amount[.@i]);
    			}
    			if(!.@r_id){
    				specialeffect2 EF_REFINEOK;
    				mes "Look Like you didn't get any random option, your luck is really bad!";
    				end;
    			}
    			delequip(.@eq);
    			specialeffect2 EF_REFINEOK;
    			if(.KeepItemData)
    				getitem3(.@id,1,1,.@r,0,.@c0,.@c1,.@c2,.@c3,.@r_id,.@r_v,.@null);
    			else
    				getitem3(.@id,1,1,0,0,0,0,0,0,.@r_id,.@r_v,.@null);
    			equip(.@id);
    			mes "Done!";
    		end;
    		
    		case 2:
    			mes "The list of the allowed items in this npc!";
    			for(.@i=0;.@i<getarraysize(.item_list);.@i++){
    				mes "<ITEM>" + getitemname(.item_list[.@i]) + "[" + getitemslots(.item_list[.@i]) + "]<INFO>" + .item_list[.@i] + "</INFO></ITEM>";
    				if(.@i >= 10 && !(.@i%10)) next;
    			}
    		end;
    	}
    end;
    
    	function	rnd	{
    		if(.HardBalance){
    			return rand(getarg(0),rand(getarg(0)+1,getarg(1)));
    		}
    		return rand(getarg(0),getarg(1));
    	}
    
    	function	AddGroup	{
    		.@id = getarg(0);
    		for(.@i=1;.@i<getargcount();.@i++){
    			.it[getarg(.@i)] = .@id;
    			.item_list[getarraysize(.item_list)] = getarg(.@i);
    			
    		}
    		return;
    	}
    	
    	function	AddGroupOption	{
    		.@id = getarg(0);
    		.g_reroll[.@id] = getarg(1);
    		.g_reuse[.@id] = getarg(2);
    		return;
    	}
    	
    	function	AddGroupCost	{
    		.@id = getarg(0);
    		.nz[.@id] = getarg(1);
    		.nk[.@id] = getarg(2);
    		.nc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ni_" + .@id));
    			setd(".ni_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".na_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupReRollCost	{
    		.@id = getarg(0);
    		.rz[.@id] = getarg(1);
    		.rk[.@id] = getarg(2);
    		.rc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ri_" + .@id));
    			setd(".ri_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".ra_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupChance	{
    		.@id = getarg(0);
    		.s_1[.@id] = getarg(1);
    		.s_2[.@id] = getarg(2);
    		.s_3[.@id] = getarg(3);
    		.s_4[.@id] = getarg(4);
    		.s_5[.@id] = getarg(5);
    		return;
    	}
    	
    	function	AddOpt	{
    		.@id = getarg(0);
    		.@loc = getarg(1);
    		.@s = getarraysize(getd(".ro_id_" + .@id + "_" + .@loc));
    		setd(".ro_id_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(2));
    		setd(".ro_mn_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(3));
    		setd(".ro_mx_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(4));
    		return;
    	}
    	
    	function	AddExclusiveOpt	{
    		.@s1 = getarraysize(.exv);
    		.exv[.@s1] = true;
    		for(.@i=0;.@i<getargcount();.@i++){
    			.ex[getarg(.@i)] = .@s1;
    		}
    		return;
    	}
    
    OnInit:
    	.exv = true;//DO NOT REMOVE THIS.
    	.KeepItemData = true;//if this is 'false , the player will loss the refine+cards from the item when he use this npc.
    	.CustomPointsVariable$ = "#COSTUMPOINTS";//The variable name of the costum points.
    	.CustomPointsName$ = "Server RO Points";//The name of the costum points, this what the player will see.
    	.HardBalance = true;//if this is true , it would be much harder to get high value in the random option.
    	
    	
    	//AddGroup(<Group ID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>);
    	/*
    	AddGroup Doc
    		<Group ID> = a number between 1 and MAX_INT64
    		DO NOT REUSE THE GROUP ID IN THE SAME FILE CONFIG!
    		DO NOT REUSE THE SAME ITEM ID IN DIFFERENT GROUP!
    		will create a group id 
    		you can add as many as you want items inside a group.
    	*/
    	
    	//AddGroupOption(<Group ID>,<Allow ReRoll?true:false>,<Allow reuse already gotten option?true:false>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupOption Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Allow ReRoll?true:false> = allow reroll an item with random option or not
    		<Allow reuse already gotten option?true:false> = for exammple if you have str in the options and the player gor it , can he get it again in another slot?
    		
    	*/
    	
    	//AddGroupCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupReRollCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupReRollCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupChance(<Group ID>,<1st Option Chance>,<2nd Option Chance>,<3rd Option Chance>,<4th Option Chance>,<5th Option Chance>);
    	/*
    	AddGroupChance Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<1st Option Chance> = the Chance to get one of the random options in the slot 1 (can be 0)
    		<2nd Option Chance> = the Chance to get one of the random options in the slot 2 (can be 0)
    		<3rd Option Chance> = the Chance to get one of the random options in the slot 3 (can be 0)
    		<4th Option Chance> = the Chance to get one of the random options in the slot 4 (can be 0)
    		<5th Option Chance> = the Chance to get one of the random options in the slot 5 (can be 0)
    		
    		Keep inmind that if the player didn't get lucky for example at the slot 2 , all the chances after will be ignored
    		you cannot skip a random option slot that would bug the game client.
    	*/
    	
    	//AddOpt(<Group ID>,<Location>,<Random Option ID>,<Minimum Value>,<Maximum Value>);
    	/*
    	AddOpt Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Location> = you can spisfiy random option to a location from 1 to 5 , but you can use 0 , if you used 0 it will apply to all locations that doesn't have spisfied random options.
    		<Random Option ID> = random option id , you can use the id or the variable , check out the file /rathena/db/re/item_randomopt_db.yml
    		<Minimum Value> = the minimum value
    		<Maximum Value> = the maximum value
    	*/
    	
    	//AddExclusiveOpt(<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>);
    	/*
    	AddExclusiveOpt Doc
    		this will help you to prevent a group of random opions typs in the same item in different slots
    		for example
    			RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET
    		if the player got 1 of them in a slot , he wont get another one to another slot
    	*/
    
    //Example!!!>
    //this is just an example , this script allow you to create any random option system you want.
    
    
    // BAAL HELM ======================================================================
    
    	//Creating Group id 1 , with Hat items inside.
    	AddGroup(1,50001);
    	//Group id 1 Options
    	AddGroupOption(1,true,false);
    	//Group id 1 Cost
    	AddGroupCost(1,0,0,0,70501,1,677,50);
    	//Group id 1 ReRoll Cost
    	AddGroupReRollCost(1,0,0,0,70501,1,677,50);
    	//Group id 1 Chances.
    	AddGroupChance(1,100,100,100,0,0);
    
    	//Group id 1 Random Option List. location 0 mean all the slot locations
    	AddOpt(1,1,RDMOPT_VAR_STRAMOUNT,1,5);
    	AddOpt(1,1,RDMOPT_VAR_INTAMOUNT,1,5);
    	AddOpt(1,1,RDMOPT_VAR_VITAMOUNT,1,5);
    	AddOpt(1,1,RDMOPT_VAR_LUKAMOUNT,1,5);
    	AddOpt(1,1,RDMOPT_VAR_AGIAMOUNT,1,5);
    	AddOpt(1,1,RDMOPT_VAR_DEXAMOUNT,1,5);
    
    	AddOpt(1,2,RDMOPT_VAR_MAXHPPERCENT,1,5);
    	AddOpt(1,2,RDMOPT_VAR_MAXSPPERCENT,1,5);
    	AddOpt(1,2,RDMOPT_VAR_ATKPERCENT,1,5);
    	AddOpt(1,2,RDMOPT_VAR_MAGICATKPERCENT,1,5);
    	AddOpt(1,2,RDMOPT_VAR_MDEFPOWER,1,5);
    	AddOpt(1,2,RDMOPT_VAR_ITEMDEFPOWER,1,5);
    	AddOpt(1,2,RDMOPT_VAR_HITSUCCESSVALUE,1,5);
    	AddOpt(1,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,1,5);
    
    	AddOpt(1,3,RDMOPT_VAR_SPIRALPIERCE,8,12);
    	AddOpt(1,3,RDMOPT_VAR_BOWLINGBASH,8,12);
    	AddOpt(1,3,RDMOPT_VAR_SACRIFICE,8,12);
    	AddOpt(1,3,RDMOPT_VAR_SHIELDCHAIN,8,12);
    	AddOpt(1,3,RDMOPT_VAR_FIREBOLT,8,12);
    	AddOpt(1,3,RDMOPT_VAR_COLDBOLT,8,12);
    	AddOpt(1,3,RDMOPT_VAR_LIGHTNINGBOLT,8,12);
    	AddOpt(1,3,RDMOPT_VAR_STORMGUST,8,12);
    	AddOpt(1,3,RDMOPT_VAR_METEOR,8,12);
    	AddOpt(1,3,RDMOPT_VAR_DOUBLE,8,12);
    	AddOpt(1,3,RDMOPT_VAR_SHARPSHOOTING,8,12);
    	AddOpt(1,3,RDMOPT_VAR_ARROWVULCAN,8,12);
    	AddOpt(1,3,RDMOPT_VAR_ACIDDEMONSTRATION,8,12);
    	AddOpt(1,3,RDMOPT_VAR_DEMONSTRATION,8,12);
    	AddOpt(1,3,RDMOPT_VAR_CARTTERMINATION,8,12);
    	AddOpt(1,3,RDMOPT_VAR_SONICBLOW,8,12);
    	AddOpt(1,3,RDMOPT_VAR_BREAKER,8,12);
    	AddOpt(1,3,RDMOPT_VAR_TURNUNDEAD,8,12);
    	AddOpt(1,3,RDMOPT_VAR_HOLYLIGHT,8,12);
    	AddOpt(1,3,RDMOPT_VAR_EXTREMITYFIST,8,12);
    	AddOpt(1,3,RDMOPT_VAR_FINGEROFFENSIVE,8,12);
    	AddOpt(1,3,RDMOPT_VAR_JUMPKICK,8,12);
    	AddOpt(1,3,RDMOPT_VAR_SMA,8,12);
    	AddOpt(1,3,RDMOPT_VAR_ISSEN,8,12);
    	AddOpt(1,3,RDMOPT_VAR_HYOUSENSOU,8,12);
    	AddOpt(1,3,RDMOPT_VAR_DESPERADO,8,12);
    	AddOpt(1,3,RDMOPT_VAR_RAPIDSHOWER,8,12);
    
    // SKULL BEANIE HELM ======================================================================
    
    	//Creating Group id 2 , with Hat items inside.
    	AddGroup(2,50002);
    	//Group id 2 Options
    	AddGroupOption(2,true,false);
    	//Group id 2 Cost
    	AddGroupCost(2,0,0,0,70502,1,677,50);
    	//Group id 2 ReRoll Cost
    	AddGroupReRollCost(2,0,0,0,70502,1,677,50);
    	//Group id 2 Chances.
    	AddGroupChance(2,100,100,100,0,0);
    
    	//Group id 1 Random Option List. location 0 mean all the slot locations
    	AddOpt(2,1,RDMOPT_VAR_STRAMOUNT,1,5);
    	AddOpt(2,1,RDMOPT_VAR_INTAMOUNT,1,5);
    	AddOpt(2,1,RDMOPT_VAR_VITAMOUNT,1,5);
    	AddOpt(2,1,RDMOPT_VAR_LUKAMOUNT,1,5);
    	AddOpt(2,1,RDMOPT_VAR_AGIAMOUNT,1,5);
    	AddOpt(2,1,RDMOPT_VAR_DEXAMOUNT,1,5);
    
    	AddOpt(2,2,RDMOPT_VAR_MAXHPPERCENT,1,5);
    	AddOpt(2,2,RDMOPT_VAR_MAXSPPERCENT,1,5);
    	AddOpt(2,2,RDMOPT_VAR_ATKPERCENT,1,5);
    	AddOpt(2,2,RDMOPT_VAR_MAGICATKPERCENT,1,5);
    	AddOpt(2,2,RDMOPT_VAR_MDEFPOWER,1,5);
    	AddOpt(2,2,RDMOPT_VAR_ITEMDEFPOWER,1,5);
    	AddOpt(2,2,RDMOPT_VAR_HITSUCCESSVALUE,1,5);
    	AddOpt(2,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,1,5);
    
    	AddOpt(2,3,RDMOPT_VAR_SPIRALPIERCE,8,12);
    	AddOpt(2,3,RDMOPT_VAR_BOWLINGBASH,8,12);
    	AddOpt(2,3,RDMOPT_VAR_SACRIFICE,8,12);
    	AddOpt(2,3,RDMOPT_VAR_SHIELDCHAIN,8,12);
    	AddOpt(2,3,RDMOPT_VAR_FIREBOLT,8,12);
    	AddOpt(2,3,RDMOPT_VAR_COLDBOLT,8,12);
    	AddOpt(2,3,RDMOPT_VAR_LIGHTNINGBOLT,8,12);
    	AddOpt(2,3,RDMOPT_VAR_STORMGUST,8,12);
    	AddOpt(2,3,RDMOPT_VAR_METEOR,8,12);
    	AddOpt(2,3,RDMOPT_VAR_DOUBLE,8,12);
    	AddOpt(2,3,RDMOPT_VAR_SHARPSHOOTING,8,12);
    	AddOpt(2,3,RDMOPT_VAR_ARROWVULCAN,8,12);
    	AddOpt(2,3,RDMOPT_VAR_ACIDDEMONSTRATION,8,12);
    	AddOpt(2,3,RDMOPT_VAR_DEMONSTRATION,8,12);
    	AddOpt(2,3,RDMOPT_VAR_CARTTERMINATION,8,12);
    	AddOpt(2,3,RDMOPT_VAR_SONICBLOW,8,12);
    	AddOpt(2,3,RDMOPT_VAR_BREAKER,8,12);
    	AddOpt(2,3,RDMOPT_VAR_TURNUNDEAD,8,12);
    	AddOpt(2,3,RDMOPT_VAR_HOLYLIGHT,8,12);
    	AddOpt(2,3,RDMOPT_VAR_EXTREMITYFIST,8,12);
    	AddOpt(2,3,RDMOPT_VAR_FINGEROFFENSIVE,8,12);
    	AddOpt(2,3,RDMOPT_VAR_JUMPKICK,8,12);
    	AddOpt(2,3,RDMOPT_VAR_SMA,8,12);
    	AddOpt(2,3,RDMOPT_VAR_ISSEN,8,12);
    	AddOpt(2,3,RDMOPT_VAR_HYOUSENSOU,8,12);
    	AddOpt(2,3,RDMOPT_VAR_DESPERADO,8,12);
    	AddOpt(2,3,RDMOPT_VAR_RAPIDSHOWER,8,12);
    
    // DROOPING MAYA HAT ======================================================================
    
    	//Creating Group id 3 , with Hat items inside.
    	AddGroup(3,50004);
    	//Group id 3 Options
    	AddGroupOption(3,true,false);
    	//Group id 3 Cost
    	AddGroupCost(3,0,0,0,70503,1,677,50);
    	//Group id 3 ReRoll Cost
    	AddGroupReRollCost(3,0,0,0,70503,1,677,50);
    	//Group id 3 Chances.
    	AddGroupChance(3,100,100,100,0,0);
    
    	//Group id 3 Random Option List. location 0 mean all the slot locations
    	AddOpt(3,1,RDMOPT_VAR_STRAMOUNT,1,5);
    	AddOpt(3,1,RDMOPT_VAR_INTAMOUNT,1,5);
    	AddOpt(3,1,RDMOPT_VAR_VITAMOUNT,1,5);
    	AddOpt(3,1,RDMOPT_VAR_LUKAMOUNT,1,5);
    	AddOpt(3,1,RDMOPT_VAR_AGIAMOUNT,1,5);
    	AddOpt(3,1,RDMOPT_VAR_DEXAMOUNT,1,5);
    
    	AddOpt(3,2,RDMOPT_VAR_MAXHPPERCENT,1,5);
    	AddOpt(3,2,RDMOPT_VAR_MAXSPPERCENT,1,5);
    	AddOpt(3,2,RDMOPT_VAR_ATKPERCENT,1,5);
    	AddOpt(3,2,RDMOPT_VAR_MAGICATKPERCENT,1,5);
    	AddOpt(3,2,RDMOPT_VAR_MDEFPOWER,1,5);
    	AddOpt(3,2,RDMOPT_VAR_ITEMDEFPOWER,1,5);
    	AddOpt(3,2,RDMOPT_VAR_HITSUCCESSVALUE,1,5);
    	AddOpt(3,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,1,5);
    
    	AddOpt(3,3,RDMOPT_VAR_SPIRALPIERCE,8,12);
    	AddOpt(3,3,RDMOPT_VAR_BOWLINGBASH,8,12);
    	AddOpt(3,3,RDMOPT_VAR_SACRIFICE,8,12);
    	AddOpt(3,3,RDMOPT_VAR_SHIELDCHAIN,8,12);
    	AddOpt(3,3,RDMOPT_VAR_FIREBOLT,8,12);
    	AddOpt(3,3,RDMOPT_VAR_COLDBOLT,8,12);
    	AddOpt(3,3,RDMOPT_VAR_LIGHTNINGBOLT,8,12);
    	AddOpt(3,3,RDMOPT_VAR_STORMGUST,8,12);
    	AddOpt(3,3,RDMOPT_VAR_METEOR,8,12);
    	AddOpt(3,3,RDMOPT_VAR_DOUBLE,8,12);
    	AddOpt(3,3,RDMOPT_VAR_SHARPSHOOTING,8,12);
    	AddOpt(3,3,RDMOPT_VAR_ARROWVULCAN,8,12);
    	AddOpt(3,3,RDMOPT_VAR_ACIDDEMONSTRATION,8,12);
    	AddOpt(3,3,RDMOPT_VAR_DEMONSTRATION,8,12);
    	AddOpt(3,3,RDMOPT_VAR_CARTTERMINATION,8,12);
    	AddOpt(3,3,RDMOPT_VAR_SONICBLOW,8,12);
    	AddOpt(3,3,RDMOPT_VAR_BREAKER,8,12);
    	AddOpt(3,3,RDMOPT_VAR_TURNUNDEAD,8,12);
    	AddOpt(3,3,RDMOPT_VAR_HOLYLIGHT,8,12);
    	AddOpt(3,3,RDMOPT_VAR_EXTREMITYFIST,8,12);
    	AddOpt(3,3,RDMOPT_VAR_FINGEROFFENSIVE,8,12);
    	AddOpt(3,3,RDMOPT_VAR_JUMPKICK,8,12);
    	AddOpt(3,3,RDMOPT_VAR_SMA,8,12);
    	AddOpt(3,3,RDMOPT_VAR_ISSEN,8,12);
    	AddOpt(3,3,RDMOPT_VAR_HYOUSENSOU,8,12);
    	AddOpt(3,3,RDMOPT_VAR_DESPERADO,8,12);
    	AddOpt(3,3,RDMOPT_VAR_RAPIDSHOWER,8,12);
    
    // DROOPING GARM HAT ======================================================================
    
    	//Creating Group id 4 , with Hat items inside.
    	AddGroup(4,50005);
    	//Group id 4 Options
    	AddGroupOption(4,true,false);
    	//Group id 4 Cost
    	AddGroupCost(4,0,0,0,70504,1,677,50);
    	//Group id 4 ReRoll Cost
    	AddGroupReRollCost(4,0,0,0,70504,1,677,50);
    	//Group id 4 Chances.
    	AddGroupChance(4,100,100,100,0,0);
    
    	//Group id 4 Random Option List. location 0 mean all the slot locations
    	AddOpt(4,1,RDMOPT_VAR_STRAMOUNT,1,5);
    	AddOpt(4,1,RDMOPT_VAR_INTAMOUNT,1,5);
    	AddOpt(4,1,RDMOPT_VAR_VITAMOUNT,1,5);
    	AddOpt(4,1,RDMOPT_VAR_LUKAMOUNT,1,5);
    	AddOpt(4,1,RDMOPT_VAR_AGIAMOUNT,1,5);
    	AddOpt(4,1,RDMOPT_VAR_DEXAMOUNT,1,5);
    
    	AddOpt(4,2,RDMOPT_VAR_MAXHPPERCENT,1,5);
    	AddOpt(4,2,RDMOPT_VAR_MAXSPPERCENT,1,5);
    	AddOpt(4,2,RDMOPT_VAR_ATKPERCENT,1,5);
    	AddOpt(4,2,RDMOPT_VAR_MAGICATKPERCENT,1,5);
    	AddOpt(4,2,RDMOPT_VAR_MDEFPOWER,1,5);
    	AddOpt(4,2,RDMOPT_VAR_ITEMDEFPOWER,1,5);
    	AddOpt(4,2,RDMOPT_VAR_HITSUCCESSVALUE,1,5);
    	AddOpt(4,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,1,5);
    
    	AddOpt(4,3,RDMOPT_VAR_SPIRALPIERCE,8,12);
    	AddOpt(4,3,RDMOPT_VAR_BOWLINGBASH,8,12);
    	AddOpt(4,3,RDMOPT_VAR_SACRIFICE,8,12);
    	AddOpt(4,3,RDMOPT_VAR_SHIELDCHAIN,8,12);
    	AddOpt(4,3,RDMOPT_VAR_FIREBOLT,8,12);
    	AddOpt(4,3,RDMOPT_VAR_COLDBOLT,8,12);
    	AddOpt(4,3,RDMOPT_VAR_LIGHTNINGBOLT,8,12);
    	AddOpt(4,3,RDMOPT_VAR_STORMGUST,8,12);
    	AddOpt(4,3,RDMOPT_VAR_METEOR,8,12);
    	AddOpt(4,3,RDMOPT_VAR_DOUBLE,8,12);
    	AddOpt(4,3,RDMOPT_VAR_SHARPSHOOTING,8,12);
    	AddOpt(4,3,RDMOPT_VAR_ARROWVULCAN,8,12);
    	AddOpt(4,3,RDMOPT_VAR_ACIDDEMONSTRATION,8,12);
    	AddOpt(4,3,RDMOPT_VAR_DEMONSTRATION,8,12);
    	AddOpt(4,3,RDMOPT_VAR_CARTTERMINATION,8,12);
    	AddOpt(4,3,RDMOPT_VAR_SONICBLOW,8,12);
    	AddOpt(4,3,RDMOPT_VAR_BREAKER,8,12);
    	AddOpt(4,3,RDMOPT_VAR_TURNUNDEAD,8,12);
    	AddOpt(4,3,RDMOPT_VAR_HOLYLIGHT,8,12);
    	AddOpt(4,3,RDMOPT_VAR_EXTREMITYFIST,8,12);
    	AddOpt(4,3,RDMOPT_VAR_FINGEROFFENSIVE,8,12);
    	AddOpt(4,3,RDMOPT_VAR_JUMPKICK,8,12);
    	AddOpt(4,3,RDMOPT_VAR_SMA,8,12);
    	AddOpt(4,3,RDMOPT_VAR_ISSEN,8,12);
    	AddOpt(4,3,RDMOPT_VAR_HYOUSENSOU,8,12);
    	AddOpt(4,3,RDMOPT_VAR_DESPERADO,8,12);
    	AddOpt(4,3,RDMOPT_VAR_RAPIDSHOWER,8,12);
    
    // Greate E. HAT ======================================================================
    
    	//Creating Group id 5 , with Hat items inside.
    	AddGroup(11,50047);
    	//Group id 11 Options
    	AddGroupOption(11,true,false);
    	//Group id 11 Cost
    	AddGroupCost(11,0,0,0,70511,1,677,50);
    	//Group id 11 ReRoll Cost
    	AddGroupReRollCost(11,0,0,0,70511,1,677,50);
    	//Group id 11 Chances.
    	AddGroupChance(11,100,100,100,0,0);
    
    	//Group id 4 Random Option List. location 0 mean all the slot locations
    	AddOpt(11,1,RDMOPT_VAR_STRAMOUNT,1,5);
    	AddOpt(11,1,RDMOPT_VAR_INTAMOUNT,1,5);
    	AddOpt(11,1,RDMOPT_VAR_VITAMOUNT,1,5);
    	AddOpt(11,1,RDMOPT_VAR_LUKAMOUNT,1,5);
    	AddOpt(11,1,RDMOPT_VAR_AGIAMOUNT,1,5);
    	AddOpt(11,1,RDMOPT_VAR_DEXAMOUNT,1,5);
    
    	AddOpt(11,2,RDMOPT_VAR_MAXHPPERCENT,1,5);
    	AddOpt(11,2,RDMOPT_VAR_MAXSPPERCENT,1,5);
    	AddOpt(11,2,RDMOPT_VAR_ATKPERCENT,1,5);
    	AddOpt(11,2,RDMOPT_VAR_MAGICATKPERCENT,1,5);
    	AddOpt(11,2,RDMOPT_VAR_MDEFPOWER,1,5);
    	AddOpt(11,2,RDMOPT_VAR_ITEMDEFPOWER,1,5);
    	AddOpt(11,2,RDMOPT_VAR_HITSUCCESSVALUE,1,5);
    	AddOpt(11,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,1,5);
    
    	AddOpt(11,3,RDMOPT_VAR_SPIRALPIERCE,8,12);
    	AddOpt(11,3,RDMOPT_VAR_BOWLINGBASH,8,12);
    	AddOpt(11,3,RDMOPT_VAR_SACRIFICE,8,12);
    	AddOpt(11,3,RDMOPT_VAR_SHIELDCHAIN,8,12);
    	AddOpt(11,3,RDMOPT_VAR_FIREBOLT,8,12);
    	AddOpt(11,3,RDMOPT_VAR_COLDBOLT,8,12);
    	AddOpt(11,3,RDMOPT_VAR_LIGHTNINGBOLT,8,12);
    	AddOpt(11,3,RDMOPT_VAR_STORMGUST,8,12);
    	AddOpt(11,3,RDMOPT_VAR_METEOR,8,12);
    	AddOpt(11,3,RDMOPT_VAR_DOUBLE,8,12);
    	AddOpt(11,3,RDMOPT_VAR_SHARPSHOOTING,8,12);
    	AddOpt(11,3,RDMOPT_VAR_ARROWVULCAN,8,12);
    	AddOpt(11,3,RDMOPT_VAR_ACIDDEMONSTRATION,8,12);
    	AddOpt(11,3,RDMOPT_VAR_DEMONSTRATION,8,12);
    	AddOpt(11,3,RDMOPT_VAR_CARTTERMINATION,8,12);
    	AddOpt(11,3,RDMOPT_VAR_SONICBLOW,8,12);
    	AddOpt(11,3,RDMOPT_VAR_BREAKER,8,12);
    	AddOpt(11,3,RDMOPT_VAR_TURNUNDEAD,8,12);
    	AddOpt(11,3,RDMOPT_VAR_HOLYLIGHT,8,12);
    	AddOpt(11,3,RDMOPT_VAR_EXTREMITYFIST,8,12);
    	AddOpt(11,3,RDMOPT_VAR_FINGEROFFENSIVE,8,12);
    	AddOpt(11,3,RDMOPT_VAR_JUMPKICK,8,12);
    	AddOpt(11,3,RDMOPT_VAR_SMA,8,12);
    	AddOpt(11,3,RDMOPT_VAR_ISSEN,8,12);
    	AddOpt(11,3,RDMOPT_VAR_HYOUSENSOU,8,12);
    	AddOpt(11,3,RDMOPT_VAR_DESPERADO,8,12);
    	AddOpt(11,3,RDMOPT_VAR_RAPIDSHOWER,8,12);
    
    
    
    
    
    
    
    	//this mean those random options cannot coexist in the same item!.
    	AddExclusiveOpt(RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET);
    end;
    
    }

    Hello @sader1992 is it possible to make in 1 group with different cost per item instead i'm making lots of groups? Thanksss

  2. //===== rAthena Script =======================================
    //= saders All in one Random Option Script
    //= Free Script!!!!
    //===== By: ==================================================
    //= sader1992
    //= https://sader1992.com/
    //= https://rathena.org/board/profile/30766-sader1992/
    //= https://sader1992.com/?page=item&item=54
    //= For more , check out here >
    //= https://sader1992.com/?page=ra_services
    //= https://sader1992.com/?page=store
    //= https://rathena.org/board/profile/30766-sader1992/content/?type=downloads_file
    //===== Current Version: =====================================
    //= 1.0
    //===== Compatible With: ===================================== 
    //= rAthena Project
    //https://rathena.org/board/files/file/4309-all-in-one-random-options-script/
    //https://github.com/sader1992/sader_scripts
    //===== Update Log: =========================================
    //= Version 1.0 Creating the script.
    //===== Description: =========================================
    //= This is a Highly Custumizable random option script
    //= you can reuse the script by just creating a new file with different setting!.
    //= read and understand the settings.
    //============================================================
    payon_in01,57,67,5	script	Random Option	10434,{
    	disable_items; function rnd;
    	switch(select("Insert Random Options:Allowed Items List")){
    		case 1:
    			mes "You must equip the item to appear here!";
    			for(.@i=0;.@i<EQI_MAX;.@i++){
    				if(getequipisequiped(.@i)) {
    					.@m1$ += (inarray(.item_list,getequipid(.@i)) != -1?"^11AD09":"^F73831") + F_getpositionname(.@i) + "-[" + getequipname(.@i) + "]^000000";
    					.@exist = true;
    				}
    				.@m1$ += ":";
    			}
    			if(!.@exist){
    				mes "You have to equip the item you want to insert the random options into!.";
    				end;
    			}
    			.@eq = select(.@m1$) -1;
    			clear;
    			.@id = getequipid(.@eq);
    			if(inarray(.item_list,.@id) == -1){
    				mes "Sorry , I cannot deal with this item!";
    				end;
    			}
    			.@gid = .it[.@id];
    			if(!.@gid){
    				mes "Something went wrong!";
    				end;
    			}
    			if(!getequiprandomoption(.@eq,0,ROA_ID)){
    				.@zeny = .nz[.@gid];
    				.@cashpoint = .nk[.@gid];
    				.@costumpoint = .nc[.@gid];
    				copyarray(.@item,getd(".ni_" + .@gid),getarraysize(getd(".ni_" + .@gid)));
    				copyarray(.@amount,getd(".na_" + .@gid),getarraysize(getd(".na_" + .@gid)));
    			}else{
    				if(!.g_reroll[.@gid]){
    					mes "Sorry , i cannot reroll the random options in this item!";
    					end;
    				}
    				.@zeny = .rz[.@gid];
    				.@cashpoint = .rk[.@gid];
    				.@costumpoint = .rc[.@gid];
    				copyarray(.@item,getd(".ri_" + .@gid),getarraysize(getd(".ri_" + .@gid)));
    				copyarray(.@amount,getd(".ra_" + .@gid),getarraysize(getd(".ra_" + .@gid)));
    			}
    			mes "Selected Item [" + getequipname(.@eq) + "]";
    			mes "==== Cost ====";
    			if(.@zeny) mes "Zeny: " + .@zeny;
    			if(.@cashpoint) mes "CashPoint: " + .@cashpoint;
    			if(.@costumpoint) mes .CustomPointsName$ + ": " + .@costumpoint;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				mes "(" + .@amount[.@i] + "pcs.) " + getitemname(.@item[.@i]) + " (" + .@item[.@i] + ")";
    			}
    			if(!.KeepItemData){
    				mes "^E01E00You will loss all the refine and cards in the item if you continue.^000000";
    			}
    			mes "Would you like to continue?";
    			if(select("Yes:No") == 2){
    				clear;
    				mes "Ok, see you next time!";
    				end;
    			}
    			clear;
    			if(Zeny < .@zeny){
    				mes "You don't have " + .@zeny + " Zeny";
    				.@close = true;
    			}
    			if(#CASHPOINTS < .@cashpoint){
    				mes "You don't have " + .@cashpoint + " CashPoints";
    				.@close = true;
    			}
    			if(getd(.CustomPointsVariable$) < .@costumpoint){
    				mes "You don't have " + .@costumpoint + " " + .CustomPointsName$;
    				.@close = true;
    			}
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					mes "You don't have (" + .@amount[.@i] + ") " + getitemname(.@item[.@i]);
    					.@close = true;
    				}
    			}
    			if(.@close) end;
    			.@r = getequiprefinerycnt(.@eq);
    			for(.@i=0;.@i<4;.@i++){
    				if(getequipcardid(.@eq,.@i)){
    					setd ".@c" + .@i,getequipcardid(.@eq,.@i);
    					.@re[getarraysize(.@re)] = true;
    				}
    			}
    			copyarray(.@opt_id,getd(".ro_id_" + .@gid + "_0"),getarraysize(getd(".ro_id_" + .@gid + "_0")));
    			copyarray(.@opt_mn,getd(".ro_mn_" + .@gid + "_0"),getarraysize(getd(".ro_mn_" + .@gid + "_0")));
    			copyarray(.@opt_mx,getd(".ro_mx_" + .@gid + "_0"),getarraysize(getd(".ro_mx_" + .@gid + "_0")));
    			for(.@i=1;.@i<6;.@i++){
    				copyarray(getd(".@opt_id" + .@i),getd(".ro_id_" + .@gid + "_" + .@i),getarraysize(getd(".ro_id_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mn" + .@i),getd(".ro_mn_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mn_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mx" + .@i),getd(".ro_mx_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mx_" + .@gid + "_" + .@i)));
    			}
    			for(.@i=1;.@i<6;.@i++){
    				if(rand(100) > getd(".s_" + .@i + "[" + .@gid + "]"))
    					break;
    				if(getd(".ro_id_" + .@gid + "_" + .@i)){
    					if(!getarraysize(getd(".@opt_id" + .@i))) break;
    					.@ndx = rand(getarraysize(getd(".@opt_id" + .@i)));
    					.@result_id = getd(".@opt_id" + .@i + "[" + .@ndx + "]");
    					.@result_vl = rnd(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),getd(".@opt_mx" + .@i + "[" + .@ndx + "]"));
    					deletearray(getd(".@opt_id" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mx" + .@i + "[" + .@ndx + "]"),1);
    				}else{
    					if(!.@opt_id) break;
    					.@ndx = rand(getarraysize(.@opt_id));
    					.@result_id = .@opt_id[.@ndx];
    					.@result_vl = rnd(.@opt_mn[.@ndx],.@opt_mx[.@ndx]);
    					if(!.g_reuse[.@gid]){
    						deletearray(.@opt_id[.@ndx],1);
    						deletearray(.@opt_mn[.@ndx],1);
    						deletearray(.@opt_mx[.@ndx],1);
    					}
    				}
    				if(.ex[.@result_id]){
    					for(.@i2=0;.@i2<getarraysize(.@r_id);.@i2++){
    						if(.ex[.@result_id] == .ex[.@r_id[.@i2]]){
    							.@reject = true;
    						}
    					}
    				}
    				if(!.@reject){
    					.@s1 = getarraysize(.@r_id);
    					.@r_id[.@s1] = .@result_id;
    					.@r_v[.@s1] = .@result_vl;
    				}else{
    					.@i--;
    					.@failsafe++;
    					if(.@failsafe > 50){
    						mes "Something went wrong , The server admin need to make sure that the config is done correctly!";
    						end;
    					}
    				}
    			}
    			if(Zeny < .@zeny) end;
    			if(#CASHPOINTS < .@cashpoint) end;
    			if(getd(.CustomPointsVariable$) < .@costumpoint) end;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					end;
    				}
    			}
    			// anti-hack
    			if (callfunc("F_IsEquipIDHack", .@eq, .@id) || callfunc("F_IsEquipCardHack", .@eq, .@c0, .@c1, .@c2, .@c3)) {
    				// anti-hack
    				emotion ET_FRET;
    				mes "Item Switch detected!";
    				end;
    			}
    			Zeny -= .@zeny;
    			#CASHPOINTS-= .@cashpoint;
    			setd(.CustomPointsVariable$,getd(.CustomPointsVariable$) - .@costumpoint);
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				delitem(.@item[.@i],.@amount[.@i]);
    			}
    			if(!.@r_id){
    				specialeffect2 EF_REFINEOK;
    				mes "Look Like you didn't get any random option, your luck is really bad!";
    				end;
    			}
    			delequip(.@eq);
    			specialeffect2 EF_REFINEOK;
    			if(.KeepItemData)
    				getitem3(.@id,1,1,.@r,0,.@c0,.@c1,.@c2,.@c3,.@r_id,.@r_v,.@null);
    			else
    				getitem3(.@id,1,1,0,0,0,0,0,0,.@r_id,.@r_v,.@null);
    			equip(.@id);
    			mes "Done!";
    		end;
    		
    		case 2:
    			mes "The list of the allowed items in this npc!";
    			for(.@i=0;.@i<getarraysize(.item_list);.@i++){
    				mes "<ITEM>" + getitemname(.item_list[.@i]) + "[" + getitemslots(.item_list[.@i]) + "]<INFO>" + .item_list[.@i] + "</INFO></ITEM>";
    				if(.@i >= 10 && !(.@i%10)) next;
    			}
    		end;
    	}
    end;
    
    	function	rnd	{
    		if(.HardBalance){
    			return rand(getarg(0),rand(getarg(0)+1,getarg(1)));
    		}
    		return rand(getarg(0),getarg(1));
    	}
    
    	function	AddGroup	{
    		.@id = getarg(0);
    		for(.@i=1;.@i<getargcount();.@i++){
    			.it[getarg(.@i)] = .@id;
    			.item_list[getarraysize(.item_list)] = getarg(.@i);
    			
    		}
    		return;
    	}
    	
    	function	AddGroupOption	{
    		.@id = getarg(0);
    		.g_reroll[.@id] = getarg(1);
    		.g_reuse[.@id] = getarg(2);
    		return;
    	}
    	
    	function	AddGroupCost	{
    		.@id = getarg(0);
    		.nz[.@id] = getarg(1);
    		.nk[.@id] = getarg(2);
    		.nc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ni_" + .@id));
    			setd(".ni_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".na_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupReRollCost	{
    		.@id = getarg(0);
    		.rz[.@id] = getarg(1);
    		.rk[.@id] = getarg(2);
    		.rc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ri_" + .@id));
    			setd(".ri_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".ra_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupChance	{
    		.@id = getarg(0);
    		.s_1[.@id] = getarg(1);
    		.s_2[.@id] = getarg(2);
    		.s_3[.@id] = getarg(3);
    		.s_4[.@id] = getarg(4);
    		.s_5[.@id] = getarg(5);
    		return;
    	}
    	
    	function	AddOpt	{
    		.@id = getarg(0);
    		.@loc = getarg(1);
    		.@s = getarraysize(getd(".ro_id_" + .@id + "_" + .@loc));
    		setd(".ro_id_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(2));
    		setd(".ro_mn_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(3));
    		setd(".ro_mx_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(4));
    		return;
    	}
    	
    	function	AddExclusiveOpt	{
    		.@s1 = getarraysize(.exv);
    		.exv[.@s1] = true;
    		for(.@i=0;.@i<getargcount();.@i++){
    			.ex[getarg(.@i)] = .@s1;
    		}
    		return;
    	}
    
    OnInit:
    	.exv = true;//DO NOT REMOVE THIS.
    	.KeepItemData = true;//if this is 'false , the player will loss the refine+cards from the item when he use this npc.
    	.CustomPointsVariable$ = "#COSTUMPOINTS";//The variable name of the costum points.
    	.CustomPointsName$ = "Server RO Points";//The name of the costum points, this what the player will see.
    	.HardBalance = true;//if this is true , it would be much harder to get high value in the random option.
    	
    	
    	//AddGroup(<Group ID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>);
    	/*
    	AddGroup Doc
    		<Group ID> = a number between 1 and MAX_INT64
    		DO NOT REUSE THE GROUP ID IN THE SAME FILE CONFIG!
    		DO NOT REUSE THE SAME ITEM ID IN DIFFERENT GROUP!
    		will create a group id 
    		you can add as many as you want items inside a group.
    	*/
    	
    	//AddGroupOption(<Group ID>,<Allow ReRoll?true:false>,<Allow reuse already gotten option?true:false>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupOption Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Allow ReRoll?true:false> = allow reroll an item with random option or not
    		<Allow reuse already gotten option?true:false> = for exammple if you have str in the options and the player gor it , can he get it again in another slot?
    		
    	*/
    	
    	//AddGroupCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupReRollCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupReRollCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupChance(<Group ID>,<1st Option Chance>,<2nd Option Chance>,<3rd Option Chance>,<4th Option Chance>,<5th Option Chance>);
    	/*
    	AddGroupChance Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<1st Option Chance> = the Chance to get one of the random options in the slot 1 (can be 0)
    		<2nd Option Chance> = the Chance to get one of the random options in the slot 2 (can be 0)
    		<3rd Option Chance> = the Chance to get one of the random options in the slot 3 (can be 0)
    		<4th Option Chance> = the Chance to get one of the random options in the slot 4 (can be 0)
    		<5th Option Chance> = the Chance to get one of the random options in the slot 5 (can be 0)
    		
    		Keep inmind that if the player didn't get lucky for example at the slot 2 , all the chances after will be ignored
    		you cannot skip a random option slot that would bug the game client.
    	*/
    	
    	//AddOpt(<Group ID>,<Location>,<Random Option ID>,<Minimum Value>,<Maximum Value>);
    	/*
    	AddOpt Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Location> = you can spisfiy random option to a location from 1 to 5 , but you can use 0 , if you used 0 it will apply to all locations that doesn't have spisfied random options.
    		<Random Option ID> = random option id , you can use the id or the variable , check out the file /rathena/db/re/item_randomopt_db.yml
    		<Minimum Value> = the minimum value
    		<Maximum Value> = the maximum value
    	*/
    	
    	//AddExclusiveOpt(<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>);
    	/*
    	AddExclusiveOpt Doc
    		this will help you to prevent a group of random opions typs in the same item in different slots
    		for example
    			RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET
    		if the player got 1 of them in a slot , he wont get another one to another slot
    	*/
    
    //Example!!!>
    //this is just an example , this script allow you to create any random option system you want.
    
    	//Creating Group id 1 , with Hat items inside.
    	AddGroup(1,50001,50002,50004,50005,50006,50007,50008,50009,50010,50011,50014,50015);
    	//Group id 1 Options
    	AddGroupOption(1,true,false);
    	//Group id 1 Cost
    	AddGroupCost(1,0,0,0,677,50);
    	//Group id 1 ReRoll Cost
    	AddGroupReRollCost(1,0,0,0,677,50);
    	//Group id 1 Chances.
    	AddGroupChance(1,100,100,0,0,0);
    	//Group id 1 Random Option List. location 0 mean all the slot locations
    	AddOpt(1,1,RDMOPT_VAR_STRAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_INTAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_VITAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_LUKAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_AGIAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_DEXAMOUNT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MAXHPPERCENT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MAXSPPERCENT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_ATKPERCENT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MAGICATKPERCENT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MDEFPOWER,5,10);
    	AddOpt(1,2,RDMOPT_VAR_ITEMDEFPOWER,5,10);
    	AddOpt(1,2,RDMOPT_VAR_HITSUCCESSVALUE,5,10);
    	AddOpt(1,2,RDMOPT_VAR_CRITICALSUCCESSVALUE,5,10);
    	//those enchantment you wont get unless in slot 5
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_WATER_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_WIND_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_POISON_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET,1,100);
    	
    	//this mean those random options cannot coexist in the same item!.
    	AddExclusiveOpt(RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET);
    	
    
    end;
    
    }

    Can someone help me to add a requirment that the same item.

    Example to add Option in item 30002 you need another 30002 to proceed adding option

    same item requirment is need specially the item requirments from the script it self right now!

     

    TIA ♥

    • Upvote 1
  3. /**
    * Extended Vending system [Lilith]
    **/
    int skill_vending(struct map_session_data *sd, t_itemid nameid) {
        struct item_data *item;
        char output[1024];
        nullpo_ret(sd);
    
        if (!pc_can_give_items(sd) || (item = itemdb_search(nameid)) == NULL) {
            sd->state.prevend = 0;
            sd->vend_loot = 0;
            sd->state.workinprogress = WIP_DISABLE_NONE;
            clif_skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0);
        }
        else {
            sd->vend_loot = nameid;
            sd->state.prevend = 1;
            clif_openvendingreq(sd, 2 + sd->vend_lvl);
            sprintf(output, msg_txt(sd, 1594), item->ename.c_str());
            clif_messagecolor(&sd->bl, color_table[COLOR_CYAN], output, false, SELF);
        }
        return 0;
    }

    how do you guys solve this part when canceling the vending it still go for vending and the currency becomes unknown item.

     

    if (!pc_can_give_items(sd) || (item = itemdb_search(nameid)) == NULL) {

     

    image.thumb.png.94c69af3d51760bc74b33006d52c0f7f.png

  4. On 7/6/2023 at 8:06 PM, rongrong said:

    Thx! i have fixed it.

    int skill_vending(struct map_session_data *sd, t_itemid nameid) {
        std::shared_ptr<item_data> item;
        char output[1024];
        nullpo_ret(sd);

        if (!pc_can_give_items(sd) || (item = item_db.find(nameid)) == NULL) {  // it return -1 here but shows 4294967295

        if (!pc_can_give_items(sd) || !nameid || !item_db.exists(nameid)) {  // i fixed like this and it works well now

     

    Is there an update code for this? I test this on latest rA it cancels the vending when u press cancel but when u try to ok the map disconnects.

  5. Hello @sader1992 I'm using your All in one Random Option Script.
    I encounter an error.

    image.png.09ceeae8470b3dd06fe0faa233c46d97.png

    I think when the random goes to the minimum value of the option it will error.

    //===== rAthena Script =======================================
    //= saders All in one Random Option Script
    //= Free Script!!!!
    //===== By: ==================================================
    //= sader1992
    //= https://sader1992.com/
    //= https://rathena.org/board/profile/30766-sader1992/
    //= https://sader1992.com/?page=item&item=54
    //= For more , check out here >
    //= https://sader1992.com/?page=ra_services
    //= https://sader1992.com/?page=store
    //= https://rathena.org/board/profile/30766-sader1992/content/?type=downloads_file
    //===== Current Version: =====================================
    //= 1.0
    //===== Compatible With: ===================================== 
    //= rAthena Project
    //https://rathena.org/board/files/file/4309-all-in-one-random-options-script/
    //https://github.com/sader1992/sader_scripts
    //===== Update Log: =========================================
    //= Version 1.0 Creating the script.
    //===== Description: =========================================
    //= This is a Highly Custumizable random option script
    //= you can reuse the script by just creating a new file with different setting!.
    //= read and understand the settings.
    //============================================================
    prontera,108,172,5	script	Random Option	10434,{
    	disable_items; function rnd;
    	switch(select("Insert Random Options:Allowed Items List")){
    		case 1:
    			mes "You must equip the item to appear here!";
    			for(.@i=0;.@i<EQI_MAX;.@i++){
    				if(getequipisequiped(.@i)) {
    					.@m1$ += (inarray(.item_list,getequipid(.@i)) != -1?"^11AD09":"^F73831") + F_getpositionname(.@i) + "-[" + getequipname(.@i) + "]^000000";
    					.@exist = true;
    				}
    				.@m1$ += ":";
    			}
    			if(!.@exist){
    				mes "You have to equip the item you want to insert the random options into!.";
    				end;
    			}
    			.@eq = select(.@m1$) -1;
    			clear;
    			.@id = getequipid(.@eq);
    			if(inarray(.item_list,.@id) == -1){
    				mes "Sorry , I cannot deal with this item!";
    				end;
    			}
    			.@gid = .it[.@id];
    			if(!.@gid){
    				mes "Something went wrong!";
    				end;
    			}
    			if(!getequiprandomoption(.@eq,0,ROA_ID)){
    				.@zeny = .nz[.@gid];
    				.@cashpoint = .nk[.@gid];
    				.@costumpoint = .nc[.@gid];
    				copyarray(.@item,getd(".ni_" + .@gid),getarraysize(getd(".ni_" + .@gid)));
    				copyarray(.@amount,getd(".na_" + .@gid),getarraysize(getd(".na_" + .@gid)));
    			}else{
    				if(!.g_reroll[.@gid]){
    					mes "Sorry , i cannot reroll the random options in this item!";
    					end;
    				}
    				.@zeny = .rz[.@gid];
    				.@cashpoint = .rk[.@gid];
    				.@costumpoint = .rc[.@gid];
    				copyarray(.@item,getd(".ri_" + .@gid),getarraysize(getd(".ri_" + .@gid)));
    				copyarray(.@amount,getd(".ra_" + .@gid),getarraysize(getd(".ra_" + .@gid)));
    			}
    			mes "Selected Item [" + getequipname(.@eq) + "]";
    			mes "==== Cost ====";
    			if(.@zeny) mes "Zeny: " + .@zeny;
    			if(.@cashpoint) mes "CashPoint: " + .@cashpoint;
    			if(.@costumpoint) mes .CustomPointsName$ + ": " + .@costumpoint;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				mes "(" + .@amount[.@i] + "pcs.) " + getitemname(.@item[.@i]) + " (" + .@item[.@i] + ")";
    			}
    			if(!.KeepItemData){
    				mes "^E01E00You will loss all the refine and cards in the item if you continue.^000000";
    			}
    			mes "Would you like to continue?";
    			if(select("Yes:No") == 2){
    				clear;
    				mes "Ok, see you next time!";
    				end;
    			}
    			clear;
    			if(Zeny < .@zeny){
    				mes "You don't have " + .@zeny + " Zeny";
    				.@close = true;
    			}
    			if(#CASHPOINTS < .@cashpoint){
    				mes "You don't have " + .@cashpoint + " CashPoints";
    				.@close = true;
    			}
    			if(getd(.CustomPointsVariable$) < .@costumpoint){
    				mes "You don't have " + .@costumpoint + " " + .CustomPointsName$;
    				.@close = true;
    			}
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					mes "You don't have (" + .@amount[.@i] + ") " + getitemname(.@item[.@i]);
    					.@close = true;
    				}
    			}
    			if(.@close) end;
    			.@r = getequiprefinerycnt(.@eq);
    			for(.@i=0;.@i<4;.@i++){
    				if(getequipcardid(.@eq,.@i)){
    					setd ".@c" + .@i,getequipcardid(.@eq,.@i);
    					.@re[getarraysize(.@re)] = true;
    				}
    			}
    			copyarray(.@opt_id,getd(".ro_id_" + .@gid + "_0"),getarraysize(getd(".ro_id_" + .@gid + "_0")));
    			copyarray(.@opt_mn,getd(".ro_mn_" + .@gid + "_0"),getarraysize(getd(".ro_mn_" + .@gid + "_0")));
    			copyarray(.@opt_mx,getd(".ro_mx_" + .@gid + "_0"),getarraysize(getd(".ro_mx_" + .@gid + "_0")));
    			for(.@i=1;.@i<6;.@i++){
    				copyarray(getd(".@opt_id" + .@i),getd(".ro_id_" + .@gid + "_" + .@i),getarraysize(getd(".ro_id_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mn" + .@i),getd(".ro_mn_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mn_" + .@gid + "_" + .@i)));
    				copyarray(getd(".@opt_mx" + .@i),getd(".ro_mx_" + .@gid + "_" + .@i),getarraysize(getd(".ro_mx_" + .@gid + "_" + .@i)));
    			}
    			for(.@i=1;.@i<6;.@i++){
    				if(rand(100) > getd(".s_" + .@i + "[" + .@gid + "]"))
    					break;
    				if(getd(".ro_id_" + .@gid + "_" + .@i)){
    					if(!getarraysize(getd(".@opt_id" + .@i))) break;
    					.@ndx = rand(getarraysize(getd(".@opt_id" + .@i)));
    					.@result_id = getd(".@opt_id" + .@i + "[" + .@ndx + "]");
    					.@result_vl = rnd(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),getd(".@opt_mx" + .@i + "[" + .@ndx + "]"));
    					deletearray(getd(".@opt_id" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mn" + .@i + "[" + .@ndx + "]"),1);
    					deletearray(getd(".@opt_mx" + .@i + "[" + .@ndx + "]"),1);
    				}else{
    					if(!.@opt_id) break;
    					.@ndx = rand(getarraysize(.@opt_id));
    					.@result_id = .@opt_id[.@ndx];
    					.@result_vl = rnd(.@opt_mn[.@ndx],.@opt_mx[.@ndx]);
    					if(!.g_reuse[.@gid]){
    						deletearray(.@opt_id[.@ndx],1);
    						deletearray(.@opt_mn[.@ndx],1);
    						deletearray(.@opt_mx[.@ndx],1);
    					}
    				}
    				if(.ex[.@result_id]){
    					for(.@i2=0;.@i2<getarraysize(.@r_id);.@i2++){
    						if(.ex[.@result_id] == .ex[.@r_id[.@i2]]){
    							.@reject = true;
    						}
    					}
    				}
    				if(!.@reject){
    					.@s1 = getarraysize(.@r_id);
    					.@r_id[.@s1] = .@result_id;
    					.@r_v[.@s1] = .@result_vl;
    				}else{
    					.@i--;
    					.@failsafe++;
    					if(.@failsafe > 50){
    						mes "Something went wrong , The server admin need to make sure that the config is done correctly!";
    						end;
    					}
    				}
    			}
    			if(Zeny < .@zeny) end;
    			if(#CASHPOINTS < .@cashpoint) end;
    			if(getd(.CustomPointsVariable$) < .@costumpoint) end;
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				if(countitem(.@item[.@i]) < .@amount[.@i]){
    					end;
    				}
    			}
    			// anti-hack
    			if (callfunc("F_IsEquipIDHack", .@eq, .@id) || callfunc("F_IsEquipCardHack", .@eq, .@c0, .@c1, .@c2, .@c3)) {
    				// anti-hack
    				emotion ET_FRET;
    				mes "Item Switch detected!";
    				end;
    			}
    			Zeny -= .@zeny;
    			#CASHPOINTS-= .@cashpoint;
    			setd(.CustomPointsVariable$,getd(.CustomPointsVariable$) - .@costumpoint);
    			for(.@i=0;.@i<getarraysize(.@item);.@i++){
    				delitem(.@item[.@i],.@amount[.@i]);
    			}
    			if(!.@r_id){
    				specialeffect2 EF_REFINEOK;
    				mes "Look Like you didn't get any random option, your luck is really bad!";
    				end;
    			}
    			delequip(.@eq);
    			specialeffect2 EF_REFINEOK;
    			if(.KeepItemData)
    				getitem3(.@id,1,1,.@r,0,.@c0,.@c1,.@c2,.@c3,.@r_id,.@r_v,.@null);
    			else
    				getitem3(.@id,1,1,0,0,0,0,0,0,.@r_id,.@r_v,.@null);
    			equip(.@id);
    			mes "Done!";
    		end;
    		
    		case 2:
    			mes "The list of the allowed items in this npc!";
    			for(.@i=0;.@i<getarraysize(.item_list);.@i++){
    				mes "<ITEM>" + getitemname(.item_list[.@i]) + "[" + getitemslots(.item_list[.@i]) + "]<INFO>" + .item_list[.@i] + "</INFO></ITEM>";
    				if(.@i >= 10 && !(.@i%10)) next;
    			}
    		end;
    	}
    end;
    
    	function	rnd	{
    		if(.HardBalance){
    			return rand(getarg(0),rand(getarg(0),getarg(1)));
    		}
    		return rand(getarg(0),getarg(1));
    	}
    
    	function	AddGroup	{
    		.@id = getarg(0);
    		for(.@i=1;.@i<getargcount();.@i++){
    			.it[getarg(.@i)] = .@id;
    			.item_list[getarraysize(.item_list)] = getarg(.@i);
    			
    		}
    		return;
    	}
    	
    	function	AddGroupOption	{
    		.@id = getarg(0);
    		.g_reroll[.@id] = getarg(1);
    		.g_reuse[.@id] = getarg(2);
    		return;
    	}
    	
    	function	AddGroupCost	{
    		.@id = getarg(0);
    		.nz[.@id] = getarg(1);
    		.nk[.@id] = getarg(2);
    		.nc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ni_" + .@id));
    			setd(".ni_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".na_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupReRollCost	{
    		.@id = getarg(0);
    		.rz[.@id] = getarg(1);
    		.rk[.@id] = getarg(2);
    		.rc[.@id] = getarg(3);
    		for(.@i=4;.@i<getargcount();.@i+=2){
    			.@s = getarraysize(getd(".ri_" + .@id));
    			setd(".ri_" + .@id + "[" + .@s + "]",getarg(.@i));
    			setd(".ra_" + .@id + "[" + .@s + "]",getarg(.@i+1));
    		}
    		return;
    	}
    	
    	function	AddGroupChance	{
    		.@id = getarg(0);
    		.s_1[.@id] = getarg(1);
    		.s_2[.@id] = getarg(2);
    		.s_3[.@id] = getarg(3);
    		.s_4[.@id] = getarg(4);
    		.s_5[.@id] = getarg(5);
    		return;
    	}
    	
    	function	AddOpt	{
    		.@id = getarg(0);
    		.@loc = getarg(1);
    		.@s = getarraysize(getd(".ro_id_" + .@id + "_" + .@loc));
    		setd(".ro_id_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(2));
    		setd(".ro_mn_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(3));
    		setd(".ro_mx_" + .@id + "_" + .@loc + "[" + .@s + "]",getarg(4));
    		return;
    	}
    	
    	function	AddExclusiveOpt	{
    		.@s1 = getarraysize(.exv);
    		.exv[.@s1] = true;
    		for(.@i=0;.@i<getargcount();.@i++){
    			.ex[getarg(.@i)] = .@s1;
    		}
    		return;
    	}
    
    OnInit:
    	.exv = true;//DO NOT REMOVE THIS.
    	.KeepItemData = true;//if this is 'false , the player will loss the refine+cards from the item when he use this npc.
    	.CustomPointsVariable$ = "#COSTUMPOINTS";//The variable name of the costum points.
    	.CustomPointsName$ = "Server RO Points";//The name of the costum points, this what the player will see.
    	.HardBalance = true;//if this is true , it would be much harder to get high value in the random option.
    	
    	
    	//AddGroup(<Group ID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>,<ItemID>);
    	/*
    	AddGroup Doc
    		<Group ID> = a number between 1 and MAX_INT64
    		DO NOT REUSE THE GROUP ID IN THE SAME FILE CONFIG!
    		DO NOT REUSE THE SAME ITEM ID IN DIFFERENT GROUP!
    		will create a group id 
    		you can add as many as you want items inside a group.
    	*/
    	
    	//AddGroupOption(<Group ID>,<Allow ReRoll?true:false>,<Allow reuse already gotten option?true:false>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupOption Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Allow ReRoll?true:false> = allow reroll an item with random option or not
    		<Allow reuse already gotten option?true:false> = for exammple if you have str in the options and the player gor it , can he get it again in another slot?
    		
    	*/
    	
    	//AddGroupCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupReRollCost(<Group ID>,<Zeny Cost>,<CashPoint Cost>,<Custom Points Cost>,<Item1 ID Cost>,<Item1 Amount Cost>,<Item2 ID Cost>,<Item2 Amount Cost>,<....ETC>);
    	/*
    	AddGroupReRollCost Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Zeny Cost> = the zeny cost (can be 0)
    		<CashPoint Cost> = the cashpoints cost (can be 0)
    		<Custom Points Cost> = if you are using costum points in the script , check out .CustomPointsVariable$ and .CustomPointsName$ at the start of the script (can be 0)
    		<Item1 ID Cost> = the item cost
    		<Item1 Amount Cost> = the item amount cost
    		
    		You can use as many item,amount cost at the end of the function.
    	*/
    	
    	//AddGroupChance(<Group ID>,<1st Option Chance>,<2nd Option Chance>,<3rd Option Chance>,<4th Option Chance>,<5th Option Chance>);
    	/*
    	AddGroupChance Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<1st Option Chance> = the Chance to get one of the random options in the slot 1 (can be 0)
    		<2nd Option Chance> = the Chance to get one of the random options in the slot 2 (can be 0)
    		<3rd Option Chance> = the Chance to get one of the random options in the slot 3 (can be 0)
    		<4th Option Chance> = the Chance to get one of the random options in the slot 4 (can be 0)
    		<5th Option Chance> = the Chance to get one of the random options in the slot 5 (can be 0)
    		
    		Keep inmind that if the player didn't get lucky for example at the slot 2 , all the chances after will be ignored
    		you cannot skip a random option slot that would bug the game client.
    	*/
    	
    	//AddOpt(<Group ID>,<Location>,<Random Option ID>,<Minimum Value>,<Maximum Value>);
    	/*
    	AddOpt Doc
    		<Group ID> = A group id that is already created in AddGroup()!.
    		<Location> = you can spisfiy random option to a location from 1 to 5 , but you can use 0 , if you used 0 it will apply to all locations that doesn't have spisfied random options.
    		<Random Option ID> = random option id , you can use the id or the variable , check out the file /rathena/db/re/item_randomopt_db.yml
    		<Minimum Value> = the minimum value
    		<Maximum Value> = the maximum value
    	*/
    	
    	//AddExclusiveOpt(<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>,<Random Option ID>);
    	/*
    	AddExclusiveOpt Doc
    		this will help you to prevent a group of random opions typs in the same item in different slots
    		for example
    			RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET
    		if the player got 1 of them in a slot , he wont get another one to another slot
    	*/
    
    //Example!!!>
    //this is just an example , this script allow you to create any random option system you want.
    
    	//Creating Group id 1 , with Hat items inside.
    	AddGroup(1,50001,50002,50004,50005,50006,50007,50008,50009,50010,50011,50014,50015);
    	//Group id 1 Options
    	AddGroupOption(1,true,false);
    	//Group id 1 Cost
    	AddGroupCost(1,0,0,0,677,50);
    	//Group id 1 ReRoll Cost
    	AddGroupReRollCost(1,0,0,0,677,50);
    	//Group id 1 Chances.
    	AddGroupChance(1,100,100,0,0,0);
    	//Group id 1 Random Option List. location 0 mean all the slot locations
    	AddOpt(1,1,RDMOPT_VAR_STRAMOUNT,5,10);
    	AddOpt(1,1,RDMOPT_VAR_INTAMOUNT,5,10);
    	//AddOpt(1,0,RDMOPT_VAR_VITAMOUNT,5,10);
    	//AddOpt(1,0,RDMOPT_VAR_LUKAMOUNT,5,10);
    	//AddOpt(1,0,RDMOPT_VAR_AGIAMOUNT,5,10);
    	//AddOpt(1,0,RDMOPT_VAR_DEXAMOUNT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MAXHPPERCENT,5,10);
    	AddOpt(1,2,RDMOPT_VAR_MAXSPPERCENT,5,10);
    	//those enchantment you wont get unless in slot 5
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_WATER_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_WIND_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_POISON_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET,1,100);
    	AddOpt(1,5,RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET,1,100);
    	
    	//this mean those random options cannot coexist in the same item!.
    	AddExclusiveOpt(RDMOPT_DAMAGE_PROPERTY_NOTHING_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WATER_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_GROUND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_FIRE_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_WIND_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_POISON_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_SAINT_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_DARKNESS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_TELEKINESIS_TARGET,
    			RDMOPT_DAMAGE_PROPERTY_UNDEAD_TARGET);
    	
    
    end;
    
    }

     

  6. -	script	Fishing Chest	-1,{
    
    set #fishc,0;
    
    //Fishing rod
    set .@Rod,2764;
    //Fishing Lure
    set .@Lure,2775;
    
    //Fishing Muffler
    set .@Muffler,2550;
    //Fishing Boots
    set .@Boots,2443;
    
    //Auto-Fish
    set .@Auto,1;
    //Auto-Fish on Fail
    set .@AutoFail,1;
    
    Fish:
    if (isequipped(.@Muffler)) && (isequipped(.@Boots)) {
    	if( #fishc >= 30000) end;
    } else {
    	if( #fishc >= 15000) end;
    }
    	if (isequipped(.@Rod)) && (isequipped(.@Lure)){
    		specialeffect EF_BUBBLE,"Fishing Hole";
    		//soundeffect "fishingrod.wav",0;
    		set #fishc,#fishc+1;
    		set .@fcast,10;
    			if (isequipped(.@Muffler)) && (isequipped(.@Boots)) {
    				set .@fcast,.@fcast - 8;
    				dispbottom "[Fishing] Casting... "+#fishc+"/30000";
    			} else {
    				dispbottom "[Fishing] Casting... "+#fishc+"/15000";
    			}
    		progressbar "ffffff",.@fcast;
    		if (rand(1,20) == 2){
    		getitem 12103,1; //Bloody Branch
    		specialeffect2 EF_TEMP_OK;
    		//soundeffectall "success.wav",0,strcharinfo(3);
    		//mapannounce strcharinfo(3),strcharinfo(0)+" has caught a Blue Fish!",bc_map,"0xff77ff";
    		if(.@Auto==1){
    		goto Fish;}else{
    		end;}
    		}
    			if (rand(1,6) == 1) ||(rand(1,6) == 3) || (rand(1,6) == 6){
    			setarray .@Catch[0],579,908,909,963,956,6049,918,960,910,938,624;// List of Junk/Other
    			set .@CatchRand,.@Catch[rand(getarraysize(.@Catch))];
    			getitem .@CatchRand,1;
    			}
    			else {
    			dispbottom "[Fishing] Nothing was caught...";
    			if(.@AutoFail == 1){
    			goto Fish;} else{
    			end;}
    			}
    		if (rand(1,100) == 3){
    		//setarray .@Rare[0],7179,7179,7179;
    		//set .@RareCatch, .@Rare[rand(getarraysize(.@Rare))];
    		//getitem .@RareCatch,1; //Reward
    		set #EventP,#EventP+10;
    		message strcharinfo(0),"[Fishing]: you've gained 10 event points.";
    		//mapannounce strcharinfo(3),strcharinfo(0)+" has caught a "+getitemname(.@RareCatch)+"!",bc_map,"0x33CC00";
    		}
    		if(.@Auto == 1){
    		goto Fish;} else{
    		end;}
    		}
    	else {
    	dispbottom "[Fishing] You need a Rod and Lure.";
    	end;
    	}
    }
    maintown,93,305,3	duplicate(Fishing Chest)	Fishing Chest#1	10005
    maintown,93,310,3	duplicate(Fishing Chest)	Fishing Chest#2	10005
    maintown,93,315,3	duplicate(Fishing Chest)	Fishing Chest#3	10005

    can someone add gepard check on this script that no one dual can fishing. TIA ♥

  7. //===== rAthena Script =======================================
    //= Job Master
    //===== Description: =========================================
    //= A fully functional job changer.
    //===== Additional Comments: =================================
    //= 1.0 Initial script. [Euphy]
    //= 1.1 Fixed reset on Baby job change.
    //= 1.2 Added Expanded Super Novice support and initial Kagerou/Oboro support.
    //= 1.3 Kagerou/Oboro added.
    //= 1.4 Rebellion added.
    //= 1.5 Added option to disable RebirthClass. [mazvi]
    //= 1.6 Added option to get job related equipment on change. [Braniff]
    //= 1.7 Readability changes. Also added BabyExpanded and BabySummoner classes. [Jey]
    //= 1.8 Added option to disable Baby Novice Only but Baby Class can be Enabled [mazvi]
    //= 1.9 Migrate/Integrate to Global Functions Platinum Skills. [mazvi]
    //= 2.0 Added 4th class [Lemongrass]
    //============================================================
    
    maintown,223,223,3	script	Job Master	10300,{
    function Get_Job_Equip;
    // Checks if the Player has the required level.
    // closes if not, returns if yes
    function	Require_Level	{
    	if (BaseLevel < getarg(0) || JobLevel < getarg(1)) {
    		.@blvl = getarg(0) - BaseLevel;
    		.@jlvl = getarg(1) - JobLevel;
    		mes "Level requirement:";
    		mes ((getarg(0)>1)? 
    			"^bb0000"+getarg(0)+"^000000 (^bb0000Base^000000) / ":"")+"^00bb00"+
    			getarg(1)+"^000000 (^00bb00Job^000000)";
    		mes "You need " +
    			((.@blvl > 0) ? "^bb0000"+.@blvl+"^000000 more base levels " + 
    				((.@jlvl > 0) ? "and " : "") : "") +
    			((.@jlvl > 0) ? "^00bb00"+.@jlvl+"^000000 more job levels " : "") +
    			"to continue.";
    		close;
    	}
    	return;
    }
    
    // Checks if the given eac is a baby class
    function Is_Baby	{
    	return ((getarg(0, eaclass())&EAJL_BABY)>0);
    }
    
    // Checks if the player can change to fourth class.
    // Note: This does not include the level checks.
    function	Can_Change_Fourth	{
    	// To change to fourth class you need to be:
    	// * Transcendent Third Class
    	if( !.FourthClass )
    		return false; // Fourth job change disabled
    	if( (eaclass()&(EAJL_THIRD|EAJL_UPPER)) != (EAJL_THIRD|EAJL_UPPER) )
    		return false; // Not Transcendent Third Class
    	if( eaclass()&EAJL_FOURTH )
    		return false; // Already Fourth Class
    	if( roclass(eaclass()|EAJL_FOURTH) < 0 )
    		return false; // Job has no Fourth Class
    	return true;
    }
    
    // Checks if the player can change to third class.
    // Note: This does not include the level checks.
    function	Can_Change_Third	{
    	// To change to third class you either need to be:
    	// * Second Class
    	// * Transcendent Second Class
    	// * Baby Second Class
    	if( !.ThirdClass )
    		return false; // Third job change disabled
    	if( !(eaclass()&EAJL_2) )
    		return false; // Not second Class
    	if( eaclass()&EAJL_THIRD )
    		return false; // Already Third Class
    	if( roclass(eaclass()|EAJL_THIRD) < 0 )
    		return false; // Job has no third Class
    	if( (eaclass()&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE )
    		return false; // Exp. Super Novice equals 3rd Cls, but has it's own case
    	if( Is_Baby() && (!.BabyClass || !.BabyThird) )
    		return false; // No Baby (Third) change allowed
    	return true;
    }
    
    function	Can_Rebirth	{
    	// To rebirth, you need to be:
    	// * Second Class
    	if( !.RebirthClass )
    		return false; // Rebirth disabled
    	if( !(eaclass()&EAJL_2) )
    		return false; // Not second Class
    	if( eaclass()&(EAJL_UPPER|EAJL_THIRD) )
    		return false; // Already Rebirthed/ Third Class
    	if( roclass(eaclass()|EAJL_UPPER) < 0 )
    		return false; // Job has no transcended class
    	if( Is_Baby() && !.BabyClass )
    		return false; // No Baby changes allowed
    	return true;
    }
    
    // Checks if the given eac is a first class
    function	Is_First_Cls	{
    	return (getarg(0) <= EAJ_TAEKWON);
    }
    
    function	Check_Riding	{
    	// Note: Why we should always check for Riding:
    	// Mounts are considered as another class, which
    	// would make this NPC bigger just to handle with
    	// those special cases.
    	if (checkfalcon() || checkcart() || checkriding() || ismounting()) {
    		mes "Please remove your " +
    			((checkfalcon()) ? "falcon" : "") +
    			((checkcart()) ? "cart" : "") +
    			((checkriding()) ? "Peco" : "") +
    			((ismounting()) ? "mount" : "") +
    			" before proceeding.";
    		close;
    	}
    	return;
    }
    function	Check_SkillPoints	{
    	if (.SkillPointCheck && SkillPoint) {
    		mes "Please use all your skill points before proceeding.";
    		close;
    	}
    	return;
    }
    
    // addJobOptions is essentially the same like
    // setarray .@array[getarraysize(.@array)],opt1,opt2,...;
    // It's just easier to read, since we're using it very often
    function	Job_Options	{
    	.@argcount = getargcount();
    	.@arr_size = getarraysize(getarg(0));
    	for( .@i = 1; .@i < .@argcount; .@i++) {
    		setarray getelementofarray(getarg(0), .@arr_size++),getarg(.@i);
    	}
    }
    
    // Begin of the NPC
    	mes .NPCName$;
    	Check_Riding();
    	Check_SkillPoints();
    
    	// initialisation
    	.@eac = eaclass();
    	.@fourth_possible = Can_Change_Fourth();
    	.@third_possible = Can_Change_Third();
    	.@rebirth_possible = Can_Rebirth();
    	.@first_eac = .@eac&EAJ_BASEMASK;
    	.@second_eac = .@eac&EAJ_UPPERMASK;
    	// Note: These are already set in pc.cpp
    	// BaseClass = roclass(.@eac&EAJ_BASEMASK) which is the players First Class
    	// BaseJob = roclass(.@eac&EAJ_UPPERMASK) which is the players Second Class
    	//dispbottom "Debug: eac ("+.@eac+"), third ("+.@third_possible+"), rebirth("+.@rebirth_possible+"), BaseClass ("+BaseClass+"), BaseJob ("+BaseJob+")";
    		
    	// From here on the jobmaster checks the current class
    	// and fills the the array `.@job_opt` with possible
    	// job options for the player.
    	
    	if( .@rebirth_possible ) {
    		// Rebirth option (displayed on the top of the menu)
    		Require_Level(.Req_Rebirth[0], .Req_Rebirth[1]);
    		Job_Options(.@job_opt, Job_Novice_High);
    	}
    	if( .@third_possible ) {
    		// Third Job change (displayed below rebirth)
    		Require_Level(.Req_Third[0], .Req_Third[1]);
    		Job_Options(.@job_opt, roclass(.@eac|EAJL_THIRD));
    	}
    	if( .@fourth_possible ) {
    		// Fourth Job change (displayed below rebirth)
    		Require_Level(.Req_Fourth[0], .Req_Fourth[1]);
    		Job_Options(.@job_opt, roclass(.@eac|EAJL_FOURTH));
    	}
    	 
    	if (.SecondExpanded && 
    	   (.@eac&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE && // is Super Novice
    	   !(eaclass()&EAJL_THIRD) ) {				 	// not already Expanded SN
    		// (Baby) Super Novice to Expanded (Baby) Super Novice
    	   	if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) {
    			// .BabyClass & .BabyExpanded must be enabled if the is a baby
    			Require_Level(.Req_Exp_SNOVI[0], .Req_Exp_SNOVI[1]);
    			Job_Options(.@job_opt,roclass(.@eac|EAJL_THIRD)); // Expanded SN is "third" cls
    		}
    	}
    	
    	if (.SecondExpanded && 
    		((.@eac&(~EAJL_BABY)) == EAJ_NINJA || 		// is (Baby) Ninja
    		(.@eac&(~EAJL_BABY)) == EAJ_GUNSLINGER)) {	// is (Baby) Gunslinger
    		// (Baby) Ninja to (Baby) Kagerou / Oboro
    		// (Baby) Gunslinger to (Baby) Rebellion
    		if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) {
    			// .BabyClass & .BabyExpanded must be enabled if the is a baby
    			Require_Level(.Req_Exp_NJ_GS[0], .Req_Exp_NJ_GS[1]);
    			// Kagerou, Oboro, Rebellion are considered as a 2-1 class
    			Job_Options(.@job_opt, roclass(.@eac|EAJL_2_1));
    		}
    	}
    	
    	// Player is Job_Novice, Job_Novice_High or Job_Baby
    	if (.@first_eac == EAJ_NOVICE && .@second_eac != EAJ_SUPER_NOVICE) {
    		// MAPID_NOVICE, MAPID_SUPER_NOVICE, MAPID_NOVICE_HIGH, MAPID_BABY
    		Require_Level(.Req_First[0], .Req_First[1]);
    		switch(Class) {
    			case Job_Novice:
    				// First job change
    				Job_Options(.@job_opt,Job_Swordman,
    					Job_Mage, Job_Archer, Job_Acolyte, Job_Merchant, Job_Thief,
    					Job_Super_Novice, Job_Taekwon, Job_Gunslinger, Job_Ninja);
    				if( .BabyNovice )
    					Job_Options(.@job_opt, Job_Baby);
    				break;
    			case Job_Novice_High:
    				// Job change after rebirth
    				if( .LastJob && lastJob )
    					Job_Options(.@job_opt,
    						roclass((eaclass(lastJob)&EAJ_BASEMASK)|EAJL_UPPER));
    				else
    					Job_Options(.@job_opt, 
    						Job_Swordman_High, Job_Mage_High, Job_Archer_High,
    						Job_Acolyte_High, Job_Merchant_High, Job_Thief_High);
    				break;
    			case Job_Baby:
    				if( !.BabyClass )
    					break;
    				// First job change as a baby
    				Job_Options(.@job_opt, Job_Baby_Swordman, Job_Baby_Mage,
    					Job_Baby_Archer,Job_Baby_Acolyte, Job_Baby_Merchant,
    					Job_Baby_Thief);
    				if( .BabyExpanded )
    					Job_Options(.@job_opt, Job_Super_Baby, Job_Baby_Taekwon,
    						Job_Baby_Gunslinger, Job_Baby_Ninja);
    				if( .BabySummoner )
    					Job_Options(.@job_opt, Job_Baby_Summoner);
    				break;
    			default:
    				mes "An error has occurred.";
    				close;
    		}
    	} else if( Is_First_Cls(.@eac) || 				// First Class
    			   Is_First_Cls(.@eac&(~EAJL_UPPER)) ||	// Trans. First Cls
    			   (.BabyClass && Is_First_Cls(.@eac&(~EAJL_BABY))) ) {	// Baby First Cls
    		// Player is First Class (not Novice)
    		// most jobs should have two options here  (2-1 and 2-2)
    		.@class1 = roclass(.@eac|EAJL_2_1); // 2-1
    		.@class2 = roclass(.@eac|EAJL_2_2); // 2-2
    		// dispbottom "Debug: Classes: class1 ("+.@class1+"), class2 ("+.@class2+")";
    		if(.LastJob && lastJob && (.@eac&EAJL_UPPER)) {
    			// Player is rebirth Cls and linear class changes are enforced
    			Require_Level(.Req_Second[0], .Req_Second[1]);
    			Job_Options(.@job_opt, lastJob + Job_Novice_High);
    		} else {
    			// Class is not enforced, player can decide.
    			if( .@class1 > 0 ) { // 2-1
    				Require_Level(.Req_Second[0], .Req_Second[1]);
    				Job_Options(.@job_opt, .@class1);
    			}
    			if( .@class2 > 0 ) { // 2-2
    				Require_Level(.Req_Second[0], .Req_Second[1]);
    				Job_Options(.@job_opt, .@class2);
    			}
    		}
    	}
    	
    	// Displaying the Job Menu defined by .@job_opt.
    	// .@job_opt should not be changed below this line.
    	function Job_Menu;
    	Job_Menu(.@job_opt);
    	close;
    
    // Displays the job menu
    function	Job_Menu	{
    	// getarg(0) is the .@job_opt array holding all available job changes.
    	function Confirm_Change;
    	while(true) {
    		.@opt_cnt =  getarraysize(getarg(0));
    		if( .@opt_cnt <= 0 ) {
    			mes "No more jobs are available.";
    			close;
    		}
    
    		.@selected = 0; // Just a single job class given, no select needed
    		if (.@opt_cnt > 1) {
    			// Multiple job classes given. Select one and save it to .@class
    			// After that confirm .@class
    			mes "Select a job.";
    			.@menu$ = "";
    			for (.@i = 0; .@i < .@opt_cnt; .@i++) {
    				if( getelementofarray(getarg(0), .@i) == Job_Novice_High)
    					.@jobname$ = "^0055FFRebirth^000000";
    				else
    					.@jobname$ = jobname(getelementofarray(getarg(0), .@i));
    				.@menu$ = .@menu$ + " ~ " + .@jobname$ + ":";
    			}
    			.@menu$ = .@menu$+" ~ ^777777Cancel^000000";
    			.@selected = select(.@menu$) - 1;
    			if( .@selected < 0 || .@selected >= .@opt_cnt )
    				close;
    			next;
    			mes .NPCName$;
    		}
    		.@class = getelementofarray(getarg(0), .@selected);
    		if ((.@class == Job_Super_Novice || .@class == Job_Super_Baby) &&
    				BaseLevel < .SNovice) {
    			// Special Level Requirement because Super Novice and
    			// Super Baby can both be selected in one of the first class
    			// changes. That's why the Level Requirement is after and not before
    			// the selection.
    			mes "A base level of " + .SNovice +
    				" is required to turn into a " + jobname(.@class) + ".";
    			return;
    		}
    		// Confirm the Class
    		Confirm_Change(.@class, .@opt_cnt > 1);
    		next;
    		mes .NPCName$;
    	}
    	return;
    }
    
    
    // Executes the actual jobchange and closes.
    function	Job_Change	{
    	.@previous_class = Class;
    	.@to_cls = getarg(0);
    	next;
    	mes .NPCName$;
    	mes "You are now " + callfunc("F_InsertArticle", jobname(.@to_cls)) + "!";
    	if (.@to_cls == Job_Novice_High && .LastJob)
    		lastJob = Class; // Saves the lastJob for rebirth
    	jobchange .@to_cls;
    	if (.@to_cls == Job_Novice_High)
    		resetlvl(1);
    	else if (.@to_cls == Job_Baby) {
    		resetstatus;
    		resetskill;
    		set SkillPoint,0;
    	}
    	specialeffect2 EF_ANGEL2;
    	specialeffect2 EF_ELECTRIC;
    	if (.@previous_class != Class) {
    		if (.Platinum)
    			callfunc "F_GetPlatinumSkills";
    		if (.GetJobEquip)
    			Get_Job_Equip();
    	}
    	close; // Always closes after the change
    }
    
    function	Confirm_Change	{
    	// Player confirms he want to change into .@class
    	.@class = getarg(0, -1);
    	.@back = getarg(1, false);
    	if( .@class < 0 || eaclass(.@class) == -1 ) {
    		mes "Unknown Class Error.";
    		close;
    	}
    	mes "Do you want to change into ^0055FF"+jobname(.@class)+"^000000 class?";
    	.@job_option$ = " ~ Change into ^0055FF"+jobname(.@class)+"^000000 class";
    	if( .@class == Job_Novice_High)
    		.@job_option$ = " ~ ^0055FFRebirth^000000";
    	
    	if (select(.@job_option$+": ~ ^777777" + 
    			((.@back) ?"Go back" : "Cancel") + "^000000") == 1) {
    		Job_Change(.@class);
    	}
    	if (!.@back)
    		close; // "Cancel" pressed
    	return;
    }
    
    // Function which gives a job related item to the player
    // the items are the rewards from the original job change quests
    function	Get_Job_Equip	{
    	// Note: The item is dropping, when the player can't hold it.
    	// But that's better than not giving the item at all.
    	.@eac = eaclass();
    	if( .@eac&EAJL_FOURTH ) {
    		// Fourth Class Items
    		getitem 490087,1; // Hourglass Necklace
    	} else if( .@eac&EAJL_THIRD ) {
    		// Third Class Items
    		getitem 2795,1;	//	Green Apple Ring for every 3rd Class
    		switch(BaseJob) {
    			// BaseJob of Third Cls
    			// For Normal Third, Baby Third and Transcended Third Cls
    			case Job_Knight:
    				getitem 5746,1;	break;	//	Rune Circlet [1]
    			case Job_Wizard:
    				getitem 5753,1;	break;	//	Magic Stone Hat [1]
    			case Job_Hunter:
    				getitem 5748,1;	break;	//	Sniper Goggle [1]
    			case Job_Priest:
    				getitem 5747,1;	break;	//	Mitra [1]
    			case Job_Blacksmith:
    				getitem 5749,1;	break;	//	Driver Band [1]
    			case Job_Assassin:
    				getitem 5755,1;	break;	//	Silent Executor [1]
    			case Job_Crusader:
    				getitem 5757,1;	break;	//	Dip Schmidt Helm [1]
    			case Job_Sage:
    				getitem 5756,1;	break;	//	Wind Whisper [1]
    			case Job_Bard:
    				getitem 5751,1;	break;	//	Maestro Song's Hat [1]
    			case Job_Dancer:
    				getitem 5758,1;	break;	//	Dying Swan [1]
    			case Job_Monk:
    				getitem 5754,1;	break;	//	Blazing Soul [1]
    			case Job_Alchemist:
    				getitem 5752,1;	break;	//	Midas Whisper[1]
    			case Job_Rogue:
    				getitem 5750,1; 		//	Shadow Handicraft [1]
    				getitem 6121,1;			//	Makeover Brush
    				getitem 6122,1;	break;	//	Paint Brush
    		}
    	} else if (.@eac&EAJL_2) {
    		// Second Class (And not Third Class)
    		switch(BaseJob) {
    			// Second Class
    			case Job_Knight:
    				getitem 1163,1;	break;	//	Claymore [0]
    			case Job_Priest:
    				getitem 1522,1;	break;	//	Stunner [0]
    			case Job_Wizard:
    				getitem 1617,1;	break;	//	Survivor's Rod [0]
    			case Job_Blacksmith:
    				getitem 1360,1;	break;	//	Two-Handed-Axe [1]
    			case Job_Hunter:
    				getitem 1718,1;	break;	//	Hunter Bow [0]
    			case Job_Assassin:
    				getitem 1254,1;	break;	//	Jamadhar [0]
    			case Job_Crusader:
    				getitem 1410,1;	break;	//	Lance [0]
    			case Job_Monk:
    				getitem 1807,1;	break;	//	Fist [0]
    			case Job_Sage:
    				getitem 1550,1;	break;	//	Book [3]
    			case Job_Rogue:
    				getitem 1222,1;	break;	//	Damascus [1]
    			case Job_Alchemist:
    				getitem 1126,1;	break;	//	Saber [2]
    			case Job_Bard:
    				getitem 1907,1;	break;	//	Guitar [0]
    			case Job_Dancer:
    				getitem 1960,1;	break;	//	Whip [1]
    			case Job_Super_Novice:
    				getitem 1208,1;	break;	//	Main Gauche [4]
    			case Job_Star_Gladiator:
    				getitem 1550,1;	break;	//	Book [3]
    			case Job_Soul_Linker:
    				getitem 1617,1;	break;	//	Survivor's Rod [0]
    		}
    	} else {
    		// Neither Second or Third Cls
    		// => First Cls or not covered by the switch
    		switch(BaseClass) {
    			// First Class
    			case Job_Swordman:
    				getitem 1108,1;	break;	//	Blade [4]
    			case Job_Mage:
    				getitem 1602,1;	break;	//	Rod [4]
    			case Job_Archer:
    				getitem 1705,1;	break;	//	Composite Bow [4]
    			case Job_Acolyte:
    				getitem 1505,1;	break;	//	Mace [4]
    			case Job_Merchant:
    				getitem 1302,1;	break;	//	Axe [4]
    			case Job_Thief:
    				getitem 1208,1;	break;	//	Main Gauche [4]
    			case Job_Gunslinger:
    				getitem 13101,1; break;	//	Six Shooter [2]
    			case Job_Ninja:
    				getitem 13010,1; break;	//	Asura [2]
    		}
    	}
    	return;
    }
    
    OnInit:
    	// Initialisation, do not edit these
    	.NPCName$ = "[Job Master]";
    	
    	// Settings
    	.FourthClass = false;				// Enable fourth classes?
    	.ThirdClass = false;					// Enable third classes?
    	.RebirthClass = true;				// Enable rebirth classes?
    	.SecondExpanded = false;				// Enable new expanded second classes: Ex. Super Novice, Kagerou/Oboro, Rebellion?
    	.BabyNovice = true;					// Enable Baby novice classes? Disable it if you like player must have parent to get job baby.
    	.BabyClass = true;					// Enable Baby classes?
    	.BabyThird = false;					// Enable Baby third classes?
    	.BabyExpanded = true;				// Enable Baby Expanded classes: Ex. Baby Ninja, Baby Taekwon, etc.
    	.BabySummoner = false;				// Enable Baby Summoner?
    	.LastJob = true;					// Enforce linear class changes?
    	.SkillPointCheck = true;			// Force player to use up all skill points?
    	.Platinum = false;					// Get platinum skills automatically?
    	.GetJobEquip = false;				// Get job equipment (mostly weapons) on job change?
    
    	// Level Requirements
    	setarray .Req_First[0],1,10; 		// Minimum base level, job level to turn into 1st class
    	setarray .Req_Second[0],1,40; 		// Minimum base level, job level to turn into 2nd class
    	setarray .Req_Rebirth[0],99,50;		// Minimum base level, job level to rebirth
    	setarray .Req_Third[0],99,50;		// Minimum base level, job level to change to third class
    	setarray .Req_Fourth[0],200,70;		// Minimum base level, job level to change to fourth class
    	setarray .Req_Exp_NJ_GS[0],99,70; 	// Minimum base level, job level to turn into Expanded Ninja and Gunslinger
    	setarray .Req_Exp_SNOVI[0],99,99; 	// Minimum base level, job level to turn into Expanded Super Novice
    	.SNovice = 45;						// Minimum base level to turn into Super Novice
    	
    	// Setting adjustments by PACKETVER
    	if( PACKETVER < 20161207 ) {
    		if( .BabyExpanded )
    			debugmes "jobmaster: BabyExpanded is disabled due to outdated PACKETVER.";
    		if( .BabySummoner )
    			debugmes "jobmaster: BabySummoner is disabled due to outdated PACKETVER.";
    		.BabyExpanded = false;
    		.BabySummoner = false;
    	}
    	end;
    }
    

    how can i remove soul linker here?

  8. prontera,124,201,1	script	trialNPC	4_F_JOB_BLACKSMITH,{
    
    	.@item = 7179;		//Set Item Here
    	.@item_amount = 1;	//Set Item Amount Here
    	.@loop = 20;		//Set How Many Times it will drop
    
    
    getmapxy .@map$,.@x,.@y, 1;// XY npc sample
    	for ( .@i = -10; .@i <= 10; .@i++ )// x
    		for ( .@j = -10; .@j <= 10; .@j++ )// y
    
    			if ( checkcell( .@map$, (.@x+.@i), (.@y+.@j), cell_chkpass ) ) {// can pass
    				.@cell_x[.@size] = .@x+.@i;
    				.@cell_y[.@size] = .@y+.@j;
    				.@size++;
    			}
    for (.@i = 0; .@i <= .@loop; .@i++) {
    	sleep 500;
    	.@r = rand( .@size );// random index
    	makeitem .@item,.@item_amount,.@map$,.@cell_x[.@r],.@cell_y[.@r];
    	}
    }

    just like this from herc.

    screenLotusRO006.jpg.4aa3b96f79e3c3f679d3f5005409ffa4.jpg

    prontera,124,201,1	script	trialNPC	4_F_JOB_BLACKSMITH,{
    
    	.@item = 501;		//Set Item Here
    	.@itemeffect = 3;	//Set Drop Effect Here (1-5)
    	.@item_amount = 1;	//Set Item Amount Here
    	.@loop = 100;		//Set How Many Times it will drop
    	
    	getmapxy(.@mapname$, .@mapx, .@mapy, UNITTYPE_PC, strcharinfo(0));
    	
    	setiteminfo(.@item, ITEMINFO_FLAG_SHOWDROPEFFECT, 1);	//Set shadow effect on for the said item
    	setiteminfo(.@item, ITEMINFO_DROPEFFECT_MODE, .@itemeffect); //Set the drop effect based on the config
    	
    	for (.@i = 0; .@i <= .@loop; .@i++) {
    		makeitem(.@item, .@item_amount,.@mapname$, .@mapx + 1, .@mapy + 1);
    	}
    	setiteminfo(.@item, ITEMINFO_FLAG_SHOWDROPEFFECT, 0);	//Set shadow effect off for the said item (to bring it back again to normal)
    	setiteminfo(.@item, ITEMINFO_DROPEFFECT_MODE, 0);	//Set drop effect off for the said item (to bring it back again to normal)
    	close;
    }

     

×
×
  • Create New...