erntezeit.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_drop");
  4. event.load("block_break");
  5. event.load("entity_click");
  6. stage = 0;
  7. all_stages = 3;
  8. quest_name = "Erntezeit";
  9. wheat_needed = 64;
  10. carrots_needed = 10;
  11. wheat_harvestet = 0;
  12. carrots_harvestet = 0;
  13. @wait
  14. wait();
  15. if(event == "block_drop") {
  16. if(!isPlayer(entity)) {
  17. goto("wait");
  18. }
  19. player = entity;
  20. }
  21. if(event == "living_death") {
  22. player = player.getFromDamageSource(damage_source);
  23. if(player == null) {
  24. goto("wait");
  25. }
  26. }
  27. if(!player.isQuester(player, script)) {
  28. goto("wait");
  29. }
  30. if(event == "quest_term") {
  31. //Hier Code einfügen...
  32. wait(); //Script wird von außen terminiert
  33. }
  34. if(event == "quest_start") {
  35. quest.display(player, quest_name, stage, all_stages);
  36. msg.prefix(player, "§dBauer", "Gut, dass du vorbeischaust. Hilf mir doch bei der Ernte und hole mir 64 Weizen vom Feld.");
  37. scheduler.msgPrefix(30, player, "§dBauer", "Wenn du damit fertig bist, bräuchte ich noch 10 Karotten. Diese solltest du auf dem offenen Felde hinter der Mühle finden.");
  38. goto("wait");
  39. }
  40. label = concat("stage", text.number(stage));
  41. goto(label);
  42. @stage0
  43. @stage1
  44. @stage2
  45. if(event == "block_drop") {
  46. if(block_type == "km:rwheat") {
  47. list.clear(drops);
  48. list.add(drops, read.item("minecraft:wheat"));
  49. }
  50. goto("wait");
  51. }
  52. if(event == "block_break") {
  53. if(block_type == "km:rwheat") {
  54. cancel = false;
  55. scheduler.setBlock(60, block_loc, "km:rwheat[age=7]", false);
  56. wheat_harvestet++;
  57. if(t == wheat_needed) {
  58. stage.increase(player);
  59. }
  60. }
  61. if(block_type == "km:rcarrots") {
  62. item.drop(block_loc, read.item("minecraft:carrot"));
  63. cancel = true;
  64. carrots_harvestet++;
  65. if(carrots_harvestet == carrots_needed) {
  66. stage.increase(player);
  67. }
  68. }
  69. goto("wait");
  70. }
  71. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  72. entity_name = entity.getName(entity);
  73. if(entity_name == "Bauer") {
  74. item = living.getEquip(player, "hand");
  75. item_type = item.getType(item);
  76. if(item_type == "minecraft:wheat") {
  77. if(wheat_needed > 0) {
  78. rest_amount = human.giveItem(entity_name, player, item_type, wheat_needed);
  79. if(rest_amount == 0) {
  80. msg.prefix(player, "§dBauer", "Danke für das Weizen.");
  81. }
  82. wheat_needed = rest_amount;
  83. }
  84. }
  85. if(item_type == "minecraft:carrot") {
  86. if(carrots_needed > 0) {
  87. rest_amount = human.giveItem(entity_name, player, item_type, carrots_needed);
  88. if(rest_amount == 0) {
  89. msg.prefix(player, "§dBauer", "Danke für die Karotten.");
  90. }
  91. carrots_needed = rest_amount;
  92. }
  93. }
  94. if(wheat_needed == 0 && carrots_needed == 0) {
  95. msg.prefix(player, "§dBauer", "Vielen Dank für deine Hilfe!");
  96. msg(player, "§dQuest abgeschlossen. Belohnung: 18 Snuvis!");
  97. money.addBoost(player, 18);
  98. quest.finish(script, player);
  99. }
  100. }
  101. }
  102. goto("wait");