reforestation.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_place");
  4. stage = 0;
  5. all_stages = 1;
  6. quest_name = "Reforestation";
  7. spruce_sap = 0;
  8. spruce_sap_mat = material.get("SPRUCE_SAPLING");
  9. saps = item.create("SPRUCE_SAPLING", 5, null, null);
  10. @wait
  11. wait();
  12. if(!player.isQuester(player, script)) {
  13. goto("wait");
  14. }
  15. if(event == "quest_term") {
  16. player.removeItem(player, saps);
  17. wait(); //Script wird von außen terminiert
  18. }
  19. if(event == "quest_start") {
  20. quest.display(player, quest_name, stage, all_stages);
  21. msg.prefix(player, "§dLumberjack", "I am concerned about the sustainability of the forest.");
  22. scheduler.msgPrefix(30, player, "§dLumberjack", "Please plant 5 new trees around the village. Here you have 5 saplings.");
  23. player.giveItem(player, saps);
  24. goto("wait");
  25. }
  26. label = string.concat("stage", string.number(stage));
  27. goto(label);
  28. @stage0
  29. if(event == "block_place") {
  30. block_type = block.getType(block);
  31. if(block_type == spruce_sap_mat && !cancel) {
  32. spruce_sap++;
  33. if(spruce_sap == 5) {
  34. stage.increase(player);
  35. msg.prefix(player, "§dLumberjack", "Part of the forest, part of the crew.");
  36. msg(player, text.new("§dQuest finished. Reward: 3 snuvis!"));
  37. money.addBoost(player, 3);
  38. quest.finish(script, player);
  39. }
  40. }
  41. goto("wait");
  42. }
  43. goto("wait");