in_eile.txt 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_break");
  4. event.load("entity_click");
  5. event.load("block_drop");
  6. stage = 0;
  7. all_stages = 2;
  8. quest_name = "In Eile";
  9. bread_given = 0;
  10. bread_needed = 21;
  11. wheat_needed = 63;
  12. wheat_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, "§dUlf", concat("Hey ", player.getName(player), "! Ich erwarte ziemlich viel Kundschaft und ich bin nicht mal annähernd mit der Zubereitung fertig."));
  37. scheduler.msgPrefix(30, player, "§dUlf", "50 Brote haben sie bestellt… Das ist unschaffbar! Ich habe erst 29 Brote gebacken.");
  38. scheduler.msgPrefix(60, player, concat("§5", player.getName(player)), "Die letzten 21 Brote kann ich übernehmen!");
  39. scheduler.msgPrefix(90, player, "§dUlf", "Super! Dann geh doch zum Weizenfeld, hol dir die nötigen Ressourcen und verarbeite sie zu Brot.");
  40. goto("wait");
  41. }
  42. if(event == "block_drop") {
  43. if(block_type == "minecraft:wheat") {
  44. list.clear(drops);
  45. list.add(drops, read.item("minecraft:wheat"));
  46. }
  47. goto("wait");
  48. }
  49. if(event == "block_break") {
  50. if(block_type == "minecraft:wheat") {
  51. cancel = false;
  52. scheduler.setBlock(60, block_loc, "minecraft:wheat[age=7]", false);
  53. }
  54. }
  55. label = concat("stage", text.number(stage));
  56. goto(label);
  57. @stage0
  58. if(event == "block_break") {
  59. if(block_type == "minecraft:wheat") {
  60. wheat_harvestet++;
  61. if(wheat_harvestet == wheat_needed) {
  62. stage.increase(player);
  63. }
  64. }
  65. }
  66. goto("wait");
  67. @stage1
  68. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  69. entity_name = entity.getName(entity);
  70. if(entity_name == "Ulf") {
  71. item = entity.getEquip(player, "hand");
  72. item_type = item.getType(item);
  73. if(item_type == "minecraft:air") {
  74. goto("wait");
  75. }
  76. elseif(item_type == "minecraft:bread") {
  77. if(bread_given >= bread_needed) {
  78. goto("wait");
  79. }
  80. bread_given++;
  81. player.removeItem(player, read.item(item_type));
  82. if(bread_given == bread_needed) {
  83. msg.prefix(player, "§dBauer", "Du kommst gerade rechtzeitig, die Kunden sind eben eingetroffen! Hier eine Belohnung.");
  84. player.giveItem(player, read.item("km:berry_work"));
  85. msg(player, "§dQuest abgeschlossen. Belohnung: 5 Snuvis!");
  86. money.addBoost(player, 5);
  87. quest.finish(script, player);
  88. }
  89. }
  90. }
  91. }
  92. goto("wait");