tuecher.txt 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("entity_click");
  4. event.load("player_loom_finish");
  5. stage = 0;
  6. all_stages = 5;
  7. quest_name = "Tücher";
  8. wool = 0;
  9. wool_tag = item.getTag("minecraft:wool");
  10. loom_list = list.new();
  11. loom_list_2 = list.new();
  12. par = particle.get("minecraft:witch");
  13. loom_coarse = 0;
  14. loom_cloth = 0;
  15. needed_amount = 4;
  16. @wait
  17. wait();
  18. if(event == "player_loom_finish") {
  19. player = getScriptVar("player");
  20. loom_loc = getScriptVar("loom_loc");
  21. entity = getScriptVar("entity");
  22. }
  23. if(event == "living_death") {
  24. player = player.getFromDamageSource(damage_source);
  25. if(player == null) {
  26. goto("wait");
  27. }
  28. }
  29. if(!player.isQuester(player, script)) {
  30. goto("wait");
  31. }
  32. if(event == "quest_term") {
  33. //Hier Code einfügen...
  34. wait(); //Script wird von außen terminiert
  35. }
  36. if(event == "quest_start") {
  37. quest.display(player, quest_name, stage, all_stages);
  38. msg.prefix(player, "§dRolf", "Mh… Hallo. Ich brauche Tücher. Schere doch 8 Schafe, aber zackig!");
  39. player.giveSingleItem(player, read.item("minecraft:shears"), false);
  40. goto("wait");
  41. }
  42. label = concat("stage", text.number(stage));
  43. goto(label);
  44. @stage0
  45. if(event == "entity_click") {
  46. entity_type = entity.getType(entity);
  47. if(entity_type == "sheep") {
  48. if(!sheep.isSheared(entity)) {
  49. item = living.getEquip(player, "hand");
  50. item_type = item.getType(item);
  51. if(item_type == "minecraft:shears") {
  52. wool++;
  53. if(wool == 8) {
  54. stage.increase(player);
  55. }
  56. }
  57. }
  58. }
  59. }
  60. goto("wait");
  61. @stage1
  62. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  63. entity_name = entity.getName(entity);
  64. if(entity_name == "Rolf") {
  65. msg.prefix(player, "§dRolf", "Ich brauch doch keine Wolle, ich will Tücher!");
  66. scheduler.msgPrefix(30, player, concat("§5", player.getName(player)), "Und wie geht das?");
  67. scheduler.msgPrefix(60, player, "§dRolf", "Siehst du den Webstuhl da? Schmeiß 4 Stück Wolle darauf.");
  68. scheduler.msgPrefix(90, player, "§dRolf", "Schaue ihn direkt an und drücke Q (Drop-Taste) um ihn zu benutzen.");
  69. scheduler.msgPrefix(120, player, "§dRolf", "Danach wirfst du 4 Wollstücke und 4 raue Tücher auf den Webstuhl um 4 Tücher herzustellen.");
  70. stage.increase(player);
  71. }
  72. }
  73. goto("wait");
  74. @stage2
  75. @stage3
  76. if(event == "player_loom_finish") {
  77. item = item.entity.get(entity);
  78. if(loom_coarse < 4) {
  79. if(item.getType(item) == "km:coarse_cloth") {
  80. loom_coarse += item.getAmount(item);
  81. if(loom_coarse >= 4) {
  82. stage.increase(player);
  83. msg.prefix(player, "§dRolf", "Stop! Ich will doch nicht noch mehr raue Tücher! Wirf nun jeweils ein Wollstück und ein raues Tuch auf den Webstuhl.");
  84. }
  85. goto("wait");
  86. }
  87. }
  88. if(loom_cloth < 4) {
  89. if(item.getType(item) == "km:cloth") {
  90. loom_cloth += item.getAmount(item);
  91. if(loom_cloth >= 4) {
  92. stage.increase(player);
  93. msg.prefix(player, "§dRolf", "Perfekt. Jetzt gib mir die Tücher.");
  94. }
  95. goto("wait");
  96. }
  97. }
  98. }
  99. goto("wait");
  100. @stage4
  101. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  102. entity_name = entity.getName(entity);
  103. if(entity_name == "Rolf") {
  104. rest_amount = human.giveItem(entity_name, player, "km:cloth", needed_amount);
  105. if(rest_amount == 0) {
  106. msg.prefix(player, "§dRolf", "Vielen Dank!");
  107. money.addBoost(player, 24);
  108. msg(player, "§dQuest abgeschlossen. Belohnung: 24 Snuvis!");
  109. quest.finish(script, player);
  110. } else {
  111. needed_amount = rest_amount;
  112. }
  113. }
  114. }
  115. goto("wait");