Advertisement
Skorm

rwc_2012 NPC v1.2

Jan 15th, 2014
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.70 KB | None | 0 0
  1. //v 1.2
  2. prontera,147,59,5 script Goldberg#0 878,{
  3. function ordinal_suffix;
  4. function f_itm_menu;
  5. set .npc$, "["+strnpcinfo(1)+"]"; //NPC Name
  6. set .mode, atoi(strnpcinfo(2));
  7.  
  8. if(!.mode) {
  9. mes .npc$;
  10. mes "Hello there!";
  11. mes "I can enchant or remove enchantments";
  12. mes "from your 2012 RWC accessory items!"; next;
  13. } else if(.mode<3) {
  14. mes .npc$;
  15. mes "Hello there!";
  16. mes "I can add a slot to your RWC";
  17. mes "2012 accessory items!";
  18. mes "^FF0000Any enchantments over the first";
  19. mes "slot will be lost in the process!^000000"; next;
  20. } else {
  21. mes .npc$;
  22. mes "Hello there!";
  23. mes "I can slot or enchant your RWC";
  24. mes "2012 accessory items!";
  25. mes "^FF0000Any enchantments over the first";
  26. mes "slot will be lost in the process!^000000"; next;
  27. }
  28. switch(select(((.mode)?"Chamber Accessory"+((.mode>1)?":Enchant:Remove Enchantments":""):"Enchant:Remove Enchantments")+":Cancel")) {
  29. case 1:
  30. if(!.mode) {
  31. mes .npc$;
  32. mes "Which RWC Accessory item would you like to enchant?"; next;
  33. f_itm_menu();
  34. goto L_Slots;
  35. } else {
  36. mes .npc$;
  37. mes "Which RWC Accessory do you want me to slot?"; next;
  38. f_itm_menu();
  39. break;
  40. }
  41. case 2:
  42. if(!.mode) {
  43. mes .npc$;
  44. mes "Select the RWC Accessory you would like me to remove the enchantments from."; next;
  45. f_itm_menu();
  46. goto L_RMV;
  47. } else if (.mode>1) {
  48. mes .npc$;
  49. mes "Which RWC Accessory item would you like to enchant?"; next;
  50. f_itm_menu();
  51. goto L_Slots;
  52. }
  53. case 3:
  54. if (.mode>1) {
  55. mes .npc$;
  56. mes "Select the RWC Accessory you would like me to remove the enchantments from."; next;
  57. f_itm_menu();
  58. goto L_RMV;
  59. }
  60. case 4:
  61. goto L_Exit;
  62. }
  63.  
  64. if(!compare(.slot$,""+@eq_id)) {
  65. mes .npc$;
  66. mes "That item cannot be slotted.";
  67. close;
  68. }
  69. while(.@i++<=4)
  70. setd(".@o_crd"+.@i, getequipcardid(@eq_loc,.@i-1));
  71. mes .npc$;
  72. mes "Are you sure you wish to continue?";
  73. mes "^FF0000There is a "+.pert+"% chance that";
  74. mes "the slotting process will fail and";
  75. mes "your item will break.^000000"; next;
  76. if(select("Yes:No")&2) goto L_Exit;
  77. if(rand(100)>=.pert) {
  78. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  79. getitem2 (@eq_id+1), 1, 1, @eq_rf, 0, 0, .@o_crd2, .@o_crd3, .@o_crd4;
  80. misceffect 101;
  81. sleep2 1300;
  82. misceffect .efet;
  83. mes .npc$;
  84. mes "Perfection!!";
  85. emotion e_no1,0;
  86. equip @eq_id;
  87. } else {
  88. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  89. misceffect 101;
  90. sleep2 1300;
  91. misceffect .afet;
  92. mes .npc$;
  93. mes "The metal was too weak and the drill went right through... I'm Sorry!";
  94. emotion e_sob,0;
  95. }
  96. close;
  97.  
  98. L_Slots:
  99. set .@menu$, ""; set .@a, 0;
  100. while(set(.@a,.@a+1)<=4) {
  101. setd(".@o_crd"+.@a, getequipcardid(@eq_loc,.@a-1));
  102. if(getequipcardid(@eq_loc,.@a-1))
  103. set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [^a92435"+getitemname(getequipcardid(@eq_loc,.@a-1))+"^000000]:";
  104. else if(getitemslots(@eq_id)-.@a>=0)
  105. set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [Chambered]:";
  106. else
  107. set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [^30ad25"+((getd(".@crd"+.@a))?"^800080"+getd(".@typ"+.@a+"$"):"Empty")+"^000000]:";
  108. } set .@menu$, .@menu$+"[^0000FFEnchant!^000000]";
  109.  
  110. mes .npc$;
  111. mes "Select a slot.";
  112. mes "Choose '^0000FFEnchant^000000' when you're done!"; next;
  113. set .@menu, select(.@menu$)-1;
  114. if(getequipcardid(@eq_loc,.@menu)&&getitemslots(@eq_id)-(.@menu+1)<0) {
  115. if(.remv) {
  116. mes .npc$;
  117. mes "Would you like me to remove this enchantment?"; next;
  118. if(select("Yes:No")&2) goto L_Exit;
  119. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  120. setd(".@o_crd"+(.@menu+1), 0);
  121. getitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  122. equip @eq_id;
  123. goto L_Slots;
  124. } else {
  125. mes .npc$;
  126. mes "Sorry I can't do anything with this slot without a "+getitemname(.cure)+"."; next;
  127. goto L_Slots;
  128. }
  129. } else if(getitemslots(@eq_id)-(.@menu+1)>=0) {
  130. mes .npc$;
  131. mes "I cannot do anything with Chambered slots!"; next;
  132. goto L_Slots;
  133. }
  134.  
  135. if((.@menu+1)>4) {
  136. if(!(.@crd1+.@crd2+.@crd3+.@crd4)) {
  137. mes .npc$;
  138. mes "You haven't done anything!";
  139. next;
  140. goto L_Slots;
  141. }
  142. mes .npc$;
  143. mes "Are you sure you wish to continue?";
  144. mes "^FF0000There is a "+.perc+"% chance that";
  145. mes "the enchantment will fail and";
  146. mes "your item will break.^000000"; next;
  147. if(select("Yes:No")&2) goto L_Exit;
  148. if(rand(100)>=.perc) {
  149. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  150. getitem2 @eq_id, 1, 1, @eq_rf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
  151. misceffect 101;
  152. sleep2 1300;
  153. misceffect .efet;
  154. mes .npc$;
  155. mes "Wow, that's one strong item!";
  156. equip @eq_id;
  157. } else {
  158. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  159. misceffect 101;
  160. sleep2 1300;
  161. misceffect .afet;
  162. mes .npc$;
  163. mes "I'm sorry, the item wasn't able to support the enchantment and broke!";
  164. }
  165. close;
  166. }
  167.  
  168. set(.@g$,"");
  169. if(@eq_id!=2966&&.@menu>1&&@eq_id!=2967) {
  170. set(.@g$,"1");
  171. } else if(.@menu>1) set(.@g$,"0");
  172.  
  173. select(getd(".menu"+.@g$+(.@menu+1)+"$"));
  174. set .itm, ((.@menu==1&&@menu>.t_len)?.itm04[rand(getarraysize(.itm04))]:4700+(((@menu-1)*10)+rand(.limi)));
  175. setd(".@crd"+(.@menu+1),getd(".itm"+.@g$+((.@menu>1)?@menu+"["+rand(getarraysize(getd(".itm"+.@g$+@menu)))+"]":"")));
  176. setd(".@typ"+(.@menu+1)+"$",getd(".ary"+.@g$+(.@menu+1)+"$["+(@menu-1)+"]"));
  177. goto L_Slots;
  178.  
  179. L_RMV:
  180. if(!countitem(.cure)) {
  181. mes .npc$;
  182. mes "I'm sorry but you need at least one "+getitemname(.cure)+" before we may continue.";
  183. close;
  184. }
  185. while(.@i++<=4)
  186. setd(".@o_crd"+.@i, getequipcardid(@eq_loc,.@i-1));
  187. if(!((getitemslots(@eq_id)?0:.@o_crd1)+.@o_crd2+.@o_crd3+.@o_crd4)) {
  188. mes .npc$;
  189. mes "There isn't anything I can remove on that accessory.";
  190. close;
  191. }
  192. mes .npc$;
  193. mes "Are you sure that you want to remove your enchantments?";
  194. mes "^FF0000This option won't effect your chambered card slot.^000000"; next;
  195. if(select("Yes:No")&2) goto L_Exit;
  196. misceffect 103;
  197. delitem(.cure,1);
  198. delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
  199. getitem2 @eq_id, 1, 1, @eq_rf, 0, (getitemslots(@eq_id)?.@o_crd1:0), 0, 0, 0;
  200. mes .npc$;
  201. mes "Your enchantments where removed!";
  202. close;
  203.  
  204. L_Exit:
  205. mes .npc$;
  206. mes .message$[rand(getarraysize(.message$))];
  207. close;
  208.  
  209. function ordinal_suffix {
  210. set(.@i,getarg(0));
  211. set(.@j,.@i%10);
  212. if (.@j == 1 && .@i != 11)
  213. return .@i + "st";
  214. if (.@j == 2 && .@i != 12)
  215. return .@i + "nd";
  216. if (.@j == 3 && .@i != 13)
  217. return .@i + "rd";
  218. return .@i + "th";
  219. }
  220.  
  221. function f_itm_menu {
  222. while(set(.@a,.@a+1)<=.e_len) {
  223. if(compare(.e_itl$[.@a-1],""+getequipid(.e_loc[.@a-1])))
  224. set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.e_loc[.@a-1]))+"^000000]:";
  225. else set .@menu$, .@menu$+"^adb4be"+.eqp$[.@a-1]+"- [Empty]^000000:";
  226. }
  227. set @menu, select(.@menu$)-1;
  228. set @eq_loc, .e_loc[@menu];
  229. set @eq_id, getequipid(@eq_loc);
  230. set @eq_rf, getequiprefinerycnt(@eq_loc);
  231.  
  232. if(!compare(.e_itm$,""+@eq_id )) {
  233. mes .npc$;
  234. mes "Sorry I don't recognize that equipment.";
  235. close;
  236. }
  237. } return;
  238.  
  239. //NPC Constants
  240. OnInit:
  241. //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-=
  242. set .perc , 25; //enchantment fail percent
  243. set .pert , 50; //slotting fail percent
  244. set .efet , 154; //Success Effect Number
  245. set .afet , 155; //Fail Effect Number
  246. set .remv , 0; //Allows the NPC to remove enchantments without Item. (1=On/0=Off)
  247. set .cure , 6665; //Item used to remove enchantments
  248. set .limi , 3; //Limit for status orb enchantments.
  249. setarray .message$, //List of random closing messages.
  250. "Maybe next time then.",
  251. "Alright, thanks anyway!",
  252. "Alright maybe next time then.",
  253. "Uhm, ok- See you around then.",
  254. "Wise choice, although you'll probably"+
  255. "never get anywhere with that attitude.";
  256.  
  257. set .slot$, "2966|2968"; //Items that can be slotted.
  258.  
  259. setarray .ary1$, "Strength(STR)", "Intelligence(INT)", "Dexterity(DEX)", "Agility(AGI)", "Vitality(VIT)", "Luck(LUK)";
  260. copyarray .ary2$[0],.ary1$[0],128;
  261. set .t_len, getarraysize(.ary2$);
  262. set .ary2$[.t_len], "Health Points";
  263.  
  264. setarray .ary03$, "Fighting Spirit", "Physical Attack Percent(ATK%)", "Maximum Health Points(MHP%)", "Health Points";
  265. setarray .itm01 , 4811, 4810, 4809; //Fighting Spirit
  266. setarray .itm02 , 4819, 4766, 4767; //ATK(%)
  267. setarray .itm03 , 4861, 4862, 4867; //MHP
  268. setarray .itm04 , 4795, 4796, 4797; //HP
  269. copyarray .ary04$[0],.ary03$[0],128;
  270.  
  271. setarray .ary13$, "Magic Attack Percent(MATK%)", "Casting Rate & Damage(Spell)", "Special Points(SP)";
  272. setarray .itm11 , 4760, 4761, 4806; //MATK(%)
  273. setarray .itm12 , 4815, 4814, 4813; //Spell
  274. setarray .itm13 , 4870, 4800, 4871; //SP
  275. copyarray .ary14$[0],.ary13$[0],128;
  276.  
  277. setarray .eqp$ , "Accessory1", "Accessory2"; //Menu3
  278. set .e_len , getarraysize(.eqp$);
  279. setarray .e_itl$, "2966|2967|2968|2969",
  280. "2966|2967|2968|2969"; //Equip Items
  281. setarray .e_loc , 7, 8; //Equip Locations
  282. set .e_itm$, implode(.e_itl$,",");
  283. set .menu1$, implode(.ary1$,":");
  284. set .menu2$, .menu1$+":"+.ary03$[3];
  285. set .menu03$, implode(.ary03$,":");
  286. set .menu04$, .menu03$;
  287. set .menu13$, implode(.ary13$,":");
  288. set .menu14$, .menu13$;
  289. //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-=
  290. }
  291.  
  292. prontera,147,61,5 duplicate(Goldberg#0) Driller#1 87
  293.  
  294. prontera,147,63,5 duplicate(Goldberg#0) Goldentheifberg#3 87
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement