schiff_4_hunger.txt 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. event.load("craft");
  7. stage = 0;
  8. all_stages = 3;
  9. quest_name = "Nie wieder Hunger leiden";
  10. harvest = 0;
  11. given = 0;
  12. grow(loc.new(world.get("story"), -1650, 66, -978), 5);
  13. @wait
  14. wait();
  15. if(event == "block_drop") {
  16. if(!isPlayer(entity)) {
  17. goto("wait");
  18. }
  19. player = entity;
  20. }
  21. if(!player.isQuester(player, script)) {
  22. goto("wait");
  23. }
  24. if(event == "quest_term") {
  25. entity.cleareffects(player);
  26. wait(); //Script wird von außen terminiert
  27. }
  28. if(event == "quest_start") {
  29. quest.display(player, quest_name, stage, all_stages);
  30. msg.prefix(player, "§dKumpel", "In der Zwischenzeit habe ich eine Farm errichtet.");
  31. scheduler.msgPrefix(30, player, "§dKumpel", "Ernte genug Weizen, damit du uns vier Brote craften kannst.");
  32. goto("wait");
  33. }
  34. label = concat("stage", text.number(stage));
  35. goto(label);
  36. @stage0
  37. if(event == "block_drop") {
  38. if(block_type == "minecraft:wheat") {
  39. for(i = 0; i < list.getSize(drops); i++) {
  40. drop_item = list.getIndex(drops, i);
  41. if(item.getType(drop_item) == "minecraft:wheat") {
  42. harvest += item.getAmount(drop_item);
  43. if(harvest >= 12) {
  44. stage.increase(player);
  45. }
  46. }
  47. }
  48. }
  49. goto("wait");
  50. }
  51. if(event == "block_break") {
  52. if(block_type == "minecraft:wheat") {
  53. cancel = false;
  54. scheduler.setBlock(5, block_loc, block_type, false);
  55. }
  56. }
  57. goto("wait");
  58. @stage1
  59. if(event == "craft") {
  60. if(item.getType(result) == "minecraft:bread") {
  61. stage.increase(player);
  62. }
  63. }
  64. goto("wait");
  65. @stage2
  66. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  67. entity_name = entity.getName(entity);
  68. if(entity_name == "Kumpel") {
  69. item = living.getEquip(player, "hand");
  70. item_type = item.getType(item);
  71. if(item_type == "minecraft:bread") {
  72. given++;
  73. player.removeItem(player, read.item(item_type));
  74. if(given == 4) {
  75. msg.prefix(player, "§dKumpel", "Läuft doch sehr gut bei uns!");
  76. player.setShipProgress(player, 4);
  77. entity.cleareffects(player);
  78. msg(player, "§dQuest abgeschlossen. Belohnung: 5 Snuvis!");
  79. addMoney(player, 5);
  80. quest.finish(script, player);
  81. }
  82. } else {
  83. msg.prefix(player, "§dKumpel", "Was soll ich damit?");
  84. }
  85. }
  86. }
  87. goto("wait");