viewing paste Disguise Event | 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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
prontera,160,155,4    script    Disguise Event    4_M_NFDEADMAN,{
if (getgmlevel() < .gm_level && .event_onoff) {
    end;
}
mes .@n$ = "[^0000FFDisguise NPC^000000]",
           "Welcome. How may I help you?";
next;
mes .@n$;
switch(select("Information", ((getgmlevel() >= .gm_level)?"Turn Event ["+(.event_onoff?"^FF0000OFF":"^0000FFON")+"^000000]:Event Settings":":"), "Nothing, just passing by.")) {
    case 1:
        mes "This event is quite simple. At the ",
            "start of the event, I will disguise",
            "myself as a random monster.",
            "You have to shout that monster's",
            "name out loud.";
        next;
        mes "If you are correct, you will",
            "receive a prize. If not, keep ",
            "trying! That's all that there is to ",
            "this event.";
        break;
 
    case 2:
        mes "Are you sure you want to turn the ",
            "event ["+(.event_onoff?"^FF0000OFF":"^0000FFON")+"^000000]";
        if (select("Yes", "No") == 2) {
            close;
        }
        if (.event_onoff) {
            .event_onoff = 0;
            announce "A GM has decided to turn the Disguise Event off. As a result no further prizes will be rewarded.",bc_all | bc_blue;
            deletepset 1;
            setnpcdisplay "Disguise Event", 4_M_NFDEADMAN;
            stopnpctimer;
            close;
        }
        close2;
        callsub iStartEvent;
        end;
 
    case 3:
        mes "Pick a setting to modify.";
        next;
        mes .@n$;
        switch(select("Monster Display", "Number of Rounds", "Prize Settings")) {
            case 1:
                mes "Choose a disguise rule.";
                next;
                .disguise_option = select(implode(.disguise_desc$), ":")) - 1;
                mes .@n$;
                    "The Disguise Rule has been set:",
                    "----> [^0000FF"+ .disguise_desc$[.disguise_option] +"^000000]";
                break;
 
            case 2:
                mes "Input the number of rounds you want",
                    "the event to last.",
                    "Current number of rounds: [^0000FF"+ .rounds +"^000000]";
                next;
                if (input(.@rounds,.min,.max)) {
                    .@rounds = .min;
                }
                .rounds = .@rounds;
                mes .@n$,
                    "The number of rounds has been",
                    "changed to "+ .rounds +".";
                break;
 
            case 3:
                mes "Tell me the Item ID of the prize ",
                    "to be given each round.",
                    "Current item: [^0000FF"+ getitemname(.prize_item) +"^000000]";
                next;
                input .@prize;
                if (getitemname(.@prize) == "null") {
                    mes "That item does not exist.",
                        "Please try again.";
                    close;
                }
                .prize_item = .@prize;
                mes "Input the amount to be given.";
                next;
                mes .@n$;
                if (input(.@amount,1,10000)) {
                    mes "That amount is invalid.",
                        "Using a default amount of 1.";
                    .@amount = 1;
                    next;
                    mes .@n$;
                }
                .prize_amount = .@amount;
                mes "Successfully changed prize.",
                    "Prize: "+ .prize_amount +"x [^0000FF"+ getitemname(.prize_item) +"^000000]";
                break;
        }
        break;
}
close;
 
OnInit:
    .gm_level = 60;
    .rounds = 10;
    .prize_item = Red_Potion;
    .prize_amount = 10;
    .min = 3;
    .max = 10;
 
    // What disguise rule, the NPC should follow by default.
    // 0 = Disguise as all monsters | 1 = Disguise as MVPs only
    // Default: 1
    .disguise_option = 1;
    setarray .disguise_desc$[0],"Disguise as all monsters.", "Disguise as MVPs only.";
 
    // Whether or not to block surrounding cells from players during event.
    // 0 = Disabled, 1 = 1x1 | 2 = 2x2 | 9 = 9x9
    // Default: 0 (Disabled).
    .block_cells = 3;
 
    // Minutes before event starts
    .start_delay = 3;
 
    // Seconds of intermission before transforming again
    .change_delay = 10;
 
    // MVP List
    setarray .MVP[0], OSIRIS, BAPHOMET, DOPPELGANGER, MISTRESS, GOLDEN_BUG, ORK_HERO, DRAKE, EDDGA, MAYA, MOONLIGHT,
              PHARAOH, PHREEONI, ORC_LORD, KNIGHT_OF_WINDSTORM, GARM, DARK_LORD, TURTLE_GENERAL, LORD_OF_DEATH, DRACULA, EVENT_BAPHO,
              DARK_SNAKE_LORD, INCANTATION_SAMURAI, PORING_V, AMON_RA, TAO_GUNKA, RSX_0806, BACSOJIN_, B_SEYREN, B_EREMES, B_HARWORD,
              B_MAGALETA, B_SHECIL, B_KATRINN, B_YGNIZEM, APOCALIPS_H, LADY_TANEE, THANATOS, DETALE, KIEL_, RANDGRIS,
              GLOOMUNDERNIGHT, KTULLANUX, ATROCE, G_MAGALETA_, IFRIT, FALLINGBISHOP, BEELZEBUB_, GOPINICH, MOROCC_, KUBLIN,
              S_NYDHOG, BOITATA;
 
    if(checkre(0)){
        setarray .MVP[getarraysize(.MVP)], QUEEN_SCARABA, LOST_DRAGON, LEAK, I_QUEEN_SCARABA;
    }
 
    // DO NOT CHANGE THE BELOW !!
    // Since this is a custom event, it should be made to support custom monsters !!
    // To increase mosnter range, simply increase the value of .last_mobid
    // Default: 5000
    .last_mobid = 5000;
    freeloop(1);
    for( .@i = SCORPION; .@i < .last_mobid; .@i++ ) {
        if( !getmobdrops( ( .@i ) ) ) {
        .blacklist[.@i] = .@i;
        }
    }
    freeloop(0);
    end;
    
OnClock0000:
OnClock0200:
OnClock0400:
OnClock0600:
OnClock0800:
OnClock1000:
OnClock1200:
OnClock1400:
OnClock1600:
OnClock1800:
OnClock2000:
OnClock2200:
iStartEvent:
    if (.event_onoff) {
        end;
    }
    .change = .round_count = 0;
    .event_onoff = 1;
    announce "The Disguise Event will begin in "+ .start_delay +" minute"+ ( (.start_delay > 1)?"s":"") +".",bc_all | bc_blue;
    announce "The Event is being held in "+ strnpcinfo(4) +".",bc_all | bc_blue;
    
    iSleepTimer:
        sleep 60000;
        ++.@minute;
        if (!.event_onoff) {
            end;
        }
        if( .@minute != .start_delay ) {
            announce "The Disguise Event will begin in "+ ( .start_delay - .@minute ) +" minute"+ ( (.start_delay - .@minute > 1)?"s":"") +".",bc_all | bc_blue;
            announce "The Event is being held in "+ strnpcinfo(4) +".",bc_all | bc_blue;
            callsub iSleepTimer;
        }
        if (!.event_onoff) {
            end;
        }
        announce "The Disguise Event has begun!",bc_all | bc_blue;
        announce "The Event is being held in "+ strnpcinfo(4) +".",bc_all | bc_blue;
        
        iDisguise:
            if (!.event_onoff) {
                end;
            }
            if (.change) {
                sleep (.change_delay * 1000);
            }
            .change = .winner = 0;
            switch(.disguise_option) {
                case 1:
                    .@monster = rand(SCORPION, .last_mobid);
                    if (compare(.blacklist$, ","+ .@monster +",")) {
                        callsub iDisguise;
                    }
                    if (getmonsterinfo(.@monster, 0) == .last_monster$) {
                        callsub iDisguise;
                    }
                    .last_monster$ = .monster_name$ = getmonsterinfo(.@monster, 0);
                    break;
                
                case 2:
                    .@i = rand(getarraysize(.MVP));
                    if (getmonsterinfo(.MVP[.@i], 0) == .last_monster$) {
                        callsub iDisguise;
                    }
                    .last_monster$ = .monster_name$ = getmonsterinfo(.MVP[.@i], 0);
                    .@monster = .MVP[.@i];
                    break;
            }
            setnpcdisplay strnpcinfo(3), .@monster;
            setnpctimer 0;
            initnpctimer;
            callsub iSetPset,1;
            end;
 
iSetPset:
    deletepset 1;
    if (getarg(0)) {
        defpattern 1, "([^:]+):.\\s*"+ .monster_name$ +".*", "iCorrect";
    }
    activatepset 1;
    return;
    end;
 
OnTimer30000:
    stopnpctimer;
    setnpcdisplay strnpcinfo(3), 4_M_NFDEADMAN;
    specialeffect EF_DETECT2;
    npctalk "You took too long to guess what I was. Please wait "+ .change_delay +" second"+((.change_delay > 1)"s":"")+" while I disguise again.";
    .monster_name$ = "";
    callsub iSetPset;
    .change = 1;
    callsub iDisguise;
    end;
    
iCorrect:
    if (.winner) {
        dispbottom "Someone has already won this round.";
        end;
    }
    .winner = 1;
    ++.round_count;
    callsub iSetPset;
    getitem .prize_item, .prize_amount;
    announce strcharinfo(0) +" is correct!! I was disguised as: "+ .monster_name$ +"",bc_map | bc_blue;
    setnpcdisplay strnpcinfo(3), 4_M_NFDEADMAN;
    if (.round_count >= .rounds) {
        npctalk "Thank you all for playing. That was the last round of the Disguise Event. Come play again later.";
        .event_onoff = 0;
        stopnpctimer;
        end;
    }
    npctalk "Please wait "+ .change_delay +" second"+((.change_delay > 1)?"s":"")+", while I disguise again.";
    setnpctimer 0;
    stopnpctimer;
    .change = 1;
    callsub iDisguise;
    end;
}
Viewed 1144 times, submitted by Guest.