Jump to content

Utility: All In One - Random Options Script


sader1992

Recommended Posts


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

All In One - Random Options Script


The goal in this script is to allow you to create any random option enchantment system by just creating a new copy of this script , change the script name and setting

You should be able to create any random option system exist currently in the game

DO NOT PM ME FOR ERRORS

Use the forum post to report for any bugs and errors

 

the script allow you to

create a group of items  > you can create as many groups as you want

each group has it's own options

allow reroll or not

put price for first time and price for the reroll after the first time

the price can be zeny, cashpoints, custom points, items

put random options for all slots or specific slot of the random options slot

 

put exclusive random options groups so they cannot coexist in the same item

 

 

The script config and example AT LINE 290 in the script file >

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,2220,2221,2222,2223);
	//Group id 1 Options
	AddGroupOption(1,true,false);
	//Group id 1 Cost
	AddGroupCost(1,50,0,0,502,1,503,2);
	//Group id 1 ReRoll Cost
	AddGroupReRollCost(1,50,0,0,502,5,503,2);
	//Group id 1 Chances.
	AddGroupChance(1,100,75,60,40,20);AddGroupChance(1,100,100,100,100,100);
	//Group id 1 Random Option List. location 0 mean all the slot locations
	AddOpt(1,0,RDMOPT_VAR_STRAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_INTAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_VITAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_LUKAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_AGIAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_DEXAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_MAXHPPERCENT,1,100);
	AddOpt(1,0,RDMOPT_VAR_MAXSPPERCENT,1,100);
	//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;

 

logo.png.17b58a642746b9c3767aebe3af2cef8e.png

https://sader1992.com/


  • Submitter
  • Submitted
    09/09/2021
  • Category
  • Video
  • Content Author
    sader1992

 

  • Upvote 5
  • Love 1
  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   152
  • Joined:  11/28/11
  • Last Seen:  

Thank 's for share.

AddGroupChance(1,100,100,100,100,100);

i change no effect.

Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

7 hours ago, Slammer said:

AddGroupChance(1,100,100,100,100,100);

i change no effect.

what do you mean by "no effect" ,also post all your config from OnInit to the end;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   152
  • Joined:  11/28/11
  • Last Seen:  

15 minutes ago, sader1992 said:

what do you mean by "no effect" ,also post all your config from OnInit to the end;

ow. my mistake. now it's fix. @sader1992 can u make it choise /Slot?

Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  715
  • Reputation:   83
  • Joined:  01/05/12
  • Last Seen:  

Hey @sader1992 is it possible to add item category to this?

for example:

> Headgears

  • Upper Headgears
  • Middle Headgears
  • Lower Headgears

> Weapons

  • Daggers
  • Swords
  • Bows
  • Staffs
     
Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

6 minutes ago, Lelouch vi Britannia said:

Hey @sader1992 is it possible to add item category to this?

for example:

> Headgears

  • Upper Headgears
  • Middle Headgears
  • Lower Headgears

> Weapons

  • Daggers
  • Swords
  • Bows
  • Staffs
     

the short answer is no

the npc config allow you to sort out the options for the equipment , however the UI is the list of what the player is wearing while talking to the npc , similar to the refine npc , so the player cannot choose an equipment in his inventory , he must equip it, and he will see one option for left hand and one option for right hand , he wont see one option for weapon and one option for shield.

Link to comment
Share on other sites

  • 3 months later...

  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

it was working before but now when i tried it again seems after this part

image.png.4dcb8aabb991ef19d9f871f4f9bb977c.png

its not proceeding at all cant event teleport 

what seems to be the problem no error in the console

here the code

//===== 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,127,170,7	script	AllInOne_RandomOption	444,{
	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] + ") " + getitemname(.@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,2220,2221,2222,2223);
	//Group id 1 Options
	AddGroupOption(1,true,false);
	//Group id 1 Cost
	AddGroupCost(1,50,0,0,0,0,0,0);
	//Group id 1 ReRoll Cost
	AddGroupReRollCost(1,50,0,0,0,0,0,0);
	//Group id 1 Chances.
	AddGroupChance(1,100,100,100,100,100);
	//Group id 1 Random Option List. location 0 mean all the slot locations
	AddOpt(1,0,RDMOPT_VAR_STRAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_INTAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_VITAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_LUKAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_AGIAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_DEXAMOUNT,1,100);
	AddOpt(1,0,RDMOPT_VAR_MAXHPPERCENT,1,100);
	AddOpt(1,0,RDMOPT_VAR_MAXSPPERCENT,1,100);
	//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;

}

this is a work of @sader1992

 

TIA ❤️

EDIT: whole map server lags when i try to add option

Edited by AinsLord
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

im using this sir @sader1992 at 1st it was working fine then several days after when i tried to put options after selecting

proceed this happens it hangs cant move cant even TP nor chat i need to reboot the whole VPS to bring it back

i dunno what happen i didnt change any codes or add anything

i just created another NPC of it for addition ID option i forgot that ID 1 has the same item on the 

other NPC that has ID 2 like this

NPC 1

//Creating Group id 1 , with Hat items inside.
	AddGroup(1,2220,2221,2222,2223);

NPC 2

//Creating Group id 1 , with Hat items inside.
	AddGroup(2,2223);

will that affect this 

DO NOT REUSE THE SAME ITEM ID IN DIFFERENT GROUP!

image.png.4dcb8aabb991ef19d9f871f4f9bb977c.png

Edited by AinsLord
more info
Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

7 hours ago, AinsLord said:

im using this sir @sader1992 at 1st it was working fine then several days after when i tried to put options after selecting

proceed this happens it hangs cant move cant even TP nor chat i need to reboot the whole VPS to bring it back

i dunno what happen i didnt change any codes or add anything

i just created another NPC of it for addition ID option i forgot that ID 1 has the same item on the 

other NPC that has ID 2 like this

NPC 1

//Creating Group id 1 , with Hat items inside.
	AddGroup(1,2220,2221,2222,2223);

NPC 2

//Creating Group id 1 , with Hat items inside.
	AddGroup(2,2223);

will that affect this 

DO NOT REUSE THE SAME ITEM ID IN DIFFERENT GROUP!

image.png.4dcb8aabb991ef19d9f871f4f9bb977c.png

The groups/ids are per npc , you can use the same item in a different npc copy however you cannot use the same item in the same npc in a different group.

 

also i need more information about when this happen to you , at any step of the npc ?

the image you provided the next line is just select , so I don't think this where you are getting the issue

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

21 hours ago, sader1992 said:

The groups/ids are per npc , you can use the same item in a different npc copy however you cannot use the same item in the same npc in a different group.

 

also i need more information about when this happen to you , at any step of the npc ?

the image you provided the next line is just select , so I don't think this where you are getting the issue

i found out why it hangs it happens because of my phpmyadmin database

thanks i love your script

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   46
  • Joined:  10/30/12
  • Last Seen:  

Thanks for this release @sader1992. Realy like it and will use it on my server. /lv

Link to comment
Share on other sites

  • 10 months later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  4
  • Reputation:   0
  • Joined:  08/07/21
  • Last Seen:  

how to see the options? script is fine but i cannot see the options added

Edited by xcoreuchi
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

hi sir @sader1992 i have this error using ur script

image.png.c2c1fbf9428218c7fa1d9519afe253b8.png

im using the lates rathena git

in my old rathena file works fine

PS: fixed already

PS: since im using the latest rathena git 

get the item_randomopt_db.yml and item_randomopt_group.yml from RE folder

paste it inside db/import

Edited by AinsLord
more info
Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

15 hours ago, AinsLord said:

hi sir @sader1992 i have this error using ur script

image.png.c2c1fbf9428218c7fa1d9519afe253b8.png

im using the lates rathena git

in my old rathena file works fine

PS: fixed already

it would be nice to mention what was the error and fix, Thank you.

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   6
  • Joined:  09/26/14
  • Last Seen:  

@sader1992 can we remove the group on this one and enable all equipment to have random option?

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   4
  • Joined:  02/20/23
  • Last Seen:  

Hi @sader1992

i tryed to add all hats ID's in group 1 but not working
emulator send me the error: 
[Error]: script:run_script_main: infinity loop !
[Debug]: Source (NPC): RandomOption at prontera (147,171)
it's work for allowed item list but now i can't add option in any item

Quote


    //Creating Group id 1 , with Hat items inside.
    AddGroup(1,2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2686, 2687, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056, 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065, 5066, 5067, 5068, 5069, 5070, 5071, 5072, 5073, 5074, 5075, 5076, 5077, 5078, 5079, 5080, 5081, 5082, 5083, 5084, 5085, 5086, 5087, 5088, 5089, 5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110, 5111, 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122, 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133, 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144, 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166, 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177, 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188, 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210, 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221, 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232, 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243, 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254, 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265, 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276, 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287, 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298, 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309, 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320, 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342, 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353, 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364, 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375, 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386, 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397, 5398, 5399, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5424, 5425, 5426, 5427, 5428, 5429, 5430, 5431, 5432, 5433, 5434, 5435, 5436, 5437, 5438, 5439, 5440, 5441, 5442, 5443, 5444, 5445, 5446, 5447, 5448, 5449, 5450, 5451, 5452, 5453, 5454, 5455, 5456, 5457, 5458, 5459, 5460, 5461, 5462, 5463, 5464, 5465, 5466, 5467, 5468, 5469, 5470, 5471, 5472, 5473, 5474, 5475, 5476, 5477, 5478, 5479, 5480, 5481, 5482, 5483, 5484, 5485, 5486, 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505, 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515, 5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525, 5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535, 5536, 5537, 5538, 5539, 5540, 5541, 5542, 5543, 5544, 5545, 5546, 5547, 5548, 5549, 5550, 5551, 5552, 5553, 5554, 5555, 5556, 5557, 5558, 5559, 5560, 5561, 5562, 5563, 5564, 5565, 5566, 5567, 5568, 5569, 5570, 5571, 5572, 5573, 5574, 5575, 5576, 5577, 5578, 5579, 5580, 5581, 5582, 5583, 5584, 5585, 5586, 5587, 5588, 5589, 5590, 5591, 5592, 5593, 5594, 5595, 5596, 5597, 5598, 5599, 5600, 5601, 5602, 5603, 5604, 5605, 5606, 5607, 5608, 5609, 5610, 5611, 5612, 5613, 5614, 5615, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624, 5625, 5626, 5627, 5628, 5629, 5630, 5631, 5632, 5633, 5634, 5635, 5636, 5637, 5638, 5639, 5640, 5641, 5642, 5643, 5644, 5645, 5646, 5647, 5648, 5649, 5650, 5652, 5653, 5654, 5655, 5656, 5657, 5658, 5659, 5660, 5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5669, 5670, 5671, 5672, 5673, 5674, 5675, 5676, 5677, 5678, 5679, 5680, 5681, 5682, 5683, 5684, 5685, 5686, 5687, 5688, 5689, 5690, 5691, 5692, 5693, 5694, 5695, 5696, 5697, 5698, 5699, 5700, 5701, 5702, 5703, 5704, 5705, 5706, 5707, 5708, 5709, 5710, 5711, 5712, 5713, 5714, 5715, 5716, 5717, 5718, 5719, 5720, 5721, 5722, 5723, 5724, 5725, 5726, 5727, 5728, 5729, 5730, 5731, 5732, 5734, 5735, 5736, 5737, 5738, 5739, 5740, 5741, 5742, 5743, 5744, 5745, 5746, 5747, 5748, 5749, 5750, 5751, 5752, 5753, 5754, 5755, 5756, 5757, 5758, 5759, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 5784, 5785, 5786, 5787, 5788, 5789, 5790, 5791, 5792, 5793, 5794, 5795, 5796, 5797, 5798, 5799, 5800, 5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812, 5813, 5814, 5815, 5816, 5818, 5819, 5820, 5821, 5822, 5824, 5826, 5827, 5830, 5831, 5832, 5833, 5834, 5835, 5836, 5837, 5838, 5839, 5840, 5841, 5845, 5846, 5847, 5848, 5849, 5850, 5851, 5852, 5853, 5856, 5857, 5858, 5859, 5864, 5865, 5866, 5867, 5868, 5869, 5870, 5871, 5873, 5874, 5875, 5878, 5879, 5880, 5881, 5882, 5883, 5884, 5885, 5886, 5887, 5888, 5889, 5890, 5891, 5892, 5893, 5894, 5895, 5900, 5901, 5902, 5903, 5904, 5905, 5906, 5907, 5908, 5916, 5917, 5918, 5919, 5921, 5924, 5932, 5933, 5934, 5936, 5937, 5938, 5940, 5943, 5944, 5945, 5946, 5963, 5965, 5966, 5967, 5968, 5969, 5971, 5972, 5973, 5975, 5978, 5985, 5986, 15127, 15165, 15166, 15369, 15385, 15891, 15892, 15897, 15906, 15920, 15921, 15922, 15923, 15928, 15932, 15947, 15948, 15970, 18500, 18501, 18502, 18503, 18504, 18505, 18506, 18507, 18508, 18509, 18510, 18511, 18512, 18513, 18514, 18515, 18516, 18517, 18518, 18519, 18520, 18521, 18522, 18523, 18524, 18525, 18526, 18527, 18528, 18529, 18530, 18531, 18532, 18533, 18534, 18535, 18536, 18537, 18538, 18539, 18540, 18541, 18542, 18543, 18544, 18545, 18546, 18547, 18548, 18549, 18550, 18551, 18552, 18553, 18554, 18555, 18556, 18557, 18558, 18559, 18560, 18561, 18562, 18563, 18564, 18565, 18566, 18567, 18568, 18569, 18570, 18571, 18572, 18573, 18574, 18575, 18576, 18577, 18578, 18579, 18580, 18581, 18582, 18583, 18584, 18585, 18586, 18587, 18588, 18589, 18590, 18591, 18592, 18593, 18594, 18595, 18596, 18597, 18598, 18599, 18600, 18601, 18602, 18603, 18604, 18605, 18606, 18607, 18608, 18609, 18610, 18611, 18612, 18613, 18614, 18615, 18616, 18617, 18618, 18619, 18620, 18621, 18622, 18623, 18624, 18625, 18626, 18627, 18628, 18629, 18630, 18631, 18632, 18633, 18634, 18635, 18636, 18637, 18638, 18639, 18640, 18641, 18642, 18643, 18644, 18645, 18646, 18647, 18648, 18649, 18650, 18651, 18652, 18653, 18655, 18656, 18657, 18658, 18659, 18660, 18661, 18662, 18663, 18664, 18665, 18666, 18667, 18668, 18669, 18670, 18671, 18672, 18673, 18674, 18675, 18676, 18677, 18678, 18679, 18680, 18681, 18682, 18683, 18684, 18685, 18686, 18687, 18688, 18689, 18690, 18691, 18692, 18693, 18694, 18695, 18696, 18697, 18698, 18699, 18700, 18701, 18702, 18703, 18704, 18705, 18706, 18707, 18708, 18709, 18710, 18711, 18712, 18713, 18714, 18715, 18716, 18718, 18720, 18724, 18725, 18726, 18727, 18728, 18729, 18730, 18731, 18732, 18733, 18734, 18735, 18736, 18737, 18738, 18739, 18745, 18746, 18747, 18748, 18749, 18750, 18751, 18752, 18753, 18754, 18755, 18756, 18758, 18759, 18760, 18761, 18762, 18763, 18764, 18765, 18766, 18767, 18768, 18769, 18770, 18771, 18772, 18773, 18774, 18775, 18776, 18777, 18778, 18779, 18780, 18781, 18782, 18783, 18784, 18785, 18786, 18787, 18788, 18789, 18790, 18791, 18792, 18793, 18796, 18797, 18798, 18799, 18801, 18802, 18803, 18804, 18805, 18806, 18807, 18808, 18809, 18810, 18811, 18812, 18813, 18814, 18815, 18816, 18817, 18818, 18819, 18820, 18821, 18822, 18823, 18827, 18828, 18829, 18830, 18831, 18832, 18833, 18834, 18838, 18839, 18841, 18842, 18843, 18844, 18845, 18846, 18847, 18848, 18849, 18850, 18851, 18852, 18853, 18854, 18855, 18856, 18857, 18858, 18859, 18860, 18861, 18864, 18865, 18866, 18867, 18868, 18870, 18871, 18872, 18873, 18874, 18877, 18878, 18879, 18880, 18881, 18882, 18883, 18884, 18885, 18887, 18888, 18889, 18890, 18891, 18892, 18893, 18894, 18895, 18896, 18897, 18898, 18900, 18901, 18902, 18903, 18904, 18905, 18906, 18908, 18909, 18910, 18912, 18913, 18914, 18915, 18916, 18917, 18918, 18919, 18920, 18922, 18923, 18924, 18925, 18926, 18929, 18930, 18931, 18932, 18933, 18934, 18936, 18937, 18938, 18939, 18940, 18941, 18942, 18943, 18947, 18948, 18949, 18950, 18954, 18955, 18956, 18959, 18960, 18962, 18965, 18968, 18969, 18970, 18971, 18972, 18973, 18974, 18975, 18976, 18977, 18978, 18979, 18980, 18981, 18982, 18983, 18984, 18985, 18987, 18992, 18993, 18997, 19004, 19006, 19010, 19011, 19014, 19019, 19020, 19021, 19022, 19023, 19024, 19025, 19026, 19027, 19028, 19030, 19031, 19033, 19038, 19039, 19041, 19047, 19050, 19051, 19052, 19053, 19079, 19080, 19081, 19082, 19083, 19084, 19085, 19086, 19087, 19088, 19089, 19090, 19091, 19092, 19093, 19094, 19095, 19096, 19097, 19098, 19101, 19102, 19104, 19106, 19108, 19109, 19110, 19111, 19112, 19113, 19114, 19115, 19116, 19117, 19118, 19119, 19125, 19126, 19127, 19128, 19129, 19130, 19131, 19132, 19133, 19134, 19135, 19136, 19137, 19138, 19139, 19140, 19141, 19142, 19143, 19144, 19145, 19146, 19147, 19148, 19149, 19150, 19151, 19152, 19153, 19154, 19155, 19156, 19157, 19159, 19162, 19163, 19164, 19165, 19166, 19168, 19169, 19170, 19171, 19172, 19173, 19176, 19177, 19178, 19179, 19180, 19181, 19189, 19190, 19191, 19192, 19193, 19194, 19195, 19196, 19197, 19198, 19199, 19200, 19201, 19202, 19203, 19204, 19205, 19209, 19210, 19211, 19212, 19217, 19218, 19221, 19223, 19238, 19239, 19240, 19241, 19242, 19243, 19244, 19245, 19246, 19247, 19249, 19256, 19261, 19263, 19264, 19265, 19266, 19267, 19268, 19269, 19272, 19273, 19274, 19275, 19277, 19283, 19284, 19285, 19295, 19296, 19298, 19299, 19300, 19306, 19308, 19310, 19311, 19312, 19313, 19314, 19321, 19326, 19327, 19328, 19329, 19337, 19338, 19339, 19340, 19341, 19342, 19343, 19344, 19353, 19364, 19366, 19371, 19379, 19380, 19381, 19382, 19387, 19389, 19391, 19393, 19396, 19397, 19401, 19404, 19407, 19409, 19415, 19425, 19426, 19427, 19428, 19435, 19436, 19437, 19439, 19443, 19444, 19447, 19449, 19451, 19452, 19453, 19460, 19465, 19468, 19469, 19471, 19473, 19474, 19475, 19476, 19477, 19478, 19479, 19480, 19481, 19482, 19483, 19484, 19485, 19486, 19487, 19488, 19489, 19490, 19491, 19492, 19495, 19496, 19497, 19498, 19499, 21205, 28502, 400000, 400001, 400002, 400003, 400006, 400011, 400015, 400016, 400021, 400022, 400023, 400043, 400044, 400045, 400047, 400048, 400049, 400053, 400054, 400059, 400060, 400061, 400075, 400077, 400078, 400079, 400082, 400094, 400095, 400097, 400098, 400099, 400101, 400113, 400116, 400117, 400118, 400119, 400120, 400121, 400127, 400134, 400135, 400137, 400138, 400139, 400140, 400141, 400142, 400145, 400146, 400150, 400151, 400152, 400153, 400154, 400155, 400156, 400164, 400177, 400178, 400179, 400180, 400181, 400189, 400190, 400191, 400192, 400198, 400199, 400200, 400201, 400203, 400216, 400217, 400218, 400219, 400226, 400227, 400228, 400229, 400230, 400231, 400233, 400234, 400235, 400236, 400237, 400238, 400239, 400240, 400241, 400242, 400243, 400244, 400245, 400246, 400257, 400261, 400262, 400263, 400264, 400265, 400266, 400267, 400307, 400336, 400337, 400338, 400339, 400340, 400359, 400360, 400374, 400375, 400376, 400377, 400378, 400379, 400380, 400381, 400382, 400383, 400384, 400385, 400386, 400387, 400388, 400389, 400390, 400391, 400392, 400393, 400394, 400395, 400396, 410012, 410013, 410014, 410015, 410016, 410017, 410018, 410019, 410020, 410023, 410024, 410027, 410028, 410070, 410071, 410079, 410080, 410084, 410085, 410091, 410092, 410093, 410094, 410096, 410097, 410129, 410130, 410136, 410158, 410159, 410185, 410186, 410208, 410209, 410210, 410211, 420000, 420003, 420004, 420005, 420006, 420017, 420018, 420019, 420020, 420021, 420022, 420028, 420030, 420031, 420055, 420066, 420068, 420074, 420076, 420110, 420112, 420130, 420134, 420141, 420153, 420154, 420155, 420160, 420164, 420174, 420178, 420179, 420180, 420182, 420187, 436000, 436001, 436002, 436003, 436004, 436005);

 

Edited by aoshinho
Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

On 2/27/2023 at 8:23 PM, aoshinho said:

Hi @sader1992

i tryed to add all hats ID's in group 1 but not working
emulator send me the error: 
[Error]: script:run_script_main: infinity loop !
[Debug]: Source (NPC): RandomOption at prontera (147,171)
it's work for allowed item list but now i can't add option in any item

 

to fix this error on load you need to add

freeloop(1);

after

OnInit:

also You might need to add it after the start of the npc

before

disable_items;

 

this because the list of items you have is too long.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1167
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

6 hours ago, sader1992 said:

to fix this error on load you need to add

freeloop(1);

after

OnInit:

also You might need to add it after the start of the npc

before

disable_items;

 

this because the list of items you have is too long.

May i know how many maximum items list in one group?

or better use the option you mentioned before for many items for one group.

 

And i want ask, is it possible enable the option without put item in array.

i mean it's enable option for equipment in windows equipment. (alt+Q)

Edited by hendra814
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   4
  • Joined:  02/20/23
  • Last Seen:  

7 hours ago, sader1992 said:


to fix this error on load you need to add

freeloop(1);

after

OnInit:

also You might need to add it after the start of the npc

before

disable_items;

 

this because the list of items you have is too long.

it's possible remove necessity of manually insert the item ID on item list? or just bypass it?
i tryed to create one function to auto add the item selected when selected by player in the item list array but i'ts work just to change collor of item in menu list
because i want to use that NPC in any item

Edited by aoshinho
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   4
  • Joined:  02/20/23
  • Last Seen:  

5 hours ago, hendra814 said:

May i know how many maximum items list in one group?

or better use the option you mentioned before for many items for one group.

 

And i want ask, is it possible enable the option without put item in array.

i mean it's enable option for equipment in windows equipment. (alt+Q)

in my tests are supporting around 250 ids

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1167
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

8 minutes ago, aoshinho said:

it's possible remove necessity of manually insert the item ID on item list? or just bypass it?
i tryed to create one function to auto add the item selected when selected by player in the item list array but i'ts work just to change collor of item in menu list
because i want to use that NPC in any item

Bold: yes, i want like that too, just give different random option for each type (top headgear, middle headgear, low headgear, weapon, armor, garment, acc left, acc right, and even custom equipment)

PS

3 minutes ago, aoshinho said:

in my tests are supporting around 250 ids

Thanks for the confirmation.

Edited by hendra814
Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

On 3/1/2023 at 8:55 AM, aoshinho said:

it's possible remove necessity of manually insert the item ID on item list? or just bypass it?
i tryed to create one function to auto add the item selected when selected by player in the item list array but i'ts work just to change collor of item in menu list
because i want to use that NPC in any item

You can try replacing lines 45 to 49 with just .@gid = <Group ID>;

 

like this

remove 

			if(inarray(.item_list,.@id) == -1){
				mes "Sorry , I cannot deal with this item!";
				end;
			}
			.@gid = .it[.@id];

add

//.@gid = <Group ID>;
.@gid = 1;

this should make all the items group id 1

Edited by sader1992
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1167
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

1 hour ago, sader1992 said:

You can try replacing lines 45 to 49 with just .@gid = <Group ID>;

 

like this

remove 

			if(inarray(.item_list,.@id) == -1){
				mes "Sorry , I cannot deal with this item!";
				end;
			}
			.@gid = .it[.@id];

add

//.@gid = <Group ID>;
.@gid = 1;

this should make all the items group id 1

if by equipment location is it possible?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   4
  • Joined:  02/20/23
  • Last Seen:  

1 hour ago, hendra814 said:

if by equipment location is it possible?

man, it's exactly that what sader teach to do
thanks @sader1992
works fine
helped so much

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  54
  • Topics Per Day:  0.01
  • Content Count:  1167
  • Reputation:   159
  • Joined:  06/12/12
  • Last Seen:  

7 hours ago, aoshinho said:

man, it's exactly that what sader teach to do
thanks @sader1992
works fine
helped so much

i want setup different random option for each location, but not limited for some items.

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...