in_eile.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_needed = 21;
  10. wheat_needed = 63;
  11. wheat_harvestet = 0;
  12. @wait
  13. wait();
  14. if(event == "block_drop") {
  15. if(!isPlayer(entity)) {
  16. goto("wait");
  17. }
  18. player = entity;
  19. }
  20. if(event == "living_death") {
  21. player = player.getFromDamageSource(damage_source);
  22. if(player == null) {
  23. goto("wait");
  24. }
  25. }
  26. if(!player.isQuester(player, script)) {
  27. goto("wait");
  28. }
  29. if(event == "quest_term") {
  30. //Hier Code einfügen...
  31. wait(); //Script wird von außen terminiert
  32. }
  33. if(event == "quest_start") {
  34. quest.display(player, quest_name, stage, all_stages);
  35. 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."));
  36. scheduler.msgPrefix(30, player, "§dUlf", "50 Brote haben sie bestellt… Das ist unschaffbar! Ich habe erst 29 Brote gebacken.");
  37. scheduler.msgPrefix(60, player, concat("§5", player.getName(player)), "Die letzten 21 Brote kann ich übernehmen!");
  38. scheduler.msgPrefix(90, player, "§dUlf", "Super! Dann geh doch zum Weizenfeld, hol dir die nötigen Ressourcen und verarbeite sie zu Brot.");
  39. goto("wait");
  40. }
  41. if(event == "block_drop") {
  42. if(block_type == "km:rwheat") {
  43. list.clear(drops);
  44. list.add(drops, read.item("minecraft:wheat"));
  45. }
  46. goto("wait");
  47. }
  48. if(event == "block_break") {
  49. if(block_type == "km:rwheat") {
  50. cancel = false;
  51. scheduler.setBlock(60, block_loc, "km:rwheat[age=7]", false);
  52. }
  53. }
  54. label = concat("stage", text.number(stage));
  55. goto(label);
  56. @stage0
  57. if(event == "block_break") {
  58. if(block_type == "km:rwheat") {
  59. wheat_harvestet++;
  60. if(wheat_harvestet == wheat_needed) {
  61. stage.increase(player);
  62. }
  63. }
  64. }
  65. goto("wait");
  66. @stage1
  67. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  68. entity_name = entity.getName(entity);
  69. if(entity_name == "Ulf") {
  70. rest_amount = human.giveItem(entity_name, player, "minecraft:bread", bread_needed);
  71. if(rest_amount == 0) {
  72. msg.prefix(player, "§dBauer", "Du kommst gerade rechtzeitig, die Kunden sind eben eingetroffen! Hier eine Belohnung.");
  73. player.giveItem(player, read.item("km:berry_work"));
  74. msg(player, "§dQuest abgeschlossen. Belohnung: 15 Snuvis!");
  75. money.addBoost(player, 15);
  76. quest.finish(script, player);
  77. } else {
  78. bread_needed = rest_amount;
  79. }
  80. }
  81. }
  82. goto("wait");