123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- event.load("quest_start");
- event.load("quest_term");
- event.load("block_place");
- event.load("block_break");
- event.load("block_drop");
- event.load("entity_click");
- event.load("craft");
- stage = 0;
- all_stages = 7;
- quest_name = "Backe Backe Kuchen";
- milk = 0;
- milk_given = 0;
- cane_broken = 0;
- eggs_given = 0;
- wheat = 0;
- story = world.get("story");
- grow(loc.new(story, -1650, 66, -978), 5);
- animal_loc = loc.new(story, -1642, 66, -972);
- cake_loc = loc.new(story, -1651, 66, -989);
- harvested = false;
- egg = false;
- sugar = false;
- @wait
- wait();
- if(!player.isQuester(player, script)) {
- goto("wait");
- }
- if(event == "quest_term") {
- entity.remove(chicken_ent);
- entity.remove(cow_ent);
- wait(); //Script wird von außen terminiert
- }
- if(event == "quest_start") {
- quest.display(player, quest_name, stage, all_stages);
- player.giveItem(player, read.item("minecraft:bucket", 3));
- chicken_ent = entity.spawn("chicken", animal_loc);
- cow_ent = entity.spawn("cow", animal_loc);
- block.set(cake_loc, "minecraft:air");
- msg.prefix(player, "§dKumpel", "Jetzt, wo es uns doch so gut geht, lass uns einen Kuchen backen.");
- scheduler.msgPrefix(30, player, "§dKumpel", "Hier hast du drei Eimer. Besorge dir alle Zutaten von der Insel.");
- scheduler.msgPrefix(60, player, "§dKumpel", "Wenn du alles beisammen hast, crafte einen Kuchen und platziere ihn auf dem Ofen.");
- scheduler.msgPrefix(90, player, "§dKumpel", "Für einen Kuchen brauchst du: 3 Eimer Milch, 2 Zucker, 1 Ei (Huhn rechtsklicken) und 3 Weizen.");
- goto("wait");
- }
- if(event == "block_break") {
- if(block_type == "minecraft:sugar_cane") {
- cancel = true;
- item.drop(block_loc, read.item(block_type));
- cane_broken++;
- if(cane_broken == 2) {
- stage.increase(player);
- }
- goto("wait");
- }
- if(block_type == "minecraft:wheat") {
- cancel = false;
- scheduler.setBlock(5, block_loc, block_type, false);
- }
- goto("wait");
- }
- 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") {
- wheat += item.getAmount(drop_item);
- if(wheat >= 3 && !harvested) {
- harvested = true;
- stage.increase(player);
- }
- }
- }
- }
- goto("wait");
- }
- if(event == "entity_click") {
- entity_type = entity.getType(entity);
- if(entity_type == "cow") {
- item = living.getEquip(player, "hand");
- item_type = item.getType(item);
- if(item_type == "minecraft:bucket") {
- milk++;
- if(milk == 3) {
- stage.increase(player);
- }
- }
- goto("wait");
- }
- if(entity_type == "chicken") {
- if(!egg) {
- stage.increase(player);
- }
- egg = true;
- player.giveItem(player, read.item("minecraft:egg"));
- }
- goto("wait");
- }
- if(event == "craft") {
- if(item.getType(result) == "minecraft:sugar" && !sugar) {
- sugar = true;
- stage.increase(player);
- }
- }
- if(stage >= 5) {
- label = concat("stage", text.number(stage));
- goto(label);
- }
- goto("wait");
- @stage5
- if(event == "craft") {
- if(item.getType(result) == "minecraft:cake") {
- stage.increase(player);
- }
- }
- goto("wait");
- @stage6
- if(event == "block_place") {
- if(block_type == "minecraft:cake") {
- if(block_loc == cake_loc) {
- cancel = false;
- msg.prefix(player, "§dKumpel", "Auf das wir noch ein langes Leben haben.");
- player.setShipProgress(player, 10);
- entity.remove(cow_ent);
- entity.remove(chicken_ent);
- msg(player, "§dQuest abgeschlossen. Belohnung: 10 Snuvis!");
- addMoney(player, 10);
- quest.finish(script, player);
- }
- }
- }
- goto("wait");
|