neue_hose.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("entity_click");
  4. event.load("player_loom_finish");
  5. event.load("item_air_click");
  6. stage = 0;
  7. all_stages = 7;
  8. quest_name = "Neue Hose";
  9. spruce_amount = 5;
  10. cloth_amount = 7;
  11. loom_coarse = 0;
  12. loom_cloth = 0;
  13. @wait
  14. wait();
  15. if(event == "player_loom_finish") {
  16. player = getScriptVar("player");
  17. loom_loc = getScriptVar("loom_loc");
  18. entity = getScriptVar("entity");
  19. }
  20. if(event == "living_death") {
  21. player = player.getFromDamageSource(damage_source);
  22. if(player == null) {
  23. goto("wait");
  24. }
  25. }
  26. if(!player.isQuester(player, script)) {
  27. goto("wait");
  28. }
  29. if(event == "quest_term") {
  30. //Hier Code einfügen...
  31. wait(); //Script wird von außen terminiert
  32. }
  33. if(event == "quest_start") {
  34. quest.display(player, quest_name, stage, all_stages);
  35. msg.prefix(player, "§dPeter", "Hallöle! Meine Hose ist gerissen… so kann ich das Haus nicht verlassen.");
  36. scheduler.msgPrefix(30, player, "§dPeter", "Ich bräuchte dringend eine neue Hose.");
  37. scheduler.msgPrefix(60, player, "§dPeter", "Schau doch bei Rolf, dem Weber, vorbei und besorg mir 7 Tücher.");
  38. goto("wait");
  39. }
  40. label = concat("stage", text.number(stage));
  41. goto(label);
  42. @stage0
  43. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  44. entity_name = entity.getName(entity);
  45. if(entity_name == "Rolf") {
  46. msg.prefix(player, "§dRolf", "Was gibt’s?");
  47. scheduler.msgPrefix(30, player, concat("§d", player.getName(player)), "Ich bräuchte 7 Tücher.");
  48. scheduler.msgPrefix(60, player, "§dRolf", "Du weißt, was zu tun ist. Sammle 14 Wolle. Gib die Häfte auf den Webstuhl und erhalte raue Tücher. Diese gibst du gemeinsam mit der restlichen Wolle wieder auf den Webstuhl, um Tücher zu erhalten.");
  49. scheduler.giveSingleItem(60, player, read.item("minecraft:shears"), false);
  50. stage.increase(player);
  51. }
  52. }
  53. goto("wait");
  54. @stage1
  55. @stage2
  56. if(event == "player_loom_finish") {
  57. item = item.entity.get(entity);
  58. if(loom_coarse < 7) {
  59. if(item.getType(item) == "km:coarse_cloth") {
  60. loom_coarse += item.getAmount(item);
  61. if(loom_coarse >= 7) {
  62. stage.increase(player);
  63. }
  64. goto("wait");
  65. }
  66. }
  67. if(loom_cloth < 7) {
  68. if(item.getType(item) == "km:cloth") {
  69. loom_cloth += item.getAmount(item);
  70. if(loom_cloth >= 7) {
  71. stage.increase(player);
  72. }
  73. goto("wait");
  74. }
  75. }
  76. }
  77. goto("wait");
  78. @stage3
  79. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  80. entity_name = entity.getName(entity);
  81. if(entity_name == "Peter") {
  82. msg.prefix(player, "§dPeter", "Danke dir! Das ist zwar noch keine Hose, aber ich kenne da jemanden. Seppel ist Meister im Nähen! Wenn du ihm das hier von mir übergibst, wird er sicher eine Hose für mich beschaffen.");
  83. player.safeGiveItem(player, read.item("minecraft:spruce_planks", spruce_amount));
  84. stage.increase(player);
  85. }
  86. }
  87. goto("wait");
  88. @stage4
  89. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  90. entity_name = entity.getName(entity);
  91. if(entity_name == "Seppel") {
  92. rest_amount = human.giveItem(entity_name, player, "minecraft:spruce_planks", spruce_amount);
  93. if(rest_amount == 0) {
  94. stage.increase(player);
  95. msg.prefix(player, "§dSeppel", "Ach, dich schickt der Peter! Das Holz kommt genau zum richtigen Zeitpunkt. Was möchte er denn?");
  96. scheduler.msgPrefix(30, player, concat("§d", player.getName(player)), "Er braucht eine neue Hose, die Tücher habe ich schon dabei.");
  97. scheduler.msgPrefix(60, player, "§dSeppel", "Das ist kein Problem. Gib mir die Tücher und dann warte einen Moment bitte.");
  98. } else {
  99. spruce_amount = rest_amount;
  100. }
  101. }
  102. }
  103. goto("wait");
  104. @stage5
  105. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  106. entity_name = entity.getName(entity);
  107. if(entity_name == "Seppel") {
  108. rest_amount = human.giveItem(entity_name, player, "km:cloth", cloth_amount);
  109. if(rest_amount == 0) {
  110. waitfor(60);
  111. msg.prefix(player, "§dSeppel", "Danke fürs Warten.");
  112. player.safeGiveItem(player, read.item("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:3949738}}}"));
  113. stage.increase(player);
  114. } else {
  115. cloth_amount = rest_amount;
  116. }
  117. }
  118. }
  119. goto("wait");
  120. @stage6
  121. if(event == "item_air_click") {
  122. item = living.getEquip(player, "hand");
  123. item_type = item.getType(item);
  124. if(item_type == "minecraft:leather_leggings") {
  125. cancel = true;
  126. inv.update(player);
  127. }
  128. goto("wait");
  129. }
  130. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  131. entity_name = entity.getName(entity);
  132. if(entity_name == "Peter") {
  133. rest_amount = human.giveItem(entity_name, player, "minecraft:leather_leggings", 1);
  134. if(rest_amount == 0) {
  135. inv.update(player);
  136. msg.prefix(player, "§dPeter", "Vielen Dank!");
  137. money.addBoost(player, 30);
  138. msg(player, "§dQuest abgeschlossen. Belohnung: 30 Snuvis!");
  139. quest.finish(script, player);
  140. }
  141. }
  142. }
  143. goto("wait");