Jump to content
  • 0

help Hunting Missions


Question

Posted
//===== rAthena Script =======================================
//= Hunting Missions
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.1a
//===== Description: =========================================
//= Random hunting missions.
//= Rewards are based on quest difficulty.
//============================================================

prontera,155,184,4	script	تحت الاختبار	653,{
function Chk; function Cm;
	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 e_omg;
		next;
		callsub Mission_Info;
		emotion e_go;
		set #Mission_Delay,1;
		close;
	}
	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 ^0055FF"+Mission_Total+"^777777 mission"+((Mission_Total == 1)?"":"s")+". ~^000000";
	next;
	switch(select(((!Mission1)?" ~ New Mission::":": ~ Mission Status: ~ Abandon Mission")+": ~ Information: ~ Mission Shop: ~ View Top Hunters: ~ ^777777Cancel^000000")) {
	case 1:
		mes "[Hunting Missions]";
		if (#Mission_Count) {
			mes "You've started a mission";
			mes "on another character.";
			close;
		}
		if (#Mission_Delay > gettimetick(2) && .Delay) {
			set .@i, #Mission_Delay-gettimetick(2);
			if (.@i > 3600) set .@j$, (.@i/3600)+" hour"+(((.@i/3600) == 1)?"":"s");
			else if (.@i > 60) set .@j$, (.@i/60)+" minute"+(((.@i/60) == 1)?"":"s");
			else set .@j$, (.@i)+" second"+((.@i == 1)?"":"s");
			mes "I'm afraid you'll have to wait "+.@j$+" before taking another mission.";
			close;
		}
		mes "You must hunt:";
		freeloop(1);
		set .@size, getarraysize(.NoRange);
		for (set .@i,0; .@i<.Quests; set .@i,.@i+1) {
			set .@valid,0;
			while (!.@valid) {
				set .@valid,1;
				set .@mob, rand(1001,1999);
				// Is mob ID blacklisted?
				if (compare(.Restrict$[0],""+.@mob) || compare(.Restrict$[1],""+.@mob)) set .@valid,0;
				// Is mob ID interval blacklisted?
				if (.@valid) for(set .@j,0; .@j<.@size; set .@j,.@j+2)
					if (.@mob > .NoRange[.@j] && .@mob < .NoRange[.@j+1]) {
						set .@valid,0;
						break;
					}
				// Is mob a duplicate?
				if (.@valid) for(set .@j,0; .@j<.@i; set .@j,.@j+1)
					if (strmobinfo(1,.@mob) == strmobinfo(1,getd("Mission"+.@j))) {
						set .@valid,0;
						break;
					}
				// Is mob an MVP?
				if (.@valid) if (getmonsterinfo(.@mob,22)) set .@valid,0;
			}
			setd "Mission"+.@i, .@mob;
			setd "Mission"+.@i+"_",0;
		}
		set #Mission_Count, rand(.Count[0],.Count[1]);
		freeloop(0);
		callsub Mission_Status;
		set @f,0;
		next;
		mes "[Hunting Missions]";
		mes "Report back when";
		mes "you've finished.";
		mes "Good luck!";
		close;
	case 2:
		mes "[Hunting Missions]";
		mes "Mission status:";
		callsub Mission_Status;
		if (@f) { set @f,0; close; }
		next;
		mes "[Hunting Missions]";
		mes "Oh, you're done!";
		mes "Good work.";
		mes "Here's your reward.";
		emotion e_no1;
		specialeffect2 377;
		deletearray .@j[0], getarraysize(.@j);
		for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
			set .@j[.@i], getd("Mission"+.@i);
			set .@j[.Quests], .@j[.Quests]+strmobinfo(3,.@j[.@i]);
			set .@j[.Quests+1], .@j[.Quests+1]+strmobinfo(6,.@j[.@i]);
			set .@j[.Quests+2], .@j[.Quests+2]+strmobinfo(7,.@j[.@i]);
			setd "Mission"+.@i,0;
			setd "Mission"+.@i+"_",0;
		}
		set #Mission_Points, #Mission_Points+(3+(.@j[.Quests]/.Quests/6));
		getexp (#Mission_Count*.@j[.Quests+1]/5),(#Mission_Count*.@j[.Quests+2]/5);
		set Zeny, Zeny+(#Mission_Count*.Quests*.@j[.@i]*.Multiplier);
		set #Mission_Count,0;
		if (.Delay) set #Mission_Delay, gettimetick(2)+(.Delay*3600);
		set Mission_Total, Mission_Total+1;
		if (Mission_Total == 1) query_sql("INSERT INTO `global_reg_value` (`char_id`,`str`,`value`,`type`,`account_id`) VALUES ("+getcharid(0)+",'Mission_Total','1',3,0)");
		else query_sql("UPDATE `global_reg_value` SET `value` = "+Mission_Total+" WHERE char_id = "+getcharid(0)+" AND `str` = 'Mission_Total'");
		close;
	case 3:
		mes "[Hunting Missions]";
		mes "Do you really want to";
		mes "abandon your mission?";
		if (.Delay) mes "Your delay time will not be reset.";
		next;
		switch(select(" ~ Abandon...: ~ ^777777Cancel^000000")) {
		case 1:
			mes "[Hunting Missions]";
			mes "Alright, I've dropped";
			mes "your current mission.";
			specialeffect2 462;
			for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
				setd "Mission"+.@i,0;
				setd "Mission"+.@i+"_",0;
			}
			set #Mission_Count,0;
			if (.Delay) set #Mission_Delay, gettimetick(2)+(.Delay*3600);
			close;
		case 2:
			mes "[Hunting Missions]";
			mes "I knew you were kidding!";
			mes "Keep up the good work.";
			emotion e_heh;
			close;
		}
	case 4:
		callsub Mission_Info;
		close;
	case 5:
		mes "[Hunting Missions]";
		mes "You have ^0055FF"+#Mission_Points+"^000000 Mission Points.";
		mes "Use them well!";
		callshop "mission_shop",1;
		npcshopattach "mission_shop";
		end;
	case 6:
		mes "[Hunting Missions]";
		mes "The top hunters are:";
		query_sql("SELECT `name`,CAST(`value` AS SIGNED) FROM `global_reg_value` LEFT JOIN `char` ON `global_reg_value`.char_id = `char`.char_id WHERE `global_reg_value`.str = 'Mission_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5",.@name$,.@val);
		for(set .@i,0; .@i<5; set .@i,.@i+1)
			mes "  [Rank "+(.@i+1)+"]  "+((.@name$[.@i] == "")?"^777777none":"^0055FF"+.@name$[.@i]+"^000000 : ^FF0000"+.@val[.@i]+" pt.")+"^000000";
		close;
	case 7:
		mes "[Hunting Missions]";
		mes "Nothing? Okay...";
		emotion e_hmm;
		close;
	}

Mission_Status:
	set @f,0;
	deletearray .@j[0], getarraysize(.@j);
	for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
		set .@j[.@i], getd("Mission"+.@i);
		set .@j[.Quests], .@j[.Quests]+strmobinfo(3,.@j[.@i]);
		set .@j[.Quests+1], .@j[.Quests+1]+strmobinfo(6,.@j[.@i]);
		set .@j[.Quests+2], .@j[.Quests+2]+strmobinfo(7,.@j[.@i]);
		mes " > "+Chk(getd("Mission"+.@i+"_"),#Mission_Count)+strmobinfo(1,.@j[.@i])+" ("+getd("Mission"+.@i+"_")+"/"+#Mission_Count+")^000000";
	}
	set .@Mission_Points, 3+(.@j[.Quests]/.Quests/6);
	set .@Base_Exp, #Mission_Count*.@j[.Quests+1]/5;
	set .@Job_Exp, #Mission_Count*.@j[.Quests+2]/5;
	set .@Zeny, #Mission_Count*.Quests*.@j[.@i]*.Multiplier;
	next;
	mes "[Hunting Missions]";
	mes "Mission rewards:";
	mes " > Mission Points: ^0055FF"+.@Mission_Points+"^000000";
	mes " > Base Experience: ^0055FF"+Cm(.@Base_Exp)+"^000000";
	mes " > Job Experience: ^0055FF"+Cm(.@Job_Exp)+"^000000";
	mes " > Zeny: ^0055FF"+Cm(.@Zeny)+"^000000";
	return;

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";
	if (.Delay) mes "every "+((.Delay == 1)?"hour.":.Delay+" hours.");
	else mes "whenever you want.";
	mes "That's everything~";
	return;

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

function Cm {
	set .@str$, getarg(0);
	for(set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3)
		set .@str$, insertchar(.@str$,",",.@i);
	return .@str$; }

OnBuyItem:
	set @cost,0;
	for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
		for(set .@j,0; .@j<getarraysize(.Shop); set .@j,.@j+2)
			if (@bought_nameid[.@i] == .Shop[.@j]) {
				set @cost, @cost+(.Shop[.@j+1]*@bought_quantity[.@i]);
				break;
			}
	mes "[Hunting Missions]";
	if (@cost > #Mission_Points) mes "You don't have enough Mission Points.";
	else {
		for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
			getitem @bought_nameid[.@i], @bought_quantity[.@i];
			dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+".";
		}
		set #Mission_Points, #Mission_Points-@cost;
		mes "Deal completed.";
		emotion e_cash;
	}
	set @cost,0;
	deletearray @bought_nameid[0], getarraysize(@bought_nameid);
	deletearray @bought_quantity[0], getarraysize(@bought_quantity);
	close;

OnNPCKillEvent:
	if (!#Mission_Count || !Mission1) end;
	for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
		if (strmobinfo(1,killedrid) == strmobinfo(1,getd("Mission"+.@i))) {
			if (getd("Mission"+.@i+"_") < #Mission_Count) {
				set .@j, getd("Mission"+.@i+"_")+1;
				setd "Mission"+.@i+"_", .@j;
				dispbottom "[Hunting Mission] Killed "+.@j+" of "+#Mission_Count+" "+strmobinfo(1,killedrid)+".";
			}
			break;
		}
	}
	end;

OnInit:
	set .Delay,3;		// Quest delay, in hours (0 to disable).
	set .Quests,4;		// Number of subquests per quest (increases rewards).
	set .Multiplier,60;	// Multiplier for Zeny reward calculation.
	setarray .Count[0],	// Min and max monsters per subquest (increases rewards).
		40,70;
	setarray .Shop[0],	// Reward items: <ID>,<point cost> (about 10~20 points per hunt).
		2899,500,18830,1000,18780,3000,20762,2500,19095,500,5376,350,7619,100,7620,100,6438,350,6439,350,12908,50,12903,50,12904,50,12905,50,12906,50,12907,50,7776,100,12412,50,14297,100;
	.Blacklist$ =           // Blacklisted mob IDs.
		"1038,1039,1046,1059,1062,1078,1079,1080,1081,1082,"+
		"1083,1088,1085,1086,1087,1089,1090,1091,1092,1093,"+
		"1096,1112,1115,1120,1142,1147,1150,1157,1159,1182,"+
		"1183,1185,1186,1190,1200,1203,1204,1205,1212,1220,"+
		"1221,1230,1232,1234,1235,1245,1244,1250,1251,1252,"+
		"1259,1262,1268,1272,1283,1288,1289,1290,1293,1294,"+
		"1295,1296,1298,1299,1300,1301,1302,1303,1304,1305,"+
		"1306,1307,1308,1309,1311,1312,1313,1320,1324,1325,"+
		"1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,"+
		"1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,"+
		"1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,"+
		"1356,1357,1358,1359,1360,1361,1362,1363,1373,1388,"+
		"1395,1396,1397,1398,1399,1418,1492,1502,1511,1515,"+
		"1582,1583,1588,1618,1623,1626,1630,1634,1635,1636,"+
		"1638,1639,1640,1641,1642,1643,1644,1645,1646,1648,"+
		"1649,1650,1651,1647,1658,1676,1677,1678,1679,1681,"+
		"1685,1686,1688,1704,1705,1706,1707,1708,1709,1710,"+
		"1711,1712,1719,1720,1721,1732,1734,1750,1751,1754,"+
		"1755,1765,1768,1779,1783,1785,1792,1796,1797,1802,"+
		"1812,1815,1816,1829,1830,1831,1832,1839,1845,1846,"+
		"1870,1871,1873,1874,1876,1877,1878,1885,1894,1905,"+
		"1906,1908,1909,1910,1911,1913,1914,1917,1918,1919,"+
		"1920,1921,1929,1934,1941,1946,1951,1953,1954,1956,"+
		"1958,1959,1960,1961,1966,1974,1980,1990,1991,1992,";

	npcshopdelitem "mission_shop",512;
	for (.@i = 0; .@i < getarraysize(.Shop); .@i += 2)
		npcshopadditem "mission_shop", .Shop[.@i], .Shop[.@i+1];
	end;
}
-	shop	mission_shop	-1,2899:-500,18830:-1000,18780:-3000,20762:-2500,19095:-500,5376:-350,7619:-100,7620:-100,6438:-350,6439:-350,12908:-50,12903:-50,12904:-50,12905:-50,12906:-50,12907:-100,7776:-200,12412:-50,14297:-100

help please
I added some monsters from the black list, but the monsters were not banned
Please help

and how i can add mob_db on sql ?

Thanks

1 answer to this question

Recommended Posts

  • 0
Posted
//===== 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,155,184,4	script	Hunting Missions	653,{
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;
		close;
	}
	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: ~ Mission Shop: ~ View Top Hunters: ~ ^777777Cancel^000000"
	)) {
	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;
			}
			close;
		}
		if (#Mission_Delay > gettimetick(2) && .Delay) {
			mes "I'm afraid you'll have to wait " + callfunc("Time2Str",#Mission_Delay) + " before taking another mission.";
			close;
		}
		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!";
		close;
	case 2:
		mes "[Hunting Missions]";
		mes "Mission status:";
		callsub Mission_Status;
		close;
	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;
					close;
				}
				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);
			close;
		case 2:
			mes "[Hunting Missions]";
			mes "I knew you were kidding!";
			mes "Keep up the good work.";
			emotion ET_SMILE;
			close;
		}
	case 4:
		callsub Mission_Info;
		close;
	case 5:
		mes "[Hunting Missions]";
		mes "You have ^0055FF" + #Mission_Points + "^000000 Mission Points.";
		mes "Use them well!";
		callshop "mission_shop",1;
		npcshopattach "mission_shop";
		end;
	case 6:
		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";
		close;
	case 7:
		mes "[Hunting Missions]";
		mes "Nothing? Okay...";
		emotion ET_SCRATCH;
		close;
	}
	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";
	if (@f) {
		@f = 0;
		return;
	}
	next;
	mes "[Hunting Missions]";
	mes "Oh, you're done!";
	mes "Good work.";
	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;
	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'");
	close;

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";
}

OnBuyItem:
	@cost = 0;
	for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++)
		for (.@j = 0; .@j < getarraysize(.Shop); .@j += 2)
			if (@bought_nameid[.@i] == .Shop[.@j]) {
				set @cost, @cost + (.Shop[.@j+1] * @bought_quantity[.@i]);
				break;
			}
	mes "[Hunting Missions]";
	if (@cost > #Mission_Points)
		mes "You don't have enough Mission Points.";
	else {
		for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++) {
			getitem @bought_nameid[.@i], @bought_quantity[.@i];
			dispbottom "Purchased " + @bought_quantity[.@i] + "x " + getitemname(@bought_nameid[.@i]) + ".";
		}
		#Mission_Points -= @cost;
		mes "Deal completed.";
		emotion ET_MONEY;
	}
	@cost = 0;
	deletearray @bought_nameid[0], getarraysize(@bought_nameid);
	deletearray @bought_quantity[0], getarraysize(@bought_quantity);
	close;

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,UNITTYPE_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,UNITTYPE_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 = 3;            // Quest delay, in hours (0 to disable).
	.Quests = 4;            // Number of subquests per mission (increases rewards).
	.Party = 3;             // Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only)
	.Reset = -1;            // 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).
		40,70;
	setarray .Modifier[0],  // Multipliers for Base Exp, Job Exp, and Zeny rewards.
		getbattleflag("base_exp_rate")/100,getbattleflag("job_exp_rate")/100,60;
	.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).
	2899,500,18830,1000,18780,3000,20762,2500,19095,500,5376,350,7619,100,7620,100,6438,350,6439,350,12908,50,12903,50,12904,50,12905,50,12906,50,12907,50,7776,100,12412,50,14297,100;
	.Blacklist$ =           // Blacklisted mob IDs.
		"1038,1039,1046,1059,1062,1078,1079,1080,1081,1082,"+
		"1083,1088,1085,1086,1087,1089,1090,1091,1092,1093,"+
		"1096,1108,1112,1115,1120,1142,1147,1150,1157,1159,1182,"+
		"1183,1185,1186,1190,1200,1203,1204,1205,1212,1220,"+
		"1221,1230,1232,1234,1235,1245,1244,1250,1251,1252,"+
		"1259,1262,1268,1270,1272,1283,1288,1289,1290,1293,1294,"+
		"1295,1296,1298,1299,1300,1301,1302,1303,1304,1305,"+
		"1306,1307,1308,1309,1311,1312,1313,1320,1324,1325,"+
		"1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,"+
		"1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,"+
		"1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,"+
		"1356,1357,1358,1359,1360,1361,1362,1363,1373,1388,"+
		"1395,1396,1397,1398,1399,1418,1492,1497,1502,1511,1515,"+
		"1582,1583,1588,1618,1623,1626,1630,1634,1635,1636,"+
		"1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1648,"+
		"1649,1650,1651,1647,1658,1676,1677,1678,1679,1681,"+
		"1685,1686,1688,1704,1705,1706,1707,1708,1709,1710,"+
		"1711,1712,1719,1720,1721,1732,1734,1750,1751,1754,"+
		"1755,1765,1768,1779,1783,1785,1792,1796,1797,1802,"+
		"1812,1815,1816,1829,1830,1831,1832,1839,1845,1846,"+
		"1870,1871,1873,1874,1876,1877,1878,1885,1894,1905,"+
		"1906,1908,1909,1910,1911,1913,1914,1917,1918,1919,"+
		"1920,1921,1929,1934,1941,1946,1951,1953,1954,1956,1957,"+
		"1958,1959,1960,1961,1966,1974,1980,1990,1991,1992,";

	npcshopdelitem "mission_shop",512;
	for (.@i = 0; .@i < getarraysize(.Shop); .@i += 2)
		npcshopadditem "mission_shop", .Shop[.@i], .Shop[.@i+1];
	end;
}
-	shop	mission_shop	-1,512:-1

try this :

 

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...