Jump to content

sader1992

Content Moderator
  • Posts

    1691
  • Joined

  • Last visited

  • Days Won

    78

Posts posted by sader1992

  1. 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
  2. 2 hours ago, OscarScorp said:

    Thanks! The script doesn't throw an error anymore and the process can be completed, except, what I'm looking for is enchant a Forged weapon.
    Tried with regular Dagger and it can enchant up to 4 times. Tried with a "Very Strong" Dagger and no bonus is added.

    The item's data are saved in the card slots , that's why runes + custom data(like names etc) cannot coexist

  3. On 9/7/2021 at 11:22 AM, OscarScorp said:

    Finally got the opportunity to try this script but, I get this issue when attempting to enchant (image attached).

    Any idea on what's the problem?
    Thanks in advance!

    help.png

    try this , I am not sure why you are getting this error , however this will use item2 if there is no options found

     

    sader_s_enchant.txt

  4. 	//for map
    	//cutin2(<"map">,"<filename>",<position>);
    	function	cutin2	{
    		freeloop(true);
    		.@map$ = getarg(0);
    		.@filename$ = getarg(1);
    		.@position = getarg(2);
    		.@s = getmapunits(BL_PC,.@map$,.@SD);
    		for(.@i=0;.@i<.@s;.@i++){
    			if((.@cid = convertpcinfo(.@SD[.@i],CPC_CHAR)))
    				cutin(.@filename$,.@position,.@cid);
    		}
    		return;
    	}
    	
    	//whole server
    	//cutin3("<filename>",<position>);
    	function	cutin3	{
    		freeloop(true);
    		.@filename$ = getarg(0);
    		.@position = getarg(1);
    		.@s = getunits(BL_PC,.@SD);
    		for(.@i=0;.@i<.@s;.@i++){
    			if((.@cid = convertpcinfo(.@SD[.@i],CPC_CHAR)))
    				cutin(.@filename$,.@position,.@cid);
    		}
    		return;
    	}

     

    • MVP 1
  5. to save time and replies

    here is a step-by-step

    rathena/src/map/script.cpp

    search for

    BUILDIN_FUNC(cutin)
    {
    	TBL_PC* sd;
    
    	if( !script_rid2sd(sd) )
    		return SCRIPT_CMD_SUCCESS;
    
    	clif_cutin(sd,script_getstr(st,2),script_getnum(st,3));
    	return SCRIPT_CMD_SUCCESS;
    }

    replace

    if( !script_rid2sd(sd) )

    with

    if (!script_charid2sd(4, sd))

     

    search and replace this

    BUILDIN_DEF(cutin,"si"),

    with

    BUILDIN_DEF(cutin,"si?"),

    DON'T FORGET TO RECOMPILE YOUR SERVER!

     

    and this is an example on how i would have done it

    prontera,0,0,0	script	gdfjfhadh	444,{
    	function cutin2;
    	announce("test 1",BC_ALL);
    	cutin2("prontera","pc.bmp",2);
    	sleep 3000;
    	announce("test 2",BC_ALL);
    	cutin2("prontera","",255);
    	sleep 3000;
    	announce("test 3",BC_ALL);
    	cutin2("prontera","pc.bmp",2);
    	sleep 3000;
    	announce("test 4",BC_ALL);
    	cutin2("prontera","",255);
    end;
    
    	function	cutin2	{
    		freeloop(true);
    		.@map$ = getarg(0);
    		.@filename$ = getarg(1);
    		.@position = getarg(2);
    		.@s = getmapunits(BL_PC,.@map$,.@SD);
    		for(.@i=0;.@i<.@s;.@i++){
    			cutin(.@filename$,.@position,convertpcinfo(.@SD[.@i],CPC_CHAR));
    		}
    		return;
    	}
    }

     

    • MVP 1
  6. you can edit the cutin command script to accept char id at the end , and get the users list from the map using getmapunits and send the cutin in a for loop instead of attaching the players

    you can use this for reference on how to do it https://github.com/rathena/rathena/pull/4143/files

    if i am planing to do what you want to do , i would have done this from the start , because it's better to not attach a player when you can if it's a group of players

  7. The code syntax that you provided is wrong

    getmapflag("<map name>",<flag>) || getmapflag("<map name>",<flag>) || getmapflag("<map name>",<flag>)

    not

    getmapflag("<map name>",<flag> || getmapflag("<map name>",<flag> || getmapflag("<map name>",<flag>)))

     

    • Upvote 1
  8. On 7/1/2021 at 6:11 AM, lLoydxx said:

    my iteminfo.lub is almost 12mb, how could I find an iteminfo with the new BRO visuals to add to my server?

     

    Or how to fix mine, please help me I need the new looks.

    search for the item id.

    • Upvote 1
  9. function	script	my_global_func	{
    	mes "this message from 'my_global_func' function from out the npc";
    	return;
    }
    
    prontera,0,0,0	script	func_test	444,{
    	function my_func;
    	
    	my_func();
    	next;
    	my_global_func();
    	next;
    	callfunc("my_other_global_func");
    end;
    
    	function	my_func	{
    		mes "this message from 'my_func' function from inside the npc";
    		return;
    	}
    }
    
    function	script	my_other_global_func	{
    	mes "this message from 'my_other_global_func' function from out the npc";
    	return;
    }

     

    • Upvote 1
  10. set .item_id, 12903; // next item id to shower

    to

    set .item_id1, 12903; // next item id to shower

    and

    .@var = rand(2);
    makeitem .@var?.item_id:.item_id2,1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

    to

    makeitem getd(".item_id" + rand(1,8)),1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this

     

     

    And this is a better way to do your script

    -	script	Sample	-1,{
    OnInit:
    	set .amount, 10; // amount of item to shower
    	setarray .ItemID,12903,12904,12905,12906,12907,12908,13576,13584;
    	.Size = getarraysize(.ItemID);
    
    	bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";
    end;
    
    OnShower:
    	getmapxy(.@map$, .@x, .@y, BL_PC);
    	while ( .count < .amount ) {
    		do {
    			.@x_diff = .@x + rand(1,5);
    			.@y_diff = .@y + rand(1,5);
    		} while (!checkcell(.@map$,.@x_diff,.@y_diff,cell_chkpass));
    		makeitem .ItemID[rand(.Size)],1,.@map$,.@x_diff,.@y_diff;   // <<< im stuck on this
    		set .count, .count + 1;
    	}
    	set .count, 0;
    end;
    }

     

     

    btw "bindatcmd "itemshower",strnpcinfo(3)+"::OnShower";" means any player can use the command

×
×
  • Create New...