Guest User

Untitled

a guest
Jul 6th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.09 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Random Option Attribute
  3. //===== By: ==================================================
  4. //= pajodex
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena Project (pajodex)
  9. //===== Description: =========================================
  10. /*
  11.  
  12. Flexible random option attribute NPC.
  13. Allows you to select which option slot to change/overwrite.
  14. Flexible service fee which may be set to <item>,<zeny>,or
  15. <cashpoints>.
  16.  
  17. */
  18. //=====******** Note ********=================================
  19. //= if you find bugs or problem, please do tell DM me at
  20. //= Discord (pajodex#1328) or rAthena (pajodex)
  21. //= open for suggestions
  22. //===== Additional Comments: =================================
  23. /*
  24. 1.0 - Initial release
  25. 1.1 - Added chances to get rare opts
  26. */
  27. //===== Request by: =====================================
  28. //= Sukea23 via discord
  29. //=============================================================
  30.  
  31. Alyss_in,101,35,4 script Random Op. Enchantment 4_M_JOB_KNIGHT1,{
  32. function OverwriteCheck ;
  33. disable_items;
  34. mes "[ ^FF0000Keough^000000 ]";
  35. mes "Bienvenido seas ^0099CC"+ strcharinfo(0) +"^000000!";
  36. mes "Soy un viejo guerrero Aliado de nuestra señora terrania, ^009900Gaia^000000.";
  37. mes "Seguro te comentaron sobre mis conocimientos en herrería mística.";
  38. mes "Esto es un arte! Soy el único que puede ^009900agregar barras extra^000000 en tu item, aunque las bonificaciones sea un ^660099RANDOM^000000";
  39. 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.";
  40. if(select("Yes:No") == 2 ) close;
  41. next;
  42. mes "[ ^FF0000Keough^000000 ]";
  43. mes "Por lo que cualquiera de tus equipos serán más poderosos que su condición actual...";
  44. mes "Mi tarifa de servicio:";
  45. if(.Option&64) mes getitemname(.item_fee[0])+" x ^ff0000"+ .item_fee[1] +"^000000 pcs.";
  46. if(.Option&128) mes "Zeny - z^ff0000"+.zeny_fee+"^000000.";
  47. if(.Option&256) mes "Cash Points - ^ff0000"+.cp_fee+"^000000.";
  48. mes "Con eso, aplicaré un ^FF0000RANDOM^000000 Option Enchantment en tu equipo.";
  49.  
  50. 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;
  51. for(set .@i,1; .@i<getarraysize(.@pos); set .@i,.@i+1){
  52. if(getequipisequiped(.@pos[.@i])){
  53. set .@menu$, .@menu$ + F_getpositionname(.@pos[.@i])+" ~ [ " + getequipname(.@pos[.@i]) + " ]";
  54. set .@equipped,1;
  55. } set .@menu$, .@menu$+":";
  56. } set .@part, .@pos[select(.@menu$)];
  57.  
  58. OnCheck:
  59. set .@option, rand(.option_id[0], .option_id[1]);
  60. .@chance = .chance_rate * 20;
  61. if( .@chance > rand(0,10000) ) {
  62. .@rare = 1;
  63. set .@val, rand(4, 10);
  64. }
  65. else
  66. {
  67. set .@val, rand(1, 8);
  68. .@rare = 0;
  69. }
  70.  
  71.  
  72. for(.@t = 0; .@t < getarraysize(.rare_opt); .@t++ )
  73. if(.@option == .rare_opt[.@t] && .@rare != 1 )
  74. goto OnCheck;
  75.  
  76. for(.@q = 0; .@q < getarraysize(.disabled_opt); .@q++ )
  77. if(.@option == .disabled_opt[.@q])
  78. goto OnCheck;
  79.  
  80. OnSlot:
  81. next;
  82. mes "[ ^FF0000Keough^000000 ]";
  83. mes "Qué barra deseas que encante?";
  84. switch(select((.Option&1) ? "1":"" ,(.Option&2) ? "2":"" ,(.Option&4) ? "3":"" ,(.Option&8) ? "4":"" ,"Nothing")) {
  85. case 1:
  86. if(.Option&32 && getequiprandomoption(.@part, 0, ROA_VALUE, getcharid(0)) != 0)
  87. goto OnError;
  88. if (getequiprandomoption(.@part, 0, ROA_VALUE, getcharid(0)) != 0)
  89. OverwriteCheck;
  90. set .@index, 0;
  91. goto OnMagic;
  92. case 2:
  93. if(.Option&32 && getequiprandomoption(.@part, 1, ROA_VALUE, getcharid(0)) != 0)
  94. goto OnError;
  95. if (getequiprandomoption(.@part, 1, ROA_VALUE, getcharid(0)) != 0)
  96. OverwriteCheck;
  97. set .@index, 1;
  98. goto OnMagic;
  99. case 3:
  100. if(.Option&32 && getequiprandomoption(.@part, 2, ROA_VALUE, getcharid(0)) != 0)
  101. goto OnError;
  102. if (getequiprandomoption(.@part, 2, ROA_VALUE, getcharid(0)) != 0)
  103. OverwriteCheck;
  104. set .@index, 2;
  105. goto OnMagic;
  106. case 4:
  107. if(.Option&32 && getequiprandomoption(.@part, 3, ROA_VALUE, getcharid(0)) != 0)
  108. goto OnError;
  109. if (getequiprandomoption(.@part, 3, ROA_VALUE, getcharid(0)) != 0)
  110. OverwriteCheck;
  111. set .@index, 3;
  112. goto OnMagic;
  113. default:
  114. close;
  115. }
  116.  
  117. OnMagic:
  118. if(.Option&64) {
  119. if(countitem(.item_fee[0]) < .item_fee[1]) {
  120. next;
  121. mes "No tienes suficiente ^ff0000"+ getitemname(.item_fee[0]) +"^000000 para pagar mis servicios.";
  122. close;
  123. }
  124. else
  125. delitem .item_fee[0], .item_fee[1];
  126. }
  127. if(.Option&128) {
  128. if(Zeny < .zeny_fee) {
  129. next;
  130. mes "You don't have enough Zeny to pay my service.";
  131. close;
  132. }
  133. else
  134. Zeny = Zeny - .zeny_fee;
  135.  
  136. }
  137. if(.Option&256) {
  138. if(#CASHPOINTS < .cp_fee) {
  139. next;
  140. mes "You don't have enough Cash Points to pay my service.";
  141. close;
  142. }
  143. else
  144. set #CASHPOINTS, #CASHPOINTS - .cp_fee;
  145. }
  146. .@success_rate_formula = .success_rate * 100;
  147. if( .@success_rate_formula >= rand(0,10000) )
  148. goto OnSuccess;
  149. else {
  150. specialeffect2 611;
  151. if(.break_item) delequip .@part;
  152. }
  153. end;
  154.  
  155. OnSuccess:
  156. specialeffect2 610;
  157. setrandomoption(.@part,.@index,.@option,.@val,.@index,getcharid(0));
  158. end;
  159.  
  160. OnError:
  161. next;
  162. mes "Esta barra ya tiene una Random Option.";
  163. mes "Lo siento pero no puedo encantar esto nunca más...";
  164. close;
  165.  
  166. OnInit:
  167. // ================================= SETIINGS ==============================================
  168. // Bitwise Variables
  169. // 1 = enable 1st option slot select
  170. // 2 = enable 2nd option slot select
  171. // 4 = enable 3rd option slot select
  172. // 8 = enable 4th option slot select
  173. // 16 = enable item break upon fail
  174. // 32 = disable option over write
  175. // 64 = enable use of <ITEM> as fee
  176. // 128 = enable use of Zeny as fee
  177. // 256 = enable use of #CASHPOINTS as fee
  178. .Option = 1|2|64;
  179.  
  180. // Item Fee <ID>,<AMOUNT>
  181. setarray .item_fee, 31583, 1;
  182.  
  183. // Zeny Fee
  184. .zeny_fee = 10000;
  185.  
  186. // #CASHPOINTS Fee
  187. .cp_fee = 100;
  188.  
  189. // Success rate
  190. .success_rate = 40;
  191.  
  192. // Chance rate to get rare Option Attribute
  193. .chance_rate = 2;
  194.  
  195. // option value <Min>, <Max> (default: 1 - 10)
  196. setarray .val, 1, 10;
  197.  
  198. // option ID <Min>, <Max>
  199. // for the option ID list, see your "master/db/const.txt"
  200. setarray .option_id, 1, 192;
  201.  
  202. // List of rare option ID
  203. setarray .rare_opt,
  204. 1, // RDMOPT_VAR_MAXHPAMOUNT
  205. 2, // RDMOPT_VAR_MAXSPAMOUNT
  206. 3, // RDMOPT_VAR_STRAMOUNT
  207. 4, // RDMOPT_VAR_AGIAMOUNT
  208. 5, // RDMOPT_VAR_VITAMOUNT
  209. 6, // RDMOPT_VAR_INTAMOUNT
  210. 7, // RDMOPT_VAR_DEXAMOUNT
  211. 8, // RDMOPT_VAR_LUKAMOUNT
  212. 9, // RDMOPT_VAR_MAXHPPERCENT
  213. 10, // RDMOPT_VAR_MAXSPPERCENT
  214. 12, // RDMOPT_VAR_ATKPERCENT
  215. 14, // RDMOPT_VAR_MAGICATKPERCENT
  216. 17, // RDMOPT_VAR_ATTPOWER
  217. 104, // RDMOPT_RACE_DAMAGE_HUMAN
  218. 114, // RDMOPT_RACE_MDAMAGE_HUMAN
  219. 166, // RDMOPT_RANGE_ATTACK_DAMAGE_TARGET
  220. 167, // RDMOPT_RANGE_ATTACK_DAMAGE_USER
  221. 163; // RDMOPT_DAMAGE_SIZE_PERFECT
  222.  
  223. // list of option ID to disable upon enchantment
  224. setarray .disabled_opt,
  225. 23, // RDMOPT_VAR_PLUSAVOIDSUCCESSVALUE
  226. 35, // RDMOPT_ATTR_TOLERACE_ALL
  227. 76, // RDMOPT_BODY_ATTR_NOTHING
  228. 77, // RDMOPT_BODY_ATTR_WATER
  229. 78, // RDMOPT_BODY_ATTR_GROUND
  230. 79, // RDMOPT_BODY_ATTR_FIRE
  231. 80, // RDMOPT_BODY_ATTR_WIND
  232. 81, // RDMOPT_BODY_ATTR_POISON
  233. 82, // RDMOPT_BODY_ATTR_SAINT
  234. 83, // RDMOPT_BODY_ATTR_DARKNESS
  235. 84, // RDMOPT_BODY_ATTR_TELEKINESIS
  236. 85, // RDMOPT_BODY_ATTR_UNDEAD
  237. 175, // RDMOPT_WEAPON_ATTR_NOTHING
  238. 176, // RDMOPT_WEAPON_ATTR_WATER
  239. 177, // RDMOPT_WEAPON_ATTR_GROUND
  240. 178, // RDMOPT_WEAPON_ATTR_FIRE
  241. 179, // RDMOPT_WEAPON_ATTR_WIND
  242. 180, // RDMOPT_WEAPON_ATTR_POISON
  243. 181, // RDMOPT_WEAPON_ATTR_SAINT
  244. 182, // RDMOPT_WEAPON_ATTR_DARKNESS
  245. 183, // RDMOPT_WEAPON_ATTR_TELEKINESIS
  246. 184; // RDMOPT_WEAPON_ATTR_UNDEAD
  247.  
  248. end;
  249.  
  250. function OverwriteCheck {
  251. next;
  252. mes "[ ^FF0000Keough^000000 ]";
  253. mes "Esta ranura ya tiene una opción.";
  254. mes "De verdad quieres sobre-escribirla?";
  255. if(select("Yes:No") == 2) goto OnSlot;
  256. return .@part;
  257. }
  258. }
Advertisement
Add Comment
Please, Sign In to add comment