Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===== rAthena Script =======================================
- //= Random Option Attribute
- //===== By: ==================================================
- //= pajodex
- //===== Current Version: =====================================
- //= 1.0
- //===== Compatible With: =====================================
- //= rAthena Project (pajodex)
- //===== Description: =========================================
- /*
- Flexible random option attribute NPC.
- Allows you to select which option slot to change/overwrite.
- Flexible service fee which may be set to <item>,<zeny>,or
- <cashpoints>.
- */
- //=====******** Note ********=================================
- //= if you find bugs or problem, please do tell DM me at
- //= Discord (pajodex#1328) or rAthena (pajodex)
- //= open for suggestions
- //===== Additional Comments: =================================
- /*
- 1.0 - Initial release
- 1.1 - Added chances to get rare opts
- */
- //===== Request by: =====================================
- //= Sukea23 via discord
- //=============================================================
- Alyss_in,101,35,4 script Random Op. Enchantment 4_M_JOB_KNIGHT1,{
- function OverwriteCheck ;
- disable_items;
- mes "[ ^FF0000Keough^000000 ]";
- mes "Bienvenido seas ^0099CC"+ strcharinfo(0) +"^000000!";
- mes "Soy un viejo guerrero Aliado de nuestra señora terrania, ^009900Gaia^000000.";
- mes "Seguro te comentaron sobre mis conocimientos en herrería mística.";
- mes "Esto es un arte! Soy el único que puede ^009900agregar barras extra^000000 en tu item, aunque las bonificaciones sea un ^660099RANDOM^000000";
- mes "^660099Option Enchantment^000000, también he logrado adquirir poderes para sobre-escribir el bono por otro ^FF0000RANDOM^000000 si éste no es de tu agrado.";
- if(select("Yes:No") == 2 ) close;
- next;
- mes "[ ^FF0000Keough^000000 ]";
- mes "Por lo que cualquiera de tus equipos serán más poderosos que su condición actual...";
- mes "Mi tarifa de servicio:";
- if(.Option&64) mes getitemname(.item_fee[0])+" x ^ff0000"+ .item_fee[1] +"^000000 pcs.";
- if(.Option&128) mes "Zeny - z^ff0000"+.zeny_fee+"^000000.";
- if(.Option&256) mes "Cash Points - ^ff0000"+.cp_fee+"^000000.";
- mes "Con eso, aplicaré un ^FF0000RANDOM^000000 Option Enchantment en tu equipo.";
- setarray .@pos[1], EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW;
- for(set .@i,1; .@i<getarraysize(.@pos); set .@i,.@i+1){
- if(getequipisequiped(.@pos[.@i])){
- set .@menu$, .@menu$ + F_getpositionname(.@pos[.@i])+" ~ [ " + getequipname(.@pos[.@i]) + " ]";
- set .@equipped,1;
- } set .@menu$, .@menu$+":";
- } set .@part, .@pos[select(.@menu$)];
- OnCheck:
- set .@option, rand(.option_id[0], .option_id[1]);
- .@chance = .chance_rate * 20;
- if( .@chance > rand(0,10000) ) {
- .@rare = 1;
- set .@val, rand(4, 10);
- }
- else
- {
- set .@val, rand(1, 8);
- .@rare = 0;
- }
- for(.@t = 0; .@t < getarraysize(.rare_opt); .@t++ )
- if(.@option == .rare_opt[.@t] && .@rare != 1 )
- goto OnCheck;
- for(.@q = 0; .@q < getarraysize(.disabled_opt); .@q++ )
- if(.@option == .disabled_opt[.@q])
- goto OnCheck;
- OnSlot:
- next;
- mes "[ ^FF0000Keough^000000 ]";
- mes "Qué barra deseas que encante?";
- switch(select((.Option&1) ? "1":"" ,(.Option&2) ? "2":"" ,(.Option&4) ? "3":"" ,(.Option&8) ? "4":"" ,"Nothing")) {
- case 1:
- if(.Option&32 && getequiprandomoption(.@part, 0, ROA_VALUE, getcharid(0)) != 0)
- goto OnError;
- if (getequiprandomoption(.@part, 0, ROA_VALUE, getcharid(0)) != 0)
- OverwriteCheck;
- set .@index, 0;
- goto OnMagic;
- case 2:
- if(.Option&32 && getequiprandomoption(.@part, 1, ROA_VALUE, getcharid(0)) != 0)
- goto OnError;
- if (getequiprandomoption(.@part, 1, ROA_VALUE, getcharid(0)) != 0)
- OverwriteCheck;
- set .@index, 1;
- goto OnMagic;
- case 3:
- if(.Option&32 && getequiprandomoption(.@part, 2, ROA_VALUE, getcharid(0)) != 0)
- goto OnError;
- if (getequiprandomoption(.@part, 2, ROA_VALUE, getcharid(0)) != 0)
- OverwriteCheck;
- set .@index, 2;
- goto OnMagic;
- case 4:
- if(.Option&32 && getequiprandomoption(.@part, 3, ROA_VALUE, getcharid(0)) != 0)
- goto OnError;
- if (getequiprandomoption(.@part, 3, ROA_VALUE, getcharid(0)) != 0)
- OverwriteCheck;
- set .@index, 3;
- goto OnMagic;
- default:
- close;
- }
- OnMagic:
- if(.Option&64) {
- if(countitem(.item_fee[0]) < .item_fee[1]) {
- next;
- mes "No tienes suficiente ^ff0000"+ getitemname(.item_fee[0]) +"^000000 para pagar mis servicios.";
- close;
- }
- else
- delitem .item_fee[0], .item_fee[1];
- }
- if(.Option&128) {
- if(Zeny < .zeny_fee) {
- next;
- mes "You don't have enough Zeny to pay my service.";
- close;
- }
- else
- Zeny = Zeny - .zeny_fee;
- }
- if(.Option&256) {
- if(#CASHPOINTS < .cp_fee) {
- next;
- mes "You don't have enough Cash Points to pay my service.";
- close;
- }
- else
- set #CASHPOINTS, #CASHPOINTS - .cp_fee;
- }
- .@success_rate_formula = .success_rate * 100;
- if( .@success_rate_formula >= rand(0,10000) )
- goto OnSuccess;
- else {
- specialeffect2 611;
- if(.break_item) delequip .@part;
- }
- end;
- OnSuccess:
- specialeffect2 610;
- setrandomoption(.@part,.@index,.@option,.@val,.@index,getcharid(0));
- end;
- OnError:
- next;
- mes "Esta barra ya tiene una Random Option.";
- mes "Lo siento pero no puedo encantar esto nunca más...";
- close;
- OnInit:
- // ================================= SETIINGS ==============================================
- // Bitwise Variables
- // 1 = enable 1st option slot select
- // 2 = enable 2nd option slot select
- // 4 = enable 3rd option slot select
- // 8 = enable 4th option slot select
- // 16 = enable item break upon fail
- // 32 = disable option over write
- // 64 = enable use of <ITEM> as fee
- // 128 = enable use of Zeny as fee
- // 256 = enable use of #CASHPOINTS as fee
- .Option = 1|2|64;
- // Item Fee <ID>,<AMOUNT>
- setarray .item_fee, 31583, 1;
- // Zeny Fee
- .zeny_fee = 10000;
- // #CASHPOINTS Fee
- .cp_fee = 100;
- // Success rate
- .success_rate = 40;
- // Chance rate to get rare Option Attribute
- .chance_rate = 2;
- // option value <Min>, <Max> (default: 1 - 10)
- setarray .val, 1, 10;
- // option ID <Min>, <Max>
- // for the option ID list, see your "master/db/const.txt"
- setarray .option_id, 1, 192;
- // List of rare option ID
- setarray .rare_opt,
- 1, // RDMOPT_VAR_MAXHPAMOUNT
- 2, // RDMOPT_VAR_MAXSPAMOUNT
- 3, // RDMOPT_VAR_STRAMOUNT
- 4, // RDMOPT_VAR_AGIAMOUNT
- 5, // RDMOPT_VAR_VITAMOUNT
- 6, // RDMOPT_VAR_INTAMOUNT
- 7, // RDMOPT_VAR_DEXAMOUNT
- 8, // RDMOPT_VAR_LUKAMOUNT
- 9, // RDMOPT_VAR_MAXHPPERCENT
- 10, // RDMOPT_VAR_MAXSPPERCENT
- 12, // RDMOPT_VAR_ATKPERCENT
- 14, // RDMOPT_VAR_MAGICATKPERCENT
- 17, // RDMOPT_VAR_ATTPOWER
- 104, // RDMOPT_RACE_DAMAGE_HUMAN
- 114, // RDMOPT_RACE_MDAMAGE_HUMAN
- 166, // RDMOPT_RANGE_ATTACK_DAMAGE_TARGET
- 167, // RDMOPT_RANGE_ATTACK_DAMAGE_USER
- 163; // RDMOPT_DAMAGE_SIZE_PERFECT
- // list of option ID to disable upon enchantment
- setarray .disabled_opt,
- 23, // RDMOPT_VAR_PLUSAVOIDSUCCESSVALUE
- 35, // RDMOPT_ATTR_TOLERACE_ALL
- 76, // RDMOPT_BODY_ATTR_NOTHING
- 77, // RDMOPT_BODY_ATTR_WATER
- 78, // RDMOPT_BODY_ATTR_GROUND
- 79, // RDMOPT_BODY_ATTR_FIRE
- 80, // RDMOPT_BODY_ATTR_WIND
- 81, // RDMOPT_BODY_ATTR_POISON
- 82, // RDMOPT_BODY_ATTR_SAINT
- 83, // RDMOPT_BODY_ATTR_DARKNESS
- 84, // RDMOPT_BODY_ATTR_TELEKINESIS
- 85, // RDMOPT_BODY_ATTR_UNDEAD
- 175, // RDMOPT_WEAPON_ATTR_NOTHING
- 176, // RDMOPT_WEAPON_ATTR_WATER
- 177, // RDMOPT_WEAPON_ATTR_GROUND
- 178, // RDMOPT_WEAPON_ATTR_FIRE
- 179, // RDMOPT_WEAPON_ATTR_WIND
- 180, // RDMOPT_WEAPON_ATTR_POISON
- 181, // RDMOPT_WEAPON_ATTR_SAINT
- 182, // RDMOPT_WEAPON_ATTR_DARKNESS
- 183, // RDMOPT_WEAPON_ATTR_TELEKINESIS
- 184; // RDMOPT_WEAPON_ATTR_UNDEAD
- end;
- function OverwriteCheck {
- next;
- mes "[ ^FF0000Keough^000000 ]";
- mes "Esta ranura ya tiene una opción.";
- mes "De verdad quieres sobre-escribirla?";
- if(select("Yes:No") == 2) goto OnSlot;
- return .@part;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment