viewing paste Crafty Chest v2.1 | Athena

Posted on the
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
//warp portal 128 45, 141 150
// warp portal prontera 139 150 ,prt_in 128 43
//effect 47 light torch
prontera,139,150,0  warp    CraftyChest#1   1,1,prt_in,128,43
prt_in,128,45,0 warp    CraftyChest#2   1,1,prontera,141,150
//By Skorm version 2.1
prt_in,132,29,3 script  Crafty Kreg 407,{
setcell "prt_in",116,41,137,16,cell_shootable,0;
setcell "prt_in",133,32,134,31,cell_walkable,0;
set .npc$, "[Kreg]";
//set @price,50;
//getmapxy(.@map$,.@x,.@y,0);
mes "(^00CC77So far "+$MaxCName$+" is the best at this game with "+$MaxCRound+" Rounds^000000)";
set @price,100000;
mes .npc$;
mes "Hello, Do you want to try your luck at a game of Crafty Chest? But it's not cheap 50k to play.";
//if(getmapusers("force_3-1")!=0) { mes "Room Status: [^FF0000Occupied^000000]"; close; } else
//mes "Room Status: [^0000FFOpen^000000]";
if(getgmlevel()>80){
mes "Oh! Sir thanks for coming what would you like to do?";
if(select("Continue to normal menu:Reset Best At game")-1){
set $MaxCName,"";
set $MaxCRound,0;
mes "Done"; close;
}
}
    switch(select("uhhmm yeah, sure I'll give it a shot.","Nawh this things a scam!","Can you Explain what that is first?","Rewards")) {
 
    
    case 1:
        if(Zeny < @price) { mes "Sorry you don't have enough zeny to play this game, it costs 50,000 Zeny to play."; close; end; } else
        set Zeny,Zeny-@price;
        next;
        mes .npc$;
        mes "Ok Just Pick a chest kill it if you win then you'll move on.";
        next;
        set CRound,0;
        warp "prt_in",137,32;
        callfunc "Crafty-chest";
    case 2:
        close;
    case 3:
        mes "Sure It's pretty self explained, you kill a chest, if you pick the right one you win and move on to the next round.";
        close;
    case 4:
        switch(select("1-5:6-9:10+")){
            if(@menu==1){
                for(set .@a,0; .@a<getarraysize(.PrizeR); set .@a,.@a + 1){
                    mes getitemname(.PrizeR[.@a])+",";
                    if(!(.@a%10)) next;
                    if(.@a==(getarraysize(.PrizeR)-1)) close;
                }
            } if(@menu==2){
                for(set .@a,0; .@a<getarraysize(.pos); set .@a,.@a + 1){
                    mes getitemname(.pos[.@a])+",";
                    if(!(.@a%10)) next;
                    if(.@a==(getarraysize(.pos)-1)) close;
                }
            } if(@menu==3){
                for(set .@a,0; .@a<getarraysize(.PrizeRs); set .@a,.@a + 1){
                    mes getitemname(.PrizeRs[.@a])+",";
                    if(!(.@a%10)) next;
                    if(.@a==(getarraysize(.PrizeRs)-1)) close;
                }
            }
        }
    }
 
OnInit:
setcell "prt_in",116,41,137,16,cell_shootable,0;
setcell "prt_in",133,32,134,31,cell_walkable,0;
end;
 
OnNPCKillEvent:
    if(getgmlevel()>10) end;
    getmapxy(@map$,.@x,.@y,0);
    if((killedrid==2288) && (@map$ == "prt_in")) {
    if(getequipid(EQI_HAND_L)!=-1){ warp "prt_in",131,32; mes "Sorry you can't use weapons or shields."; close; end; } else
    if(getequipid(EQI_HAND_R)!=-1){ warp "prt_in",131,32; mes "Sorry you can't use weapons."; close; end; } else
    setArray .PrizeR[1],
        619, 0, 12016, 1000, 604, 678, 570, 645, 501, 0,
        0, 0, 501, 502, 503, 504, 505, 506, 507, 12116,
        0, 0, 9003, 0, 0, 601, 602, 603, 604, 12114,
        605, 606, 607, 608, 609, 610, 611, 612, 0, 12117;
    setArray .pos[0],2,572,10,21007,11,12208,12,12264,21,13804,22,20465,24,12020,25,12214,39,12115;
    for(set .@a,0; .@a < getarraysize(.pos); set .@a,.@a + 2) {
        set .@val,.@a + 1;
        set .PrizeR[.pos[.@a]],.pos[.@val];
    }
    setArray .PrizeRs[1], 4365, 4441, 4403, 4342, 12103, 512, 4359, 4509, 25539, 4302;
        if(CRound>=10) {
            if(rand(1,20) == 1) { emotion e_grat,0; if(rand(0,1)) { set .@pz,rand(1,10); getitem .PrizeRs[.@pz],1; announce strcharinfo(0)+" made it to Round " + CRound + " in crafty chest and got a ["+getitemname(.PrizeRs[.@pz])+"].",bc_blue;} dispbottom "awesome Round!."; emotion e_omg,1; callfunc "Crafty-chest"; }
            atcommand "@effect 1"; warp "prt_in",131,32; dispbottom "You lose."; set CRound,0; end;
        } if(CRound>=8) {
            if(((CRound>=9)?rand(1,10) == 1:rand(1,3) == 1)) { emotion e_grat,0; getitem .PrizeR[rand(1,40)],CRound; dispbottom "awesome Round!."; emotion e_omg,1; callfunc "Crafty-chest"; }
            atcommand "@effect 1"; warp "prt_in",131,32; dispbottom "You lose."; set CRound,0; end;
        } if(rand(1,2) == 1) { emotion e_grat,0; if(CRound>=3) { getitem .PrizeR[rand(1,40)],CRound; } dispbottom "awesome Round!."; emotion e_omg,1; callfunc "Crafty-chest"; }
            atcommand "@effect 1"; warp "prt_in",131,32; dispbottom "You lose."; set CRound,0; end;
    } else {
        end;
    }
}
 
function    script  Crafty-chest    {
    if( getequipid(EQI_HAND_L) != -1 )
        unequip EQI_HAND_L;
    if( getequipid(EQI_HAND_R) != -1 )
        unequip EQI_HAND_R;
    setArray .CraftyR[1],
        1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
        11, 12, 13, 14, 15, 16, 17, 18, 19, 20;
    set CRound,CRound + 1;
    if(CRound>=$MaxCRound) { set $MaxCRound,CRound; set $MaxCName$,""+strcharinfo(0)+""; } else
    killmonsterall "prt_in";
    monster "prt_in",136,34,"Crafty Chest-1",2288,1,"";
    monster "prt_in",136,32,"Crafty Chest-2",2288,1,"";
    if(CRound>=3) { monster "prt_in",136,30,"Crafty Chest-3",2288,1,""; } else
    if(CRound>=8) { monster "prt_in",136,28,"Crafty Chest-4",2288,1,""; } else
    if(CRound==getarraysize(.CraftyR[1])) { warp "prt_in",131,32; } else
    dispbottom "Round "+CRound;
//  atcommand "@localbroadcast Round "+CRound+""+@localbroadcast$;
    mapannounce "prt_in",strcharinfo(0)+" made it to Round " + CRound + "",bc_map | bc_blue;
}
 
 
prt_in  mapflag nowarp
prt_in  mapflag nomemo
prt_in  mapflag nosave
prt_in  mapflag noskill
prt_in  mapflag nodrop
Viewed 1610 times, submitted by Skorm.