helfende_hand.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. event.load("quest_start");
  2. event.load("quest_term");
  3. event.load("block_click");
  4. event.load("block_break");
  5. event.load("entity_click");
  6. stage = 0;
  7. all_stages = 4;
  8. quest_name = "Helfende Hand";
  9. wool = 0;
  10. iron = 0;
  11. coal = 0;
  12. wool_needed = 6;
  13. iron_needed = 3;
  14. coal_needed = 4;
  15. wool_tag = item.getTag("minecraft:wool");
  16. @wait
  17. wait();
  18. if(event == "living_death") {
  19. player = player.getFromDamageSource(damage_source);
  20. if(player == null) {
  21. goto("wait");
  22. }
  23. }
  24. if(!player.isQuester(player, script)) {
  25. goto("wait");
  26. }
  27. if(event == "quest_term") {
  28. //Hier Code einfügen...
  29. wait(); //Script wird von außen terminiert
  30. }
  31. if(event == "quest_start") {
  32. quest.display(player, quest_name, stage, all_stages);
  33. msg.prefix(player, "§dGustav", "Ich habe so viel zu tun. Sei doch meine helfende Hand.");
  34. scheduler.msgPrefix(30, player, "§dGustav", "Bring mir bitte 3 Eisenerz und 4 Kohle aus einer Höhle.");
  35. scheduler.msgPrefix(60, player, "§dGustav", "Schere außerdem 6 Schafe und bring mir deren Wolle.");
  36. player.giveSingleItem(player, read.item("minecraft:stone_pickaxe"), false);
  37. player.giveSingleItem(player, read.item("minecraft:shears"), false);
  38. goto("wait");
  39. }
  40. if(event == "block_break") {
  41. if(block_type == "minecraft:coal_ore") {
  42. cancel = false;
  43. scheduler.setBlock(5, block_loc, "minecraft:coal_ore", false);
  44. coal++;
  45. if(coal == coal_needed) {
  46. stage.increase(player);
  47. }
  48. }
  49. if(block_type == "minecraft:iron_ore" && iron < 3) {
  50. cancel = false;
  51. scheduler.setBlock(5, block_loc, "minecraft:iron_ore", false);
  52. iron++;
  53. if(iron == iron_needed) {
  54. stage.increase(player);
  55. }
  56. }
  57. }
  58. if(event == "entity_click") {
  59. entity_type = entity.getType(entity);
  60. if(entity_type == "sheep") {
  61. if(!sheep.isSheared(entity)) {
  62. item = living.getEquip(player, "hand");
  63. item_type = item.getType(item);
  64. if(item_type == "minecraft:shears") {
  65. wool++;
  66. if(wool == wool_needed) {
  67. stage.increase(player);
  68. }
  69. }
  70. }
  71. }
  72. }
  73. if(stage == 3) {
  74. goto("stage3");
  75. }
  76. goto("wait");
  77. @stage3
  78. if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
  79. entity_name = entity.getName(entity);
  80. if(entity_name == "Gustav") {
  81. item = living.getEquip(player, "hand");
  82. item_type = item.getType(item);
  83. if(item_type == "minecraft:coal") {
  84. if(coal_needed > 0) {
  85. rest_amount = human.giveItem(entity_name, player, "minecraft:coal", coal_needed);
  86. if(rest_amount == 0) {
  87. msg.prefix(player, "§dGustav", "Danke für die Kohle.");
  88. }
  89. coal_needed = rest_amount;
  90. }
  91. }
  92. elseif(item_type == "minecraft:iron_ore") {
  93. if(iron_needed > 0) {
  94. rest_amount = human.giveItem(entity_name, player, "minecraft:iron_ore", iron_needed);
  95. if(rest_amount == 0) {
  96. msg.prefix(player, "§dGustav", "Danke für das Eisenerz.");
  97. }
  98. iron_needed = rest_amount;
  99. }
  100. }
  101. elseif(item.hasTag(wool_tag, item)) {
  102. if(wool_needed > 0) {
  103. rest_amount = human.giveItem(entity_name, player, wool_tag, wool_needed);
  104. if(rest_amount == 0) {
  105. msg.prefix(player, "§dGustav", "Danke für die Wolle.");
  106. }
  107. wool_needed = rest_amount;
  108. }
  109. }
  110. if(coal_needed == 0 && iron_needed == 0 && wool_needed == 0) {
  111. money.addBoost(player, 20);
  112. msg(player, "§dQuest abgeschlossen. Belohnung: 20 Snuvis!");
  113. quest.finish(script, player);
  114. }
  115. }
  116. }
  117. goto("wait");