Jump to content
  • 0

Need to add GM Reset Command In Hunting Mission


Question

Posted (edited)

Hello Everyone...

This script working fine.. i just need to do some modification of adding GM reset so all status will be reset to 0 again and can start new count is it possible to add ?

If possible please reply..!! @Elysium

Thanks in Advance.!!

//===== rAthena Script =======================================
//= Hunting Missions
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: ===================================== 
//= rAthena Project
//===== Description: =========================================
//= Random hunting missions.
//= Rewards are based on quest difficulty.
//= 
//= NOTE: Requires SQL mob database.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.1 Small improvements and fixes.
//= 1.2 Added party support and replaced blacklists with an
//=     SQL query, both thanks to AnnieRuru.
//= 1.3 Re-added a blacklist adapted for the SQL query.
//= 1.3a Added mission reset options.
//= 1.3b Function updates.
//= 1.4 Check for deleted characters, thanks to AnnieRuru.
//=     Syntax updates and style cleaning.
//============================================================

prontera,141,174,6    script    Hunting Missions    494,{
cutin "162elena_01",2;
function Chk;
    mes "[Hunting Missions]";
    mes "Hello, " + strcharinfo(0) + "!";
    if (!#Mission_Delay) {
        next;
        mes "[Hunting Missions]";
        mes "I can't find any records...";
        mes "You must be new here!";
        emotion ET_HUK;
        next;
        callsub Mission_Info;
        emotion ET_GO;
        #Mission_Delay = 1;
        close2;
                cutin "162elena_01",255;
                end;


    }
    mes rand(2) ? "Working hard, as always..." : "Not slacking, I hope...";
    mes "Is there anything I can help";
    mes "you with?";
    mes " ";
    mes "^777777~ You've completed " + callfunc("F_InsertPlural",Mission_Total,"mission",0,"^0055FF%d^777777 %s") + ". ~^000000";
    next;
    switch(select(
        ((!Mission0) ? " ~ New Mission::" : ": ~ Mission Status: ~ Abandon Mission") +
        ": ~ Information:~ View Top Hunters: ~ ^777777Cancel^000000")) {
         //~ Mission Shop:
    //)) {
    case 1:
        mes "[Hunting Missions]";
        if (#Mission_Count) {
            mes "You've started a mission";
            mes "on another character.";
            if (!@hm_char_del_check) {  // check for deleted character
                query_sql("SELECT 1 FROM `char_reg_num` WHERE `key` = 'Mission0' AND `char_id` IN(SELECT `char_id` FROM `char` WHERE `account_id` = " + getcharid(3) + ")", .@i);
                if (!.@i) {
                    next;
                    mes "[Hunting Missions]";
                    mes "I can't seem to find any records";
                    mes "for that character, though...";
                    mes "One moment, please.";
                    emotion ET_SCRATCH;
                    #Mission_Count = 0;
                }
                @hm_char_del_check = 1;
            }        
                    close2;
            cutin "162elena_01",255;
            end;
        }
        if (#Mission_Delay > gettimetick(2) && .Delay) {
            mes "I'm afraid you'll have to wait " + callfunc("Time2Str",#Mission_Delay) + " before taking another mission.";
                        close2;
                        cutin "162elena_01",255;
                        end;
        }
        mes "You must hunt:";
        query_sql("SELECT ID FROM `" + .mob_db$ + "` WHERE left(Sprite, 4) != 'meta' AND left(Sprite, 2) != 'E_' AND ~Mode & 32 AND EXP > 0 AND MVP1id = 0 AND DropCardid > 4000 AND DropCardid < 5000 AND ID < 2000 AND instr('"+.Blacklist$+"',ID) = 0 ORDER BY rand() LIMIT " + .Quests, .@mob);
        for (.@i = 0; .@i < .Quests; .@i++) {
            setd "Mission" + .@i, .@mob[.@i];
            setd "Mission" + .@i +"_", 0;
        }
        #Mission_Count = rand(.Count[0], .Count[1]);
        callsub Mission_Status;
        next;
        mes "[Hunting Missions]";
        mes "Report back when";
        mes "you've finished.";
        mes "Good luck!";
                close2;
                cutin "162elena_01",255;
                end;
    case 2:
        mes "[Hunting Missions]";
        mes "Mission status:";
        callsub Mission_Status;
                close2;
                cutin "162elena_01",255;
                end;
    case 3:
        mes "[Hunting Missions]";
        mes "Do you really want to";
        mes "abandon your mission?";
        if (.Reset < 0 && .Delay)
            mes "Your delay time will not be reset.";
        else if (.Reset > 0)
            mes "It will cost " + callfunc("F_InsertComma",.Reset) + " Zeny.";
        next;
        switch(select(" ~ Abandon...: ~ ^777777Cancel^000000")) {
        case 1:
            if (.Reset > 0) {
                if (Zeny < .Reset) {
                    mes "[Hunting Missions]";
                    mes "You don't have enough";
                    mes "Zeny to drop this mission.";
                    emotion ET_SORRY;                    
                                        close2;
                                        cutin "162elena_01",255;
                                        end;
                }
                Zeny -= .Reset;
                emotion ET_MONEY;
            }
            mes "[Hunting Missions]";
            mes "Alright, I've dropped";
            mes "your current mission.";
            specialeffect2 EF_STORMKICK4;
            for (.@i = 0; .@i < .Quests; .@i++) {
                setd "Mission"+.@i, 0;
                setd "Mission"+.@i+"_", 0;
            }
            #Mission_Count = 0;
            if (.Reset < 0 && .Delay)
                #Mission_Delay = gettimetick(2) + (.Delay * 3600);            
                        close2;
                        cutin "162elena_01",255;
                        end;
        case 2:
            mes "[Hunting Missions]";
            mes "I knew you were kidding!";
            mes "Keep up the good work.";
            emotion ET_SMILE;            
                        close2;
                        cutin "162elena_01",255;
                        end;
        }
    case 4:
        callsub Mission_Info;
                close2;
                cutin "162elena_01",255;
                end;
    /*case 5:
        mes "[Hunting Missions]";
        mes "You have ^0055FF" + #Mission_Points + "^000000 Mission Points.";
        mes "Use them well!";
        callshop "missionshop",1;
        end;*/
    case 5:
        mes "[Hunting Missions]";
        mes "The top hunters are:";
        query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `char_reg_num` WHERE `key` = 'Mission_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5", .@id, .@name$, .@val);
        for (.@i = 0; .@i < 5; .@i++)
            mes "  [Rank " + (.@i+1) + "]  " + ((.@name$[.@i] == "") ? "^777777none" : "^0055FF" + .@name$[.@i]+"^000000 : ^FF0000" + .@val[.@i] + " pt.") + "^000000";
                close2;
                cutin "162elena_01",255;
                end;

    case 6:
        mes "[Hunting Missions]";
        mes "Nothing? Okay...";
        emotion ET_SCRATCH;
        close2;
        cutin "162elena_01",255;
        end;
    }
    end;

Mission_Status:
    @f = 0;
    deletearray .@j[0], getarraysize(.@j);
    for (.@i = 0; .@i < .Quests; .@i++) {
        .@j[.@i] = getd("Mission" + .@i);
        .@j[.Quests] = .@j[.Quests] + strmobinfo(3,.@j[.@i]);
        .@j[.Quests+1] = .@j[.Quests+1] + (strmobinfo(6,.@j[.@i]) / (getbattleflag("base_exp_rate") / 100) * .Modifier[0]);
        .@j[.Quests+2] = .@j[.Quests+2] + (strmobinfo(7,.@j[.@i]) / (getbattleflag("job_exp_rate") / 100) * .Modifier[1]);
        mes " > "+Chk(getd("Mission"+.@i+"_"),#Mission_Count) + strmobinfo(1,.@j[.@i]) + " (" + getd("Mission"+.@i+"_") + "/" + #Mission_Count + ")^000000";
    }

    // Reward formulas:
    .@Mission_Points = 3 + (.@j[.Quests] / .Quests / 6);
    .@Base_Exp = #Mission_Count * .@j[.Quests+1] / 5;
    .@Job_Exp = #Mission_Count * .@j[.Quests+2] / 5;
    .@Zeny = #Mission_Count * .Quests * .@j[.@i] * .Modifier[2];

    next;
    mes "[Hunting Missions]";
    mes "Mission rewards:";
    //mes " > Mission Points: ^0055FF" + .@Mission_Points + "^000000";
    mes " > Base Experience: ^0055FF" + callfunc("F_InsertComma",.@Base_Exp) + "^000000";
    mes " > Job Experience: ^0055FF" + callfunc("F_InsertComma",.@Job_Exp) + "^000000";
    //mes " > Zeny: ^0055FF" + callfunc("F_InsertComma",.@Zeny) + "^000000";
    mes " > Zeny: you will be rewarded ranging 500,000z to 1,000,000";
    mes " > Special Prize: ^0055FF 6 BLACK TREASURE BOX^000000";
    mes " > 90% Chance to get this Rare reward: ^0055FF1 Ancient Silver Coin^000000";
    if (@f) {
        @f = 0;
        return;
    }
    next;
    mes "[Hunting Missions]";
    mes "Oh, you're done!";
    mes "Good work.";
    set .@FINISHERNAME$, strcharinfo(0);
    mes "Here's your reward.";
    emotion ET_BEST;
    specialeffect2 EF_ANGEL;
    specialeffect2 EF_TRUESIGHT;
    //#Mission_Points += .@Mission_Points;
    BaseExp += .@Base_Exp;
    JobExp += .@Job_Exp;
    //Zeny += .@Zeny;
    .@zenyrand = rand(100000,2000000);
    Zeny += .@zenyrand;
    getitem 12715,10; //Treasure Box
    getitem 7960,1;
    announce "Player [ "+.@FINISHERNAME$+" ] has completely done doing Hunting Mission, More POWER to you!.",bc_all;
    for (.@i = 0; .@i < .Quests; .@i++) {
        setd "Mission" + .@i, 0;
        setd "Mission" + .@i+"_", 0;
    }
    #Mission_Count = 0;
    if (.Delay)
        #Mission_Delay = gettimetick(2) + (.Delay * 3600);
    Mission_Total++;
    if (Mission_Total == 1)
        query_sql("INSERT INTO `char_reg_num` (`char_id`,`key`,`index`,`value`) VALUES (" + getcharid(0) + ",'Mission_Total','0',1)");
    else
        query_sql("UPDATE `char_reg_num` SET `value` = " + Mission_Total + " WHERE `char_id` = " + getcharid(0) + " AND `key` = 'Mission_Total'");
        close2;
        cutin "162elena_01",255;
        end;


Mission_Info:
    mes "[Hunting Missions]";
    mes "If you so choose, I can assign";
    mes "you a random hunting quest.";
    mes "Some are easier than others, but";
    mes "the rewards increase with difficulty.";
    next;
    mes "[Hunting Missions]";
    mes "Missions points are shared";
    mes "amongst all your characters.";
    if (.Delay)
        mes "Delay time is, too.";
    mes "You can't take missions on";
    mes "multiple characters at once.";
    next;
    mes "[Hunting Missions]";
    mes "You can start a quest";
    mes (.Delay ? "every " + ((.Delay == 1) ? "hour." : .Delay + " hours.") : "whenever you want.");
    mes "That's everything~";
    return;

function Chk {
    if (getarg(0) < getarg(1)) {
        @f = 1;
        return "^FF0000";
    } else
        return "^00FF00";
}


OnNPCKillEvent:
    if (!getcharid(1) || !.Party) {
        if (!#Mission_Count || !Mission0) end;
        for (.@i = 0; .@i < .Quests; .@i++) {
            if (strmobinfo(1,killedrid) == strmobinfo(1,getd("Mission" + .@i))) {
                if (getd("Mission" + .@i + "_") < #Mission_Count) {
                    dispbottom "[Hunting Mission] Killed " + (set(getd("Mission" + .@i + "_"),getd("Mission" + .@i + "_") + 1)) +
                               " of " + #Mission_Count + " " + strmobinfo(1,killedrid) + ".";
                    end;
                }
            }
        }
    } else if (.Party) {
        .@mob = killedrid;
        getmapxy(.@map1$,.@x1,.@y1,BL_PC);
        getpartymember getcharid(1),1;
        getpartymember getcharid(1),2;
        for (.@i = 0; .@i < $@partymembercount; .@i++) {
            if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) {
                set .@Mission_Count, getvar(#Mission_Count, $@partymembercid[.@i]);
                set .@Mission0, getvar(Mission0, $@partymembercid[.@i]);
                set .@HP, readparam(HP, $@partymembercid[.@i]);

                if (.@Mission_Count && .@Mission0 && .@HP > 0) {
                    getmapxy(.@map2$,.@x2,.@y2,BL_PC);
                    if ((.@map1$ == .@map2$ || .Party == 1) && (distance(.@x1,.@y1,.@x2,.@y2) <= 30 || .Party < 3)) {
                        for (.@j = 0; .@j < .Quests; .@j++) {
                            .@my_mob_id = getvar( getd("Mission"+.@j),$@partymembercid[.@i] );
                            .@my_count = getvar( getd("Mission"+.@j+"_"), $@partymembercid[.@i] );
                            if (strmobinfo(1,.@mob) == strmobinfo(1,.@my_mob_id)) {
                                if (.@my_count < .@Mission_Count) {
                                    setd "Mission"+.@j+"_", (.@my_count+1), $@partymembercid[.@i];
                                    dispbottom "[Hunting Mission] Killed " + (.@my_count+1) + " of " + .@Mission_Count + " " + strmobinfo(1,.@mob) + ".", 0x777777, $@partymembercid[.@i];
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    end;

OnInit:
    .Delay = 5;            // Quest delay, in hours (0 to disable).
    .Quests = 5;            // Number of subquests per mission (increases rewards).
    .Party = 2;             // Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only)
    .Reset = 0;            // Reset options: -1 (abandoning mission sets delay time), 0 (no delay time), [Zeny] (cost to abandon mission, no delay time)
    setarray .Count[0],     // Min and max monsters per subquest (increases rewards).
        25,25;
    setarray .Modifier[0],  // Multipliers for Base Exp, Job Exp, and Zeny rewards. ORIGINALE � /100 /100 60
        getbattleflag("base_exp_rate")/50,getbattleflag("job_exp_rate")/50,2;
    .mob_db$ =              // Table name of SQL mob database
        (checkre(0))?"mob_db_re":"mob_db";
    setarray .Shop[0],      // Reward items: <ID>,<point cost> (about 10~20 points per hunt).
        7619,40,6225,40,12208,50,616,60,7620,60,6226,60,12264,70,6241,80,12214,100,6240,120,13610,160,16259,160,13611,240,16258,240,16395,320,16393,480,12103,500,12246,2000;
    .Blacklist$ =           // Blacklisted mob IDs.
        "1701,1259,1295,1291,1038,1039,1046,1059,1062,1086,1087,1088,1089,1090,1091,1092,1093,1096,1108,1112,1115,1120,1147,1150,"+
        "1631,1632,1391,1157,1159,1183,1186,1190,1198,1200,1203,1204,1205,1212,1220,1221,1234,1235,1244,1245,1250,1251,1252,"+
        "1987,1259,1621,1392,1262,1268,1272,1283,1286,1287,1288,1289,1290,1293,1294,1296,1298,1299,1300,1301,1302,1303,1304,"+
        "1830,1305,1270,1633,1306,1307,1308,1309,1311,1312,1313,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,"+
        "1829,1670,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,"+
        "1356,1735,1668,1357,1358,1359,1360,1361,1362,1363,1373,1388,1389,1395,1396,1397,1398,1399,1418,1447,1449,1456,"+
        "1485,1486,1587,1584,1487,1492,1502,1515,1520,1529,1530,1542,1568,1576,1582,1583,1588,1591,1592,1593,1605,1607,"+
        "1609,1610,1611,1612,1618,1623,1626,1630,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,"+
        "1646,1647,1648,1649,1650,1651,1658,1674,1676,1677,1678,1679,1681,1685,1688,1689,1700,1703,1704,1705,"+
        "1706,1707,1708,1709,1710,1711,1712,1719,1720,1731,1733,1734,1751,1754,1755,1756,1763,1764,1765,1766,"+
        "1767,1768,1779,1783,1785,1791,1795,1796,1797,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,"+
        "1810,1813,1814,1817,1825,1829,1831,1832,1833,1834,1835,1839,1840,1845,1846,1847,1848,1849,1850,1852,"+
        "1853,1870,1871,1872,1873,1874,1876,1877,1879,1885,1889,1891,1894,1897,1899,1902,1903,1904,1905,1906,"+
        "1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1929,"+
        "1930,1931,1932,1933,1934,1935,1936,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1951,1952,1953,"+
        "1954,1956,1957,1958,1959,1960,1961,1962,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,"+
        "1976,1977,1978,1979,1980,1981,1983,1990,1991,2001,2010,2017,2018,2019,2022,2030,2031,2039,2040,2041,"+
        "2052,2057,2067,2068,2079,2080,2087,2093,2097,2102,2106,2107,2135,2138,2139,2140,2141,2142,2143,2156,"+
        "2157,2161,2162,2163,2164,2165,2166,2167,2168,2169,2170,2171,2172,2173,2174,2175,2176,2177,2178,2179,"+
        "2180,2181,2182,2183,2184,2185,2186,2187,2188,2189,2190,2191,2192,2193,2194,2196,2198,2202,2206,2208,"+
        "1247,1861,"+
        "2221,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2249,2251,2253,2255,2288,2317,2318,2319,2320,2321,2322,2323,2325,2326,2327,2328,2329,2332,2333,2335,2336,2337,2341,2342,2345,2346,2347,2348,2349,2350,2351,2362,2378,2408,2409,2410,2411,2413,2415,2416,2417,2419,2420,2421,2422,2423,2424,2425,2426,2427,2441,2442,2443,2444,2445,2446,2447,2448,2449,2473,2474,2475,2476,2482,2528,2529,2530,2532,2533,2534,2535,2540,2541,2542,2562,2563,2564,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,2616,2618,2619,2620,2621,2622,2623,2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2634,2635,2636,2637,2638,2639,2640,2641,2642,2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674,2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690,2691,2692,2693,2694,2695,2696,2697,2698,2699,2700,2701,2702,2703,2704,2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720,2721,2722,2723,2724,2725,2726,2727,2728,2729,2730,2731,2732,2733,2734,2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750,2751,2752,2753,2754,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765,2766,2767,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779,2780,2781,2784,2785,2786,2788,2789,2790,2791,2792,2793,2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809,2810,2811,2812,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824,2825,2826,2827,2828,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840,2841,2842,2843,2844,2845,2846,2847,2849,2850,2851,2852,2853,2854,2855,2856,2857,2858,2859,2860,2861,2862,2863,2864,2865,2866,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2907,2908,2909,2910,2911,2912,2913,2920,2921,2922,2923,2942,2959,2961,2987,2988,2992,2994,2996,2998,2999,3029,3038,3039,3040,3041,3073,3074,3091,3092,3096,3097,3100,3108,3109,3122,3123,3124,3175,3176,3177,3178,3179,3180,3181,3202,3203,3254,3450,3473,3474,3475,3484,3495,3503,3504,3505,3506,3508";
end;
}
//-    pointshop    missionshop    -1,#Mission_Points,501:60,502:60,503:100

hunting_mission.txt

Edited by Mael
Use codebox

1 answer to this question

Recommended Posts

  • 0
Posted
-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "reset",strnpcinfo(3) + "::OnAtcommand";
	end;
	
OnAtcommand:
    query_sql("DELETE FROM `char_reg_num` WHERE `key` LIKE 'Mission%'");
    query_sql("DELETE FROM `acc_reg_num` WHERE `key` LIKE 'Mission%'");
	.quest_count = getvariableofnpc(.Quests, "Hunting Missions");
	addrid(0);
	#Mission_Count = 0;
	#Mission_Delay = 0;
	#Mission_Total = 0;
	@hm_char_del_check = 0;
    for (.@i = 0; .@i < .quest_count; .@i++) {
        setd "Mission" + .@i, 0;
        setd "Mission" + .@i+"_", 0;
    }
	dispbottom "A GM has forced reset your Hunting mission status.";
	end;
}

 

  • Love 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...