viewing paste Garden Entrance | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
prontera,157,190,4[TAB]script[TAB]Garden[TAB]Entrance 793,{
    if(gettime(4)==6) && (gettime(3)==12) {
        //enablenpc "Garden Entrance"; //this must be an issue, since if we here it's obiously enable
        Announce "The Mystical Gate of the Secret Garden has opened! Fifteen players may enter.",bc_all || bc_blue;
        mes "Rumor has it that there was once an ancient secret garden located near prontera!";
        if(countitem(7559) < 1) close;
        next;
        mes "I see that you have the key... Very well, since you have the key, I can warp you to the gate.";
        next;
        mes "Do you want me to? Only [" + .playersmax - .playersin + "] can enter.";
        next;
        if(select("Yes:No") == 2) close;
        set .playersin,getmapusers(.garden$); //updated to auto ajust for players leaving etc
        if(.playersin == .playersmax) {
            mes "Sorry the max players has been reached.";
        } else {
            warp .garden$,.x,.y;
            //set .playersin,.playersin + 1;
        }
        close;
    }
    end;
 
OnInit: //been move so we can click on NPC
    set .garden$,"maze" // <Customizable>
    set .x,50; // <Customizable>
    set .y,55; // <Customizable>
    set .playersmax,15; // <Customizable>
    set .playersin,0;
    disablenpc "Garden Entrance"; //when do you enable it ?
    end;
 
OnSat1200: //enable npc on saturday at noon
    enablenpc "Garden Entrance";
    end;
OnSat1800: //disable npc after 6h 
    disablenpc "Garden Entrance";
    end;
}
 
maze,60,60,4 script Ancient Hero of the Garden 793,{
OnPCLoadMapEvent : //autoenable and spawn, comment this if you want to handle differently
    if((getmapusers(.garden$) == 15) && !.spawn[1]) { //when we reach 15 player on map we enable npc and spawn monster
        enablenpc "Ancient Hero of the Garden"; //nota : we enable npc so player can click on it but it's not really usefull, we should consider invisible automated npc instead.
//nota2 we may have extra enable from player wich it's quite annoying but shouldn't be buggy anyway
        monster .garden$,0,0,"Treasure of the Secret Garden",.spawn,10,"Ancient Hero of the Garden::L_MDeath";
        set .spawn[1],1; //mark monster are spawned
    }
    else {
        mes "I don't know exacly what's my purpose yet but monsters alreaby been spawn, found them !"
        close;
    }
    end;
 
L_MDeath: //called at each mob dead
    if(getmapmobs(.spawn) == 0) { //if there no more mob on map
        set .spawn[1],0; //mark monster are all dead
        mes "I see you have found the treasure ...";
        next;
        switch(rand(1,15)){
            case 1 : goto L_First; //I dun like much goto but well
            case 2 : goto L_Second; 
            case 3 : goto L_Third;
            default :
                mes "I see that you did not get the sacred mark of the treasure...";
                close;
        }
    }
    end;
 
L_First:
    mes "Wow... You got the ultimate mark of the treasure ...";
    next;
    mes "I believe this is yours then...";
    getitem 2862;
    set zeny, zeny + 100000;
    close;
 
L_Second:
    mes "Wow... You got the legendary mark of the treasure ...";
    next;
    mes "I believe this is yours then...";
    getitem 5682;
    set zeny, zeny + 50000;
    close;
 
L_Third:
    mes "Wow... You got the holy mark of the treasure ...";
    next;
    mes "I believe this is yours then...";
    set zeny, zeny + 20000;
    close;
 
OnInit:
    set .spawn,1902; // <Customizable>
    set .garden$,"maze" // <Customizable>
    disablenpc "Ancient Hero of the Garden"; //when do you enable it ?
    end;
}
Viewed 984 times, submitted by lighta.