1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- event.load("quest_start");
- event.load("quest_term");
- event.load("block_break");
- event.load("entity_click");
- stage = 0;
- all_stages = 2;
- quest_name = "Schatz der Santa Maria";
- given = 0;
- broken = 0;
- broken_gold_locs = set.new();
- @wait
- wait();
- if(!player.isQuester(player, script)) {
- goto("wait");
- }
- if(event == "quest_term") {
- entity.cleareffects(player);
- wait(); //Script wird von außen terminiert
- }
- if(event == "quest_start") {
- quest.display(player, quest_name, stage, all_stages);
- player.giveSingleItem(player, read.item("minecraft:iron_pickaxe"), false);
- msg.prefix(player, "§dKumpel", "Berge die vier Goldblöcke aus dem havariertem Schiff und bringe sie mir.");
- goto("wait");
- }
- label = concat("stage", text.number(stage));
- goto(label);
- @stage0
- if(event == "block_break") {
- if(block_type == "minecraft:gold_block") {
- if(!set.contains(broken_gold_locs, block_loc)) {
- cancel = false;
- scheduler.setBlock(5, block_loc, block_type, false);
- set.add(broken_gold_locs, block_loc);
- broken++;
- if(broken >= 4) {
- stage.increase(player);
- msg.prefix(player, "§dKumpel", "Sehr gut, bring mir nun das Gold.");
- }
- }
- }
- }
- goto("wait");
- @stage1
- if(event == "entity_click" && hand == "MAIN_HAND" && entity.getType(entity) == "human") {
- entity_name = entity.getName(entity);
- if(entity_name == "Kumpel") {
- item = living.getEquip(player, "hand");
- item_type = item.getType(item);
- if(item_type == "minecraft:gold_block") {
- given++;
- player.removeItem(player, read.item(item_type));
- if(given == 4) {
- msg.prefix(player, "§dKumpel", "Wir haben den Schatz geborgen. Wenn wir überleben, sind wir reich!");
- player.setShipProgress(player, 3);
- entity.cleareffects(player);
- msg(player, "§dQuest abgeschlossen. Belohnung: 6 Snuvis!");
- addMoney(player, 6);
- quest.finish(script, player);
- }
- } else {
- msg.prefix(player, "§dKumpel", "Was soll ich damit?");
- }
- }
- }
- goto("wait");
|