diff options
-rw-r--r-- | world/map/npc/functions/treasure_hunt.txt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/world/map/npc/functions/treasure_hunt.txt b/world/map/npc/functions/treasure_hunt.txt index 0e97adce..ff4e6336 100644 --- a/world/map/npc/functions/treasure_hunt.txt +++ b/world/map/npc/functions/treasure_hunt.txt @@ -134,7 +134,7 @@ OnDiggingRound: (get(POS_Y, .digger) != getnpcy()) || (get(TILES_WALKED, .digger) != .tiles)) set .failed, 4; // Has digger moved? - if ($TREASURE_MAP$ != strnpcinfo(3)) set .failed, 9; // Trying to dig on wrong map? Side effects avoidance. + if ($TREASURE_MAP$ != strnpcinfo(3)) set .failed, 11; // Trying to dig on wrong map? Side effects avoidance. if ($TREASURE_DEBUG) debugmes "OnDiggingRound: failed1=" + .failed; if (.failed) goto L_DiggFail; // Basic checks ok -> next round starts @@ -158,7 +158,18 @@ L_DiggFail: elif (.failed == 4) npctalk strnpcinfo(0), "Digging : ##3##BDigger " + .diggernm$ + " has lost focus and digging site collapsed"; elif (.failed == 9) npctalk strnpcinfo(0), "Digging : ##3##BDoh! Seems there's no treasure on this spot!"; elif (.failed == 10) npctalk strnpcinfo(0), "Digging : ##3##BDoh! Someone already digged treasure out!"; + elif (.failed == 11) npctalk strnpcinfo(0), "Digging : ##3##BThis spot doesn't looks promising..."; else /*error, etc*/ npctalk strnpcinfo(0), "Digging : ##3##BDigger " + .diggernm$ + " something went wrong, digging site collapsed"; + if ((.failed != 9) && (.failed != 11)) destroy; // And skip digg hole setup. + // If we got here, let's create digg hole (npc name generation prevents duplicate NPC creation) + set .hname$, "#digghole|" + strnpcinfo(3) + "|" + getnpcx() + "|" + getnpcy(); // Internal NPC name, e.g. #digghole|003-1|10|20 + set .htype, NPC_DIGGHOLE_MIN+rand(4); // NPC type. Usual sand hole. + set .hlifetime, 90000; // failsafe: NPCs outside aree of interest would self destruct + if ((.failed == 9) && (strnpcinfo(3) == $TREASURE_MAP$) && // No treasure && right map + (getnpcx() >= $TREASURE_X1) && (getnpcx() <= $TREASURE_X2) && // and right area of map + (getnpcy() >= $TREASURE_Y1) && (getnpcy() <= $TREASURE_Y2)) // (within treasure hint rectangle) + set .hlifetime, 0; // -> then hole will be "permanent" + void call("digghole_create", strnpcinfo(3), getnpcx(), getnpcy(), .hname$, .htype, .hlifetime); destroy; L_DiggFound: @@ -205,6 +216,9 @@ OnBootyRound: end; L_Finalize: + set .hname$, "#treasurehole|" + strnpcinfo(3) + "|" + getnpcx() + "|" + getnpcy(); // Internal NPC name, e.g. #digghole|003-1|10|20 + set .htype, NPC_DIGGHOLE_MIN + 4 + rand(4); // NPC type. Random treasure hole + void call("digghole_create", strnpcinfo(3), getnpcx(), getnpcy(), .hname$, .htype, 0); // Treasure hole, permanent addtimer 0, "TreasureDigAux::OnMainBooty", .digger; // Hand over to final reward handler. mapannounce strnpcinfo(3), "Treasure : Digger " + .diggernm$ + " found treasure!", 0; npctalk strnpcinfo(0), "Digging : ##3##B [TREASURE] Victory! Treasure hunter " + .diggernm$ + " got booty!"; |