viewing paste Unknown #33227 | Text

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
//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.3
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
//= Event_THQS - Used to check if you have already registered
//= #Treasure_Token - used to keep track of tokens
//= 1.0 - Straight conversion of Aegis NPC file
//= 1.1 - balanced some prices, fixed 1 missing label
//=       removed Executioner&Mysteltain swords [Lupus]
//= 1.2 - Optmized and fixed small error [Panikon]
//= 1.2a - Fixed zeny formula [Panikon]
//= 1.3 - Added npc name config
//=       Added and changed the menu
//=       Removed ths_menu_weapons function to accommodate
//=       the new menu [Legend]
//============================================================
prt_in,159,172,0        warp    thqwrp  3,3,yuno_in01,123,155
 
// Main configuration object
-       script  THQS#Configuration      FAKE_NPC,{
OnInit:
        // NPC NAME CONFIG
        $npc_name_thq$ = "[Ash]";
       
        // New added menu 2 (special items)
        setarray $THQS_menu_SpIt[0],Dragon_Slayer,Bow_Of_Roguemaster,Longinus's_Spear,Robe_Of_Casting;
        setarray $THQS_menu_SpIt_price[0],200,200,200,300;
       
    // Cards
    setarray $THQS_menu_cards[0],SLD_Garm_Card,Knight_Windstorm_Card,Golden_Bug_Card;
    setarray $THQS_menu_price[0],150,200,200;
       
        // New added menu 4 (castle drops)
        setarray $THQS_menu_CD[0],Jewel_Of_Prayer,Iron_Glove,Iron_Maiden;
        setarray $THQS_menu_CD_price[0],200,200,200;
    end;
}
 
// Trades tokens
// getarg(0) - number of tokens to be traded
function        script  thqs_trade_token        {
    @type = getarg(0);
    if( @type == 4 )
        close;
 
    // 10^0, 10^1, 10^2
    @type -= 1;
    @price = pow(10, @type);
 
    // 10^6 * 5 = 5m, 10^7 * 5 = 50m, 10^8 * 5 = 500m
    @type += 6; // So we can use pow later to determine the qt of Zeny
    @prize = pow(10, @type);
        @fnlprize = @prize * 5;
 
 
    if( #Treasure_Token < @price ) {
        mes "You don't have enough tokens!";
        close;
    }
 
    if( Zeny == MAX_ZENY ) {
        mes "You can't add more zeny to your character";
        close;
    }
       
        Zeny += @fnlprize;
        #Treasure_Token -= @price;
        close;
}
 
// Creates a buying menu
// getarg(0) - .@mw$ -> ID
// getarg(1) - .@mp$ -> PRICE
function        script  thqs_menu_buy   {
    if( getargcount() != 2 ) {
        debugmes "thqs_menu_buy: Wrong number of arguments!!";
        close;
    }
 
    .@mw$ = getarg(0);
    .@mp$ = getarg(1);
 
    if( getarraysize( getd(.@mw$) ) != getarraysize( getd(.@mp$) ) ) {
        debugmes "thqs_menu_buy: Missing entries in data!";
        close;
    }
 
    // Dynamic menu
    // Uses a dynamic string and then applies it to a *select
    .@select_menu$ = "";
    for( .@i = 0; .@i < getarraysize( getd(.@mw$) ); .@i++ ) {
        .@price = getd(.@mp$+"["+.@i+"]");
 
        if( .@select_menu$ != "")
            .@select_menu$ = .@select_menu$+":"+getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T";
        else
            .@select_menu$ = getitemname( getd(.@mw$+"["+.@i+"]") )+" - "+.@price+"T";
    }
    .@select_menu$ = .@select_menu$ + ":Nevermind";
    select(.@select_menu$);
 
    if( @menu == (.@i+1) )
        close;
 
    @index = @menu - 1; // Arrays are 0 indexed while our menu is not
    @item_id = getd(.@mw$+"["+@index+"]");
    @price = getd(.@mp$+"["+@index+"]");
    if( #Treasure_Token < @price ) {
                mes $npc_name_thq$;
        mes "You don't have enough tokens!";
        close;
    }
    #Treasure_Token -= @price;
    logmes "Treasure Token: Bought a "+getitemname(@item_id);
    getitem @item_id,1;
    close;
}
 
// Main script
prt_in,164,174,1        script  Treasure Hunter's Shop  1_M_YOUNGKNIGHT,{
    mes $npc_name_thq$;
    mes "Ahh, "+strcharinfo(0)+"! Welcome to the Offical Treasure Hunter's Guild Shop.";
    mes "You currently have ^FF0000"+#Treasure_Token+"^000000 treasure tokens!!!";
    next;
    switch( select("How does this place work?","What do you have in stock?","Nevermind") ) {
        case 1:
            mes $npc_name_thq$;
            mes "Well you see here you can exchange your treasure hunter tokens for zeny or rare weapons forged by our blacksmiths.";
            mes " ";
            mes "Everything has its own price value and the only way you can get the tokens is by completing quests assigned to you,the system normally works like this.";
            mes " ";
            mes "The harder the mission the more Tokens you will earn. All red quests are worth 4-8 Tokens, and the rest are worth 1-5.";
            mes " ";
            mes "Hope that solves your problem and questions.";
            close;
        case 2:
            break;
        case 3:
            close;
    }
 
    mes $npc_name_thq$;
    mes "Ok here is our Big list of goods.";
    mes " ";
    mes "(Note T stands for a Treasure Token.)";
    next;
    mes $npc_name_thq$;
    mes "This is what we have to offer.";
    next;
    switch( select("Trade for Zeny", "Trade for Special Items", "Trade for Cards","Trade for Castle Drops", "Nevermind") ) {
        case 1:
            select("5,000,000z - 1T","50,000,000z - 10T","500,000,000z - 100T","Nevermind");
            thqs_trade_token(@menu);
        case 2:
            mes $npc_name_thq$;
            mes "This is what we have to offer.";
                        next;
                        thqs_menu_buy("$THQS_menu_SpIt","$THQS_menu_SpIt_price");
        case 3:
            mes $npc_name_thq$;
            mes "This is what we have to offer.";
            next;
            thqs_menu_buy("$THQS_menu_cards","$THQS_menu_price");
        case 4:
            mes $npc_name_thq$;
            mes "This is what we have to offer.";
                        next;
                        thqs_menu_buy("$THQS_menu_CD","$THQS_menu_CD_price");
                case 5:
                        close;
    }
    end;
}
Viewed 549 times, submitted by unknown.