schiff_10_kuchen.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_place");
  4. event.load("block_break");
  5. event.load("block_drop");
  6. event.load("entity_click");
  7. event.load("craft");
  8. stage = 0;
  9. all_stages = 7;
  10. quest_name = "Backe Backe Kuchen";
  11. milk = 0;
  12. milk_given = 0;
  13. cane_broken = 0;
  14. eggs_given = 0;
  15. wheat = 0;
  16. story = world.get("story");
  17. grow(loc.new(story, -1650, 66, -978), 5);
  18. animal_loc = loc.new(story, -1642, 66, -972);
  19. cake_loc = loc.new(story, -1651, 66, -989);
  20. harvested = false;
  21. egg = false;
  22. sugar = false;
  23. @wait
  24. wait();
  25. if(!player.isQuester(player, script)) {
  26. goto("wait");
  27. }
  28. if(event == "quest_term") {
  29. entity.remove(chicken_ent);
  30. entity.remove(cow_ent);
  31. wait(); //Script wird von außen terminiert
  32. }
  33. if(event == "quest_start") {
  34. quest.display(player, quest_name, stage, all_stages);
  35. player.giveItem(player, read.item("minecraft:bucket", 3));
  36. chicken_ent = entity.spawn("chicken", animal_loc);
  37. cow_ent = entity.spawn("cow", animal_loc);
  38. block.set(cake_loc, "minecraft:air");
  39. msg.prefix(player, "§dKumpel", "Jetzt, wo es uns doch so gut geht, lass uns einen Kuchen backen.");
  40. scheduler.msgPrefix(30, player, "§dKumpel", "Hier hast du drei Eimer. Besorge dir alle Zutaten von der Insel.");
  41. scheduler.msgPrefix(60, player, "§dKumpel", "Wenn du alles beisammen hast, crafte einen Kuchen und platziere ihn auf dem Ofen.");
  42. scheduler.msgPrefix(90, player, "§dKumpel", "Für einen Kuchen brauchst du: 3 Eimer Milch, 2 Zucker, 1 Ei (Huhn rechtsklicken) und 3 Weizen.");
  43. goto("wait");
  44. }
  45. if(event == "block_break") {
  46. if(block_type == "minecraft:sugar_cane") {
  47. cancel = true;
  48. item.drop(block_loc, read.item(block_type));
  49. cane_broken++;
  50. if(cane_broken == 2) {
  51. stage.increase(player);
  52. }
  53. goto("wait");
  54. }
  55. if(block_type == "minecraft:wheat") {
  56. cancel = false;
  57. scheduler.setBlock(5, block_loc, block_type, false);
  58. }
  59. goto("wait");
  60. }
  61. if(event == "block_drop") {
  62. if(block_type == "minecraft:wheat") {
  63. for(i = 0; i < list.getSize(drops); i++) {
  64. drop_item = list.getIndex(drops, i);
  65. if(item.getType(drop_item) == "minecraft:wheat") {
  66. wheat += item.getAmount(drop_item);
  67. if(wheat >= 3 && !harvested) {
  68. harvested = true;
  69. stage.increase(player);
  70. }
  71. }
  72. }
  73. }
  74. goto("wait");
  75. }
  76. if(event == "entity_click") {
  77. entity_type = entity.getType(entity);
  78. if(entity_type == "cow") {
  79. item = living.getEquip(player, "hand");
  80. item_type = item.getType(item);
  81. if(item_type == "minecraft:bucket") {
  82. milk++;
  83. if(milk == 3) {
  84. stage.increase(player);
  85. }
  86. }
  87. goto("wait");
  88. }
  89. if(entity_type == "chicken") {
  90. if(!egg) {
  91. stage.increase(player);
  92. }
  93. egg = true;
  94. player.giveItem(player, read.item("minecraft:egg"));
  95. }
  96. goto("wait");
  97. }
  98. if(event == "craft") {
  99. if(item.getType(result) == "minecraft:sugar" && !sugar) {
  100. sugar = true;
  101. stage.increase(player);
  102. }
  103. }
  104. if(stage >= 5) {
  105. label = concat("stage", text.number(stage));
  106. goto(label);
  107. }
  108. goto("wait");
  109. @stage5
  110. if(event == "craft") {
  111. if(item.getType(result) == "minecraft:cake") {
  112. stage.increase(player);
  113. }
  114. }
  115. goto("wait");
  116. @stage6
  117. if(event == "block_place") {
  118. if(block_type == "minecraft:cake") {
  119. if(block_loc == cake_loc) {
  120. cancel = false;
  121. msg.prefix(player, "§dKumpel", "Auf das wir noch ein langes Leben haben.");
  122. player.setShipProgress(player, 10);
  123. entity.remove(cow_ent);
  124. entity.remove(chicken_ent);
  125. msg(player, "§dQuest abgeschlossen. Belohnung: 10 Snuvis!");
  126. addMoney(player, 10);
  127. quest.finish(script, player);
  128. }
  129. }
  130. }
  131. goto("wait");