123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- event.load("quest_start");
- event.load("quest_term");
- event.load("block_drop");
- event.load("block_break");
- event.load("entity_click");
- event.load("craft");
- stage = 0;
- all_stages = 3;
- quest_name = "Nie wieder Hunger leiden";
- harvest = 0;
- given = 0;
- grow(loc.new(world.get("story"), -1650, 66, -978), 5);
- @wait
- wait();
- if(event == "block_drop") {
- if(!isPlayer(entity)) {
- goto("wait");
- }
- player = entity;
- }
- 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);
- msg.prefix(player, "§dKumpel", "In der Zwischenzeit habe ich eine Farm errichtet.");
- scheduler.msgPrefix(30, player, "§dKumpel", "Ernte genug Weizen, damit du uns vier Brote craften kannst.");
- goto("wait");
- }
- label = concat("stage", text.number(stage));
- goto(label);
- @stage0
- if(event == "block_drop") {
- if(block_type == "minecraft:wheat") {
- for(i = 0; i < list.getSize(drops); i++) {
- drop_item = list.getIndex(drops, i);
- if(item.getType(drop_item) == "minecraft:wheat") {
- harvest += item.getAmount(drop_item);
- if(harvest >= 12) {
- stage.increase(player);
- }
- }
- }
- }
- goto("wait");
- }
- if(event == "block_break") {
- if(block_type == "minecraft:wheat") {
- cancel = false;
- scheduler.setBlock(5, block_loc, block_type, false);
- }
- }
- goto("wait");
- @stage1
- if(event == "craft") {
- if(item.getType(result) == "minecraft:bread") {
- stage.increase(player);
- }
- }
- goto("wait");
- @stage2
- 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:bread") {
- given++;
- player.removeItem(player, read.item(item_type));
- if(given == 4) {
- msg.prefix(player, "§dKumpel", "Läuft doch sehr gut bei uns!");
- player.setShipProgress(player, 4);
- entity.cleareffects(player);
- msg(player, "§dQuest abgeschlossen. Belohnung: 5 Snuvis!");
- addMoney(player, 5);
- quest.finish(script, player);
- }
- } else {
- msg.prefix(player, "§dKumpel", "Was soll ich damit?");
- }
- }
- }
- goto("wait");
|