schiff_3_schatz.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_break");
  4. event.load("entity_click");
  5. stage = 0;
  6. all_stages = 2;
  7. quest_name = "Schatz der Santa Maria";
  8. given = 0;
  9. broken = 0;
  10. broken_gold_locs = set.new();
  11. @wait
  12. wait();
  13. if(!player.isQuester(player, script)) {
  14. goto("wait");
  15. }
  16. if(event == "quest_term") {
  17. entity.cleareffects(player);
  18. wait(); //Script wird von außen terminiert
  19. }
  20. if(event == "quest_start") {
  21. quest.display(player, quest_name, stage, all_stages);
  22. player.giveSingleItem(player, read.item("minecraft:iron_pickaxe"), false);
  23. msg.prefix(player, "§dKumpel", "Berge die vier Goldblöcke aus dem havariertem Schiff und bringe sie mir.");
  24. goto("wait");
  25. }
  26. label = concat("stage", text.number(stage));
  27. goto(label);
  28. @stage0
  29. if(event == "block_break") {
  30. if(block_type == "minecraft:gold_block") {
  31. if(!set.contains(broken_gold_locs, block_loc)) {
  32. cancel = false;
  33. scheduler.setBlock(5, block_loc, block_type, false);
  34. set.add(broken_gold_locs, block_loc);
  35. broken++;
  36. if(broken >= 4) {
  37. stage.increase(player);
  38. msg.prefix(player, "§dKumpel", "Sehr gut, bring mir nun das Gold.");
  39. }
  40. }
  41. }
  42. }
  43. goto("wait");
  44. @stage1
  45. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  46. entity_name = entity.getName(entity);
  47. if(entity_name == "Kumpel") {
  48. item = living.getEquip(player, "hand");
  49. item_type = item.getType(item);
  50. if(item_type == "minecraft:gold_block") {
  51. given++;
  52. player.removeItem(player, read.item(item_type));
  53. if(given == 4) {
  54. msg.prefix(player, "§dKumpel", "Wir haben den Schatz geborgen. Wenn wir überleben, sind wir reich!");
  55. player.setShipProgress(player, 3);
  56. entity.cleareffects(player);
  57. msg(player, "§dQuest abgeschlossen. Belohnung: 6 Snuvis!");
  58. addMoney(player, 6);
  59. quest.finish(script, player);
  60. }
  61. } else {
  62. msg.prefix(player, "§dKumpel", "Was soll ich damit?");
  63. }
  64. }
  65. }
  66. goto("wait");