mitbringsel.txt 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("entity_click");
  4. event.load("custom_command");
  5. stage = 0;
  6. all_stages = 3;
  7. quest_name = "Mitbringsel";
  8. herb_strong_needed = 10;
  9. herb_shadow_needed = 2;
  10. herb_xp_needed = 1;
  11. herb_sea_needed = 7;
  12. herb_gold_needed = 3;
  13. herb_breathing_needed = 1;
  14. herb_fire_needed = 1;
  15. @wait
  16. wait();
  17. if(event == "living_death") {
  18. player = player.getFromDamageSource(damage_source);
  19. if(player == null) {
  20. goto("wait");
  21. }
  22. }
  23. if(!player.isQuester(player, script)) {
  24. goto("wait");
  25. }
  26. if(event == "quest_term") {
  27. //Hier Code einfügen...
  28. wait(); //Script wird von außen terminiert
  29. }
  30. if(event == "quest_start") {
  31. quest.display(player, quest_name, stage, all_stages);
  32. msg.prefix(player, "§dOlaf", "Du kennst doch meinen Mann, den Kräutermeister Kunibert?");
  33. scheduler.msg(30, player, "§dAntwortmöglichkeiten:");
  34. scheduler.msg(30, player, text.click("[§dA§r] §eJa, den kenne ich.", "/questanswer A"));
  35. scheduler.msg(30, player, text.click("[§dB§r] §eNein, wer ist das?", "/questanswer B"));
  36. goto("wait");
  37. }
  38. label = concat("stage", text.number(stage));
  39. goto(label);
  40. @stage0
  41. if(event == "custom_command" && command == "questanswer") {
  42. option = list.getIndex(args, 0);
  43. if(option == "A") {
  44. stage.increase(player);
  45. msg.prefix(player, "§dOlaf", "Nach meinen langen Reisen bringe ich ihm immer ein kleines Geschenk mit.");
  46. scheduler.msgPrefix(30, player, "§dOlaf", "Da er Kräutermeister ist, habe ich etwas ganz Besonderes für ihn gesammelt.");
  47. scheduler.msgPrefix(60, player, "§dOlaf", "Es wäre nett von dir, wenn du ihm diese Kräuter übergibst!");
  48. scheduler.giveItem(60, player, read.item("km:herb_strong", herb_strong_needed));
  49. scheduler.giveItem(60, player, read.item("km:herb_shadow", herb_shadow_needed));
  50. scheduler.giveItem(60, player, read.item("km:herb_xp", herb_xp_needed));
  51. scheduler.giveItem(60, player, read.item("km:herb_sea", herb_sea_needed));
  52. scheduler.giveItem(60, player, read.item("km:herb_gold", herb_gold_needed));
  53. scheduler.giveItem(60, player, read.item("km:herb_breathing", herb_breathing_needed));
  54. scheduler.giveItem(60, player, read.item("km:herb_fire", herb_fire_needed));
  55. goto("wait");
  56. }
  57. if(option == "B") {
  58. stage.increase(player);
  59. msg.prefix(player, "§dOlaf", "Er wohnt mit mir in einem Haus, gleich vorne im Dorf.");
  60. scheduler.msgPrefix(30, player, "§dOlaf", "Nach meinen langen Reisen bringe ich ihm immer ein kleines Geschenk mit.");
  61. scheduler.msgPrefix(60, player, "§dOlaf", "Da er Kräutermeister ist, habe ich etwas ganz Besonderes für ihn gesammelt.");
  62. scheduler.msgPrefix(90, player, "§dOlaf", "Es wäre nett von dir, wenn du ihm diese Kräuter übergibst!");
  63. scheduler.giveItem(90, player, read.item("km:herb_strong", herb_strong_needed));
  64. scheduler.giveItem(90, player, read.item("km:herb_shadow", herb_shadow_needed));
  65. scheduler.giveItem(90, player, read.item("km:herb_xp", herb_xp_needed));
  66. scheduler.giveItem(90, player, read.item("km:herb_sea", herb_sea_needed));
  67. scheduler.giveItem(90, player, read.item("km:herb_gold", herb_gold_needed));
  68. scheduler.giveItem(90, player, read.item("km:herb_breathing", herb_breathing_needed));
  69. scheduler.giveItem(90, player, read.item("km:herb_fire", herb_fire_needed));
  70. }
  71. }
  72. goto("wait");
  73. @stage1
  74. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  75. entity_name = entity.getName(entity);
  76. if(entity_name == "Kunibert") {
  77. item = living.getEquip(player, "hand");
  78. item_type = item.getType(item);
  79. if(item_type == "km:herb_strong") {
  80. if(herb_strong_needed > 0) {
  81. rest_amount = human.giveItem(entity_name, player, item_type, herb_strong_needed);
  82. if(rest_amount != 0) {
  83. herb_strong_needed = rest_amount;
  84. }
  85. }
  86. }
  87. elseif(item_type == "km:herb_shadow") {
  88. if(herb_shadow_needed > 0) {
  89. rest_amount = human.giveItem(entity_name, player, item_type, herb_shadow_needed);
  90. if(rest_amount != 0) {
  91. herb_shadow_needed = rest_amount;
  92. }
  93. }
  94. }
  95. elseif(item_type == "km:herb_xp") {
  96. if(herb_xp_needed > 0) {
  97. rest_amount = human.giveItem(entity_name, player, item_type, herb_xp_needed);
  98. if(rest_amount != 0) {
  99. herb_xp_needed = rest_amount;
  100. }
  101. }
  102. }
  103. elseif(item_type == "km:herb_sea") {
  104. if(herb_sea_needed > 0) {
  105. rest_amount = human.giveItem(entity_name, player, item_type, herb_sea_needed);
  106. if(rest_amount != 0) {
  107. herb_sea_needed = rest_amount;
  108. }
  109. }
  110. }
  111. elseif(item_type == "km:herb_gold") {
  112. if(herb_gold_needed > 0) {
  113. rest_amount = human.giveItem(entity_name, player, item_type, herb_gold_needed);
  114. if(rest_amount != 0) {
  115. herb_gold_needed = rest_amount;
  116. }
  117. }
  118. }
  119. elseif(item_type == "km:herb_breathing") {
  120. if(herb_breathing_needed > 0) {
  121. rest_amount = human.giveItem(entity_name, player, item_type, herb_breathing_needed);
  122. if(rest_amount != 0) {
  123. herb_breathing_needed = rest_amount;
  124. }
  125. }
  126. }
  127. elseif(item_type == "km:herb_fire") {
  128. if(herb_fire_needed > 0) {
  129. rest_amount = human.giveItem(entity_name, player, item_type, herb_fire_needed);
  130. if(rest_amount != 0) {
  131. herb_fire_needed = rest_amount;
  132. }
  133. }
  134. }
  135. if(herb_strong_needed == 0 && herb_shadow_needed == 0 && herb_xp_needed == 0 && herb_sea_needed == 0 && herb_gold_needed == 0 && herb_breathing_needed == 0 && herb_fire_needed == 0) {
  136. msg.prefix(player, "§dKunibert", "Ahhh.. dich hat der liebe Olaf geschickt! Ach, das ist doch pure Freude, wenn er mir etwas von seinen Reisen mitbringt.");
  137. scheduler.msgPrefix(30, player, "§dKunibert", "Gib ihm doch dies als Dankeschön.");
  138. scheduler.giveItem(30, player, read.item("minecraft:blue_orchid"));
  139. stage.increase(player);
  140. }
  141. }
  142. }
  143. goto("wait");
  144. @stage2
  145. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  146. entity_name = entity.getName(entity);
  147. if(entity_name == "Olaf") {
  148. item = living.getEquip(player, "hand");
  149. item_type = item.getType(item);
  150. if(item_type == "minecraft:air") {
  151. goto("wait");
  152. }
  153. elseif(item_type == "minecraft:blue_orchid") {
  154. player.removeItem(player, read.item(item_type));
  155. msg.prefix(player, "§dOlaf", "Wie lieb von ihm!");
  156. money.addBoost(player, 15);
  157. msg(player, "§dQuest abgeschlossen. Belohnung: 15 Snuvis!");
  158. quest.finish(script, player);
  159. }
  160. }
  161. }
  162. goto("wait");