Advertisement
existence_dev92

Faw Enchant

Aug 5th, 2017
674
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.31 KB | None | 0 0
  1. // https://rathena.org/board/topic/112186-faw-enchant-error-script/
  2. prontera,148,169,3 script Dark Luhir 403,{
  3. disable_items;
  4. mes .@npc_name$ = "[^AA0000Valkyrie^000000]";
  5. mes "I am here to enchant the",
  6. "magnificent ^000099Fallen Angel Wing^000000.",
  7. "Would you like to enchant yours?";
  8. next;
  9. .@menu$ = select("Information:Enchant Fallen Angel Wing:Reset Enchantment");
  10. switch(.@menu$) {
  11. default:
  12. case 1:
  13. break;
  14. case 2:
  15. callsub S_Check;
  16. .@ref = getequiprefinerycnt(EQI_GARMENT);
  17. .@card[0] = getequipcardid(EQI_GARMENT,0);
  18. .@card[1] = getequipcardid(EQI_GARMENT,1);
  19. .@card[2] = getequipcardid(EQI_GARMENT,2);
  20. .@card[3] = getequipcardid(EQI_GARMENT,3);
  21.  
  22. // Check if enchantment slot is full here, do no need to continue if full.
  23. if(.@card[1] && .@card[2] && .@card[3]) {
  24. mes .@npc_name$,
  25. "Hmm.. it seems that all",
  26. "slots have already been enchanted.";
  27. close;
  28. }
  29. if (.@ref >= 7) .@enc_count = 2;
  30. else if (.@ref > 8) .@enc_count = 3;
  31. else
  32. .@enc_count = 1;
  33. mes .@npc_name$;
  34. mes "You have a ^000099+"+.@ref+" Fallen Angel Wing^000000.",
  35. "It can have a total of "+.@enc_count+" enchantment"+(.@enc_count > 1? "s.":".")+" Please";
  36. mes "select your preferred","enchantment.";
  37. next;
  38. .@menu$ = "";
  39. for (.@i = 0; .@i < getarraysize(.enchant_type$); .@i++)
  40. .@menu$ = .@menu$ + .enchant_type$[.@i]+":";
  41. .@type = select(.@menu$);
  42. .@enc_stat = getd(".enc"+.@type+"["+callsub(S_ChanceType, .chance_type, .@card[1], .@card[2], .@card[3])+"]");
  43. if(.enchant_cost) {
  44. if(Zeny < .enchant_cost) {
  45. mes .@npc_name$,
  46. "You don't have enough zeny.";
  47. close;
  48. }
  49. Zeny -= .enchant_cost;
  50. }
  51. if ((.@card[1] && !.@card[2] && (.@ref < 7)) || (.@card[1] && .@card[2] && !.@card[3] && (.@ref < 9))) {
  52. mes .@npc_name$,
  53. "Sorry, but your",
  54. "^000099Fallen Angel Wing^000000's",
  55. "refinement level is too",
  56. "low to continue";
  57. close;
  58. }
  59. delitem2 2589, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], .@card[3];
  60. if(!.@card[1]) .@card[1] = .@enc_stat;
  61. else if(!.@card[2] && .@ref > 6) .@card[2] = .@enc_stat;
  62. else if(!.@card[3] && .@ref > 8) .@card[3] = .@enc_stat;
  63. getitem2 2589, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], .@card[3];
  64. mes .@npc_name$,
  65. "Your ^000099Fallen Angel Wing^000000 has",
  66. "been enchanted with ^000099"+getitemname(.@enc_stat)+"^000000.";
  67. close;
  68. case 3:
  69. callsub S_Check;
  70. mes .@npc_name$,
  71. "This will cost 1x Silvervine Fruit.",
  72. "Are you sure?";
  73. next;
  74. select("Yes");
  75. mes .@npc_name$;
  76. if(countitem(6417) < 1) {
  77. mes "You don't bring enough silvervine Fruit.";
  78. close;
  79. }
  80. delitem 6417,1;
  81. .@ref = getequiprefinerycnt(EQI_GARMENT);
  82. .@card[0] = getequipcardid(EQI_GARMENT,0);
  83. .@card[1] = getequipcardid(EQI_GARMENT,1);
  84. .@card[2] = getequipcardid(EQI_GARMENT,2);
  85. .@card[3] = getequipcardid(EQI_GARMENT,3);
  86. delitem2 2589, 1, 1, .@ref, 0, .@card[0], .@card[1], .@card[2], .@card[3];
  87. getitem2 2589, 1, 1, .@ref, 0, .@card[0], 0, 0, 0;
  88. mes "Your ^000099Fallen Angel Wing^000000's",
  89. "enchantments have been reset.";
  90. equip 2589; // didn't know it will work while npc set disable_items
  91. specialeffect2 261;
  92. specialeffect2 119;
  93. close;
  94. }
  95. mes .@npc_name$,
  96. "I can enchant your",
  97. "^000099Fallen Angel Wing^000000 for",
  98. (.enchant_cost ? callfunc("F_InsertComma",.enchant_cost)+"z":"free")+" to give it various.",
  99. "effects. In fact, I can do it",
  100. "twice if its refinement level is",
  101. "+7 ~ +8, and thrice if its",
  102. "+9 and above.";
  103. next;
  104. mes .@npc_name$,
  105. "The 3rd enchantment has a",
  106. "chance to be more powerful",
  107. "than the first two.";
  108. next;
  109. mes .@npc_name$,
  110. "There is no chance to",
  111. "fail, so enchant away",
  112. "as much as you like.";
  113. next;
  114. mes .@npc_name$,
  115. "But if you're not happy",
  116. "with the results, you can",
  117. "reset the enchantments",
  118. "for ^009900"+callfunc("F_InsertComma",.reset_cost)+"z^000000.";
  119. next;
  120. mes .@npc_name$,
  121. "That's about everything.";
  122. close;
  123.  
  124. S_Check:
  125. if (getequipid(EQI_GARMENT) != 2589) {
  126. mes .@npc_name$;
  127. mes "Please equip your",
  128. "^000099Fallen Angel Wing^000000 if",
  129. "you want to have it enchanted.";
  130. close;
  131. }
  132. return;
  133.  
  134. S_ChanceType:
  135. switch(getarg(0)) {
  136. case 1:
  137. //Decreasing Chance of Enchantment
  138. //60% low, 30% mid, 10% high for 1st & 2nd enchant slot
  139. //40% low, 30% mid, 20% high, 10% special for 3rd enchant slot
  140. .@rand = rand(1,10);
  141. if(getarg(2) && getarg(3)) { //For 3rd & 4th Card Slot aka 2nd & 3rd Enchant Slot
  142. if (.@rand < 5 ) .@x = 0;
  143. else if (.@rand < 7) .@x = 1;
  144. else if (.@rand < 9) .@x = 2;
  145. else .@x = 3;
  146. } else { //For 2nd Card slot aka 1st Enchant Slot
  147. if (.@rand < 7) .@x=0;
  148. else if (.@rand < 10) .@x = 1;
  149. else .@x = 2;
  150. }
  151. return .@x;
  152. case 0:
  153. if(getarg(2) && getarg(3))
  154. return rand(0,3);
  155. else
  156. return rand(0,2);
  157. }
  158.  
  159. OnInit:
  160. setarray .enchant_type$, "Fighting Enchant", "Magic Enchant", "Archer Enchant", "Critical/Fatal Enchant",
  161. "Max HP Enchant", "Max SP Enchant", "ASPD Enchant", "STR Enchant","AGI Enchant",
  162. "DEX Enchant", "VIT Enchant","INT Enchant","LUK Enchant";
  163.  
  164. setarray .enc1[0], 4809,4808,4820, 4821; //Fighting 3~5
  165. setarray .enc2[0], 4812,4826,4827, 4828; //Magic 4~6
  166. setarray .enc3[0], 4832,4833,4834, 4835; //Expert Arc 1~3
  167. setarray .enc4[0], 4863,4864,4865, 4866; //Fatal 1~3
  168. setarray .enc5[0], 4861,4862,4867, 4868; //MHPP 1~3%
  169. setarray .enc6[0], 4870,4800,4871, 4801; //MaxSP 25,50,75
  170. setarray .enc7[0], 4869,4872,4873, 4807; //ASPD 1~3
  171. // setarray .enc7[0], 4869,4872,4873, 4881; //ASPD 1~3
  172. setarray .enc8[0], 4702,4703,4704, 4853; //STR 3~5 | Special Str
  173. setarray .enc9[0], 4731,4732,4733, 4854; //AGI 2~4
  174. setarray .enc10[0], 4722,4723,4724, 4857; //DEX 3~5
  175. setarray .enc11[0], 4742,4743,4744, 4855; //VIT 3~5
  176. setarray .enc12[0], 4712,4713,4714, 4856; //INT 3~5
  177. setarray .enc13[0], 4752,4753,4754, 4858; //LUK 3~5
  178.  
  179. // 1 = 60% low, 30% mid, 10% high for 1st & 2nd enchant slot && 40% low, 30% mid, 20% high, 10% special for 3rd enchant slot
  180. // 0 = Equal Chance
  181. .chance_type = 1;
  182. //Cost for Enchanting. It's free in iRO
  183. .enchant_cost = 6000000;
  184. //Cost to reset | Costs 1Mz in iRO
  185. .reset_cost = 6000000;
  186. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement