Advertisement
akbare

Bloody Branch Quest

Nov 6th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. //Made by Lunar
  2. //Version 1.6 - by Lunar
  3. //version 1.6.1 - by Rikimaru
  4. //Fixed some errors,which were shown in the map Server - by Rikimaru
  5. //6.1.09
  6.  
  7. - shop quest_branch2 -1,501:50
  8. prontera,147,166,5 script Quest Shop 899,{
  9. set @i,0;
  10. mes "[Shop Quest NPC]";
  11. mes "Which item do you wish to obtain?";
  12. mes "Select only one.";
  13. callshop "quest_branch2",1;
  14. npcshopattach "quest_branch2";
  15. end;
  16.  
  17. OnBuyItem:
  18. if(.BuildQuest) {
  19. for(set .e,0; !compare(getarg(.e+1)+"", "Zeny"); set .e,.e+2) {}
  20. npcshopadditem "quest_branch2",getarg(.e+2),getarg(.e)*compare(getarg(.e+1),"SZeny");
  21. setarray .Shop[.i],getarg(.e+2);
  22. set .i,.i+1;
  23. goto Quest_Setup;
  24. }
  25. if(.Shop[@i]!=@bought_nameid) for(set @i,1; 1; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set .i,@i; callsub Quest_Setup; }
  26. for(set @i,1; !@e; set @i,@i+1) if(.Shop[@i]==@bought_nameid) { set @e,1; set .i,@i; callsub Quest_Setup; }
  27. mes "[Shop Quest NPC]";
  28. mes "I require the following:";
  29. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) mes "^FF0000" + ((countitem(getarg(@i))>=getarg(@i+1))? "^00FF00":"") + "" + getarg(@i+1) + " " + getitemname(getarg(@i)) + " [" + countitem(getarg(@i)) + "/" + getarg(@i+1) + "]";
  30. if(getarg(@i)) mes "^FF0000" + ((Zeny>=getarg(@i))? "^00FF00":"") + "" + getarg(@i) + " Zeny";
  31. mes "^000000In exchange, I will give you:^0000FF";
  32. for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) mes getarg(@i+1) + " " + getitemname(getarg(@i));
  33. switch(select("Exchange:" + (((((getiteminfo(@bought_nameid,5) & 1) || (getiteminfo(@bought_nameid,5) & 256) || (getiteminfo(@bought_nameid,5) & 512)) && @equip==0))? "Preview Item":"") + ":No thanks")) {
  34. case 1:
  35. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) if(countitem(getarg(@i)) < getarg(@i+1)) {
  36. next;
  37. mes "You have " + countitem(getarg(@i)) + " " + getitemname(getarg(@i)) + ", while I require " + getarg(@i+1) + ".";
  38. mes "Please obtain ^FF0000" + (getarg(@i+1)-countitem(getarg(@i))) + " more " + getitemname(getarg(@i)) + "^000000.";
  39. close;
  40. }
  41. if(Zeny < getarg(@i)) {
  42. next;
  43. mes "You do not have enough Zeny.";
  44. mes "Please obtain ^FF0000" + (getarg(@i)-Zeny) + " more Zeny^000000.";
  45. close;
  46. }
  47. for(set @i,0; !compare(getarg(@i+1),"Zeny"); set @i,@i+2) delitem getarg(@i),getarg(@i+1);
  48. set Zeny,Zeny-getarg(@i);
  49. for(set @i,@i+2; getarg(@i+1,0); set @i,@i+2) getitem getarg(@i),getarg(@i+1);
  50. if (compare(getarg(@i,0),"announce")) announce strcharinfo(0) + " has just obtained " + getitemname(@bought_nameid) + "!",bc_all;
  51. close;
  52. case 2:
  53. set @bottomview, getlook(3);
  54. set @topview, getlook(4);
  55. set @midview, getlook(5);
  56. addtimer 1000, strnpcinfo(3)+"::On_Leave";
  57. set @equip,getiteminfo(@bought_nameid, 5);
  58. set @view, getiteminfo(@bought_nameid, 11);
  59. if(@equip != -1 && @view > 0) {
  60. if(@equip & 1) atcommand "@changelook 3 " + @view;
  61. if(@equip & 256) atcommand "@changelook 1 " + @view;
  62. if(@equip & 512) atcommand "@changelook 2 " + @view;
  63. }
  64. next;
  65. goto OnBuyItem;
  66. case 3:
  67. close;
  68. }
  69. On_Leave:
  70. atcommand "@changelook 1 " + @topview;
  71. atcommand "@changelook 2 " + @midview;
  72. atcommand "@changelook 3 " + @bottomview;
  73. set @equip,0;
  74. set @view,0;
  75. set @topview,0;
  76. set @midview,0;
  77. set @bottomview,0;
  78. end;
  79. OnInit:
  80. npcshopitem "quest_branch2",0,0;
  81. set .BuildQuest,1;
  82. set .i,1;
  83. Quest_Setup:
  84. // THEESE ARE JUST A FEW EXAMPLES;WHICH I MADE,YOU HAVE TO PUT IN YOUR OWN ITEM ID'S HERE!
  85. switch(.i) {
  86. default: set .BuildQuest,0; set .e,0; set .i,0; end;
  87. case 1: callsub OnBuyItem,604,100,100000000,"Zeny",12103,1,"announce";
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement