viewing paste rwc 2012 NPC v1.2 | 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 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 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
//v 1.2
prontera,147,59,5   script  Goldberg#0  878,{
function ordinal_suffix;
function f_itm_menu;
set .npc$, "["+strnpcinfo(1)+"]"; //NPC Name
set .mode, atoi(strnpcinfo(2));
 
    if(!.mode) {
        mes .npc$;
        mes "Hello there!";
        mes "I can enchant or remove enchantments";
        mes "from your 2012 RWC accessory items!"; next;
    } else if(.mode<3) {
        mes .npc$;
        mes "Hello there!";
        mes "I can add a slot to your RWC";
        mes "2012 accessory items!";
        mes "^FF0000Any enchantments over the first";
        mes "slot will be lost in the process!^000000"; next;
    } else {
        mes .npc$;
        mes "Hello there!";
        mes "I can slot or enchant your RWC";
        mes "2012 accessory items!";
        mes "^FF0000Any enchantments over the first";
        mes "slot will be lost in the process!^000000"; next;
    }
        switch(select(((.mode)?"Chamber Accessory"+((.mode>1)?":Enchant:Remove Enchantments":""):"Enchant:Remove Enchantments")+":Cancel")) {
            case 1:
                if(!.mode) {
                    mes .npc$;
                    mes "Which RWC Accessory item would you like to enchant?"; next;
                    f_itm_menu();
                    goto L_Slots;
                } else {
                    mes .npc$;
                    mes "Which RWC Accessory do you want me to slot?"; next;
                    f_itm_menu();
                    break;
                }
            case 2:
                if(!.mode) {
                    mes .npc$;
                    mes "Select the RWC Accessory you would like me to remove the enchantments from."; next;
                    f_itm_menu();
                    goto L_RMV;
                } else if (.mode>1) {
                    mes .npc$;
                    mes "Which RWC Accessory item would you like to enchant?"; next;
                    f_itm_menu();
                    goto L_Slots;
                }
            case 3:
                if (.mode>1) {
                    mes .npc$;
                    mes "Select the RWC Accessory you would like me to remove the enchantments from."; next;
                    f_itm_menu();
                    goto L_RMV;
                }
            case 4:
                goto L_Exit;
        }
    
    if(!compare(.slot$,""+@eq_id)) {
        mes .npc$;
        mes "That item cannot be slotted.";
        close;
    }
    while(.@i++<=4)
        setd(".@o_crd"+.@i, getequipcardid(@eq_loc,.@i-1));
    mes .npc$;
    mes "Are you sure you wish to continue?";
    mes "^FF0000There is a "+.pert+"% chance that";
    mes "the slotting process will fail and";
    mes "your item will break.^000000"; next;
    if(select("Yes:No")&2) goto L_Exit;
    if(rand(100)>=.pert) {
        delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
        getitem2 (@eq_id+1), 1, 1, @eq_rf, 0, 0, .@o_crd2, .@o_crd3, .@o_crd4;
        misceffect 101;
        sleep2 1300;
        misceffect .efet;
        mes .npc$;
        mes "Perfection!!";
        emotion e_no1,0;
        equip @eq_id;
    } else {
        delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
        misceffect 101;
        sleep2 1300;
        misceffect .afet;
        mes .npc$;
        mes "The metal was too weak and the drill went right through... I'm Sorry!";
        emotion e_sob,0;
    }
    close;
    
L_Slots:
    set .@menu$, ""; set .@a, 0;
    while(set(.@a,.@a+1)<=4) {
        setd(".@o_crd"+.@a, getequipcardid(@eq_loc,.@a-1));
        if(getequipcardid(@eq_loc,.@a-1))
            set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [^a92435"+getitemname(getequipcardid(@eq_loc,.@a-1))+"^000000]:";
        else if(getitemslots(@eq_id)-.@a>=0)
            set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [Chambered]:";
        else
            set .@menu$, .@menu$+ ordinal_suffix(.@a)+" Slot - [^30ad25"+((getd(".@crd"+.@a))?"^800080"+getd(".@typ"+.@a+"$"):"Empty")+"^000000]:";
    } set .@menu$, .@menu$+"[^0000FFEnchant!^000000]";
 
    mes .npc$;
    mes "Select a slot.";
    mes "Choose '^0000FFEnchant^000000' when you're done!"; next;
    set .@menu, select(.@menu$)-1;
    if(getequipcardid(@eq_loc,.@menu)&&getitemslots(@eq_id)-(.@menu+1)<0) {
        if(.remv) {
            mes .npc$;
            mes "Would you like me to remove this enchantment?"; next;
            if(select("Yes:No")&2) goto L_Exit;
            delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
            setd(".@o_crd"+(.@menu+1), 0);
            getitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
            equip @eq_id;
            goto L_Slots;
        } else {
            mes .npc$;
            mes "Sorry I can't do anything with this slot without a "+getitemname(.cure)+"."; next;
            goto L_Slots;
        }
    } else if(getitemslots(@eq_id)-(.@menu+1)>=0) {
        mes .npc$;
        mes "I cannot do anything with Chambered slots!"; next;
        goto L_Slots;
    }
    
    if((.@menu+1)>4) {
        if(!(.@crd1+.@crd2+.@crd3+.@crd4)) {
            mes .npc$;
            mes "You haven't done anything!";
            next;
            goto L_Slots;
        }
        mes .npc$;
        mes "Are you sure you wish to continue?";
        mes "^FF0000There is a "+.perc+"% chance that";
        mes "the enchantment will fail and";
        mes "your item will break.^000000"; next;
        if(select("Yes:No")&2) goto L_Exit;
        if(rand(100)>=.perc) {
            delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
            getitem2 @eq_id, 1, 1, @eq_rf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
            misceffect 101;
            sleep2 1300;
            misceffect .efet;
            mes .npc$;
            mes "Wow, that's one strong item!";
            equip @eq_id;
        } else {
            delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
            misceffect 101;
            sleep2 1300;
            misceffect .afet;
            mes .npc$;
            mes "I'm sorry, the item wasn't able to support the enchantment and broke!";
        }
        close;
    }
    
    set(.@g$,"");
    if(@eq_id!=2966&&.@menu>1&&@eq_id!=2967) {
        set(.@g$,"1");
    } else if(.@menu>1) set(.@g$,"0");
    
    select(getd(".menu"+.@g$+(.@menu+1)+"$"));
    set .itm,   ((.@menu==1&&@menu>.t_len)?.itm04[rand(getarraysize(.itm04))]:4700+(((@menu-1)*10)+rand(.limi)));
    setd(".@crd"+(.@menu+1),getd(".itm"+.@g$+((.@menu>1)?@menu+"["+rand(getarraysize(getd(".itm"+.@g$+@menu)))+"]":"")));
    setd(".@typ"+(.@menu+1)+"$",getd(".ary"+.@g$+(.@menu+1)+"$["+(@menu-1)+"]"));
    goto L_Slots;
    
L_RMV:
    if(!countitem(.cure)) {
        mes .npc$;
        mes "I'm sorry but you need at least one "+getitemname(.cure)+" before we may continue.";
        close;
    }
    while(.@i++<=4)
        setd(".@o_crd"+.@i, getequipcardid(@eq_loc,.@i-1));
    if(!((getitemslots(@eq_id)?0:.@o_crd1)+.@o_crd2+.@o_crd3+.@o_crd4)) {
        mes .npc$;
        mes "There isn't anything I can remove on that accessory.";
        close;
    }
    mes .npc$;
    mes "Are you sure that you want to remove your enchantments?";
    mes "^FF0000This option won't effect your chambered card slot.^000000"; next;
    if(select("Yes:No")&2) goto L_Exit;
    misceffect 103;
    delitem(.cure,1);
    delitem2 @eq_id, 1, 1, @eq_rf, 0, .@o_crd1, .@o_crd2, .@o_crd3, .@o_crd4;
    getitem2 @eq_id, 1, 1, @eq_rf, 0, (getitemslots(@eq_id)?.@o_crd1:0), 0, 0, 0;
    mes .npc$;
    mes "Your enchantments where removed!";
    close;
    
L_Exit:
    mes .npc$;
    mes .message$[rand(getarraysize(.message$))];
    close;
    
    function    ordinal_suffix  {
        set(.@i,getarg(0));
        set(.@j,.@i%10);
        if (.@j == 1 && .@i != 11)
            return .@i + "st";
        if (.@j == 2 && .@i != 12)
            return .@i + "nd";
        if (.@j == 3 && .@i != 13)
            return .@i + "rd";
        return .@i + "th";
    }
 
    function    f_itm_menu  {   
        while(set(.@a,.@a+1)<=.e_len) {
            if(compare(.e_itl$[.@a-1],""+getequipid(.e_loc[.@a-1])))
                set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.e_loc[.@a-1]))+"^000000]:";
            else set .@menu$, .@menu$+"^adb4be"+.eqp$[.@a-1]+"- [Empty]^000000:";
        }
        set @menu, select(.@menu$)-1;
        set @eq_loc, .e_loc[@menu];
        set @eq_id, getequipid(@eq_loc);
        set @eq_rf, getequiprefinerycnt(@eq_loc);
        
        if(!compare(.e_itm$,""+@eq_id )) {
            mes .npc$;
            mes "Sorry I don't recognize that equipment.";
            close;
        }
    } return;
    
//NPC Constants
    OnInit:
        //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-=
        set      .perc  ,    25; //enchantment fail percent
        set      .pert  ,    50; //slotting fail percent
        set      .efet  ,    154; //Success Effect Number
        set      .afet  ,    155; //Fail Effect Number
        set      .remv  ,    0; //Allows the NPC to remove enchantments without Item. (1=On/0=Off)
        set      .cure  ,    6665; //Item used to remove enchantments
        set      .limi  ,    3; //Limit for status orb enchantments.
        setarray .message$,     //List of random closing messages.
            "Maybe next time then.",
            "Alright, thanks anyway!",
            "Alright maybe next time then.",
            "Uhm, ok- See you around then.",
            "Wise choice, although you'll probably"+
            "never get anywhere with that attitude.";
            
        set .slot$, "2966|2968"; //Items that can be slotted.
        
        setarray .ary1$, "Strength(STR)", "Intelligence(INT)", "Dexterity(DEX)", "Agility(AGI)", "Vitality(VIT)", "Luck(LUK)";
        copyarray .ary2$[0],.ary1$[0],128;
        set .t_len, getarraysize(.ary2$);
        set .ary2$[.t_len], "Health Points";
 
        setarray .ary03$, "Fighting Spirit", "Physical Attack Percent(ATK%)", "Maximum Health Points(MHP%)", "Health Points";
        setarray .itm01  ,  4811, 4810, 4809; //Fighting Spirit
        setarray .itm02  ,  4819, 4766, 4767; //ATK(%)
        setarray .itm03  ,  4861, 4862, 4867; //MHP
        setarray .itm04  ,  4795, 4796, 4797; //HP
        copyarray .ary04$[0],.ary03$[0],128;
 
        setarray .ary13$, "Magic Attack Percent(MATK%)", "Casting Rate & Damage(Spell)", "Special Points(SP)";
        setarray .itm11  ,  4760, 4761, 4806; //MATK(%)
        setarray .itm12  ,  4815, 4814, 4813; //Spell
        setarray .itm13  ,  4870, 4800, 4871; //SP
        copyarray .ary14$[0],.ary13$[0],128;
 
        setarray .eqp$  ,    "Accessory1", "Accessory2"; //Menu3
        set      .e_len ,    getarraysize(.eqp$);
        setarray .e_itl$,    "2966|2967|2968|2969",
                             "2966|2967|2968|2969"; //Equip Items
        setarray .e_loc ,    7, 8; //Equip Locations
        set      .e_itm$,    implode(.e_itl$,",");
        set      .menu1$,    implode(.ary1$,":");
        set      .menu2$,    .menu1$+":"+.ary03$[3];
        set      .menu03$,   implode(.ary03$,":");
        set      .menu04$,   .menu03$;
        set      .menu13$,   implode(.ary13$,":");
        set      .menu14$,   .menu13$;
        //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-=
}
 
prontera,147,61,5   duplicate(Goldberg#0)   Driller#1   87
 
prontera,147,63,5   duplicate(Goldberg#0)   Goldentheifberg#3   87
Viewed 1908 times, submitted by Skorm.