Jump to content
  • 0

Help with hunting mission npc


FEAR

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

Hi my fellow members of rathena, i come today with this little problem and hope to get some answers, i am currently ussing euphy hunting mission script, it is an awesome script but theres a problem, i dont seem to be able to limit the monster levels diference from the user level, this is a problem because, while using 4 or more subquests almost always the user gets a high level monster, what im asking in here it is, can you help me find a way to make monsters on the hunting list at least only 15 levels higher then the user?

 

I tried declaring a variable equal to the player level by using readparam(2)

 

set .CharLevel$, +"readparam(2)"; 

 

 

then i tryed to use this variable on the SQL query,

 

AND ID < 2000 AND LV < .CharLevel$  AND instr('"+.Blacklist$+"',ID) = 0 

 

But this didnt work, the npc works "correctly" till the point where it is supposed to give you the targets, it doesnt assign any monsters, the last screen says "you are done with the hunting" then it closes, no rewards are given ofcourse, but you cant take any new mission.

 

Anyone has an idea how to make this happen correctly??

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  39
  • Reputation:   2
  • Joined:  08/19/12
  • Last Seen:  

We could help you better, if you'd give us a bigger snippet of your code, since you only gave us the SQL query content we can't say if there's something wrong with your syntax.

I'd say it could work if you'd replace .CharLevel$ with "+.CharLevel$+" .

Edited by skyleo
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

Here is the current script im trying right now :

 

//===== rAthena Script =======================================
//= Hunting Missions
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.3a
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: =========================================
//= Random hunting missions.
//= Rewards are based on quest difficulty.
//===== 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.
//============================================================

prt_in,136,35,3	script	Hunting Missions	951,{
function Chk; function Cm;
	mes "[Hunting Missions]";
	mes "Hola,"+strcharinfo(0)+"!";
	if (!#Mission_Delay) {
		next;
		mes "[Hunting Missions]";
		mes "No puedo encontrar ningun registro...";
		mes "Debes ser nuevo por aqui!";
		emotion e_omg;
		next;
		callsub Mission_Info;
		emotion e_go;
		set #Mission_Delay,1;
		close;
	}
	mes rand(2)?"Trabajando duro, como siempre":"Ocupado, espero.";
	mes "Hay algo en lo que pueda ";
	mes "ser de tu ayuda?";
	mes " ";
	mes "^777777~ Has completado ^0055FF"+Mission_Total+"^777777 Mission"+((Mission_Total == 1)?"":"es")+". ~^000000";
	mes "Tu nivel es "+BaseLevel+".";
	mes "Maximo nivel de mob sera ["+.MaxLevel$+"].";
	next;
	switch(select(((!Mission0)?" ~ Nueva Mision::":": ~ Estatus de mision: ~ Abandonar Mision")+": ~ Informacion: ~ Tienda de cazadores: ~ Ver top de Cazadores: ~ ^777777Cancelar^000000")) {
	case 1:
		mes "[Hunting Missions]";
		if (#Mission_Count) {
			mes "Has iniciado una mision";
			mes "con otro personaje.";
			close;
		}
		if (#Mission_Delay > gettimetick(2) && .Delay) {
			set .@i, #Mission_Delay-gettimetick(2);
			if (.@i > 3600) set .@j$, (.@i/3600)+" Hora"+(((.@i/3600) == 1)?"":"s ");
			else if (.@i > 60) set .@j$, (.@i/60)+" Minuto"+(((.@i/60) == 1)?"":"s ");
			else set .@j$, (.@i)+" Segundo"+((.@i == 1)?"":"s ");
			mes "Me temo que deberas esperar  "+.@j$+" Antes de poder obtener otra mision.";
			close;
		}
		mes "Deberas cazar:";
		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 LV < "+.MaxLevel$+" AND instr('"+.Blacklist$+"',ID) = 0 ORDER BY rand() LIMIT "+.Quests, .@mob);
		for (set .@i,0; .@i<.Quests; set .@i,.@i+1) {
			setd "Mission"+.@i, .@mob[.@i];
			setd "Mission"+.@i +"_",0;
		}
		set #Mission_Count, rand(.Count[0],.Count[1]);
		callsub Mission_Status;
		next;
		mes "[Hunting Missions]";
		mes "Reportate conmigo cuando";
		mes "hayas terminado";
		mes "Buena Suerte!!";
		close;
	case 2:
		mes "[Hunting Missions]";
		mes "Estatus de la mision:";
		callsub Mission_Status;
		close;
	case 3:
		mes "[Hunting Missions]";
		mes "Ests seguro que deseas";
		mes "abandonar tu mision?";
		if (.Reset < 0 && .Delay)
			mes "Tu tiempo de espera no puede ser anulado.";
		else if (.Reset > 0)
			mes "Te costara "+Cm(.Reset)+" Zeny.";
		next;
		switch(select(" ~ Abandonar...: ~ ^777777Cancelar^000000")) {
		case 1:
			if (.Reset > 0) {
				if (Zeny < .Reset) {
					mes "[Hunting Missions]";
					mes "No tienes suficiente ";
					mes "Zeny para renunciar a esta mision.";
					emotion e_sry;
					close;
				}
				set Zeny, Zeny-.Reset;
				emotion e_cash;
			}
			mes "[Hunting Missions]";
			mes "De acuerdo, he cancelado";
			mes "tu mision actual.";
			specialeffect2 EF_STORMKICK4;
			for(set .@i,0; .@i<.Quests; set .@i,.@i+1) {
				setd "Mission"+.@i,0;
				setd "Mission"+.@i+"_",0;
			}
			set #Mission_Count,0;
			if (.Reset < 0 && .Delay) set #Mission_Delay, gettimetick(2)+(.Delay*3600);
			close;
		case 2:
			mes "[Hunting Missions]";
			mes "Sabia que estabas bromeado!";
			mes "Echale ganas!!";
			emotion e_heh;
			close;
		}
	case 4:
		callsub Mission_Info;
		close;
	case 5:
		mes "[Hunting Missions]";
		mes "Tu tienes ^0055FF"+#Mission_Points+"^000000 Puntos De Cazador.";
		mes "Usalos sabiamente!!!";
		callshop "mission_shop",1;
		npcshopattach "mission_shop";
		end;
	case 6:
		mes "[Hunting Missions]";
		mes "Los mejores cazadores son:";
		query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `global_reg_value` WHERE str = 'Mission_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5",.@id,.@name$,.@val);
		for(set .@i,0; .@i<5; set .@i,.@i+1)
			mes "  [Rank "+(.@i+1)+"]  "+((.@name$[.@i] == "")?"^777777Nadie":"^0055FF"+.@name$[.@i]+"^000000 : ^FF0000"+.@val[.@i]+" pt.")+"^000000";
		close;
	case 7:
		mes "[Hunting Missions]";
		mes "Nada? De acuerdo...";
		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])/(getbattleflag("base_exp_rate")/100)*.Modifier[0]);
		set .@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:
	set .@Mission_Points, 3+(.@j[.Quests]/.Quests/6);
	set .@Base_Exp, #Mission_Count*.@j[.Quests+1]/12;
	set .@Job_Exp, #Mission_Count*.@j[.Quests+2]/12;
	set .@Zeny, #Mission_Count*.Quests*.@j[.@i]*.Modifier[2];

	next;
	mes "[Hunting Missions]";
	mes "Recompenza por mision:";
	mes " > Puntos de cazador: ^0055FF"+.@Mission_Points+"^000000";
	mes " > Experiencia Base: ^0055FF"+Cm(.@Base_Exp)+"^000000";
	mes " > Experiencia de Job: ^0055FF"+Cm(.@Job_Exp)+"^000000";
	mes " > Zeny: ^0055FF"+Cm(.@Zeny)+"^000000";
	if (@f) { set @f,0; return; }
	next;
	mes "[Hunting Missions]";
	mes "Oh, Has terminado!";
	mes "Buen trabajo.";
	mes "Aqui esta tu recompenza.";
	emotion e_no1;
	specialeffect2 EF_ANGEL;
	specialeffect2 EF_TRUESIGHT;
	set #Mission_Points, #Mission_Points+.@Mission_Points;
	set BaseExp, BaseExp+.@Base_Exp;
	set JobExp, JobExp+.@Job_Exp;
	set Zeny, Zeny+.@Zeny;
	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);
	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;

Mission_Info:
	mes "[Hunting Missions]";
	mes "Si tu asi lo deseas, yo puedo";
	mes "darte una mision de caceria random.";
	mes "Algunas son mas faciles que";
	mes "otras, pero las recompenzas";
	mes "aumentan con la dificultad.";
	next;
	mes "[Hunting Missions]";
	mes "Los puntos cazador son";
	mes "compartidos por todos tus personajes";
	if (.Delay) mes "El tiempo de espera tambien.";
	mes "No puedes obtener misiones en";
	mes "multiples personajes a la vez.";
	next;
	mes "[Hunting Missions]";
	mes "Puedes empezar una mision";
	if (.Delay) mes "cada "+((.Delay == 1)?" Hora.":.Delay+" Horas.");
	else mes "Cuando quieras.";
	mes "Eso es todo.";
	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 "Tu no tienes suficientes puntos de cazador.";
	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 "Trato completado.";
		emotion e_cash;
	}
	set @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 (set .@i, 0; .@i<.Quests; set .@i,.@i+1) {
			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) {
		set .@mob, killedrid;
		getmapxy(.@map1$,.@x1,.@y1,0);
		getpartymember getcharid(1),1;
		getpartymember getcharid(1),2;
		for(set .@i,0; .@i<$@partymembercount; set .@i,.@i+1) {
			if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) {
				attachrid $@partymemberaid[.@i];
				if (#Mission_Count && Mission0 && HP > 0) {
					getmapxy(.@map2$,.@x2,.@y2,0);
					if ((.@map1$ == .@map2$ || .Party == 1) && (distance(.@x1,.@y1,.@x2,.@y2) <= 30 || .Party < 3)) {
						for(set .@j,0; .@j<.Quests; set .@j,.@j+1) {
							if (strmobinfo(1,.@mob) == strmobinfo(1,getd("Mission"+.@j))) {
								if (getd("Mission"+.@j+"_") < #Mission_Count) {
									dispbottom "[Hunting Mission] Killed "+(set(getd("Mission"+.@j+"_"),getd("Mission"+.@j+"_")+1))+" of "+#Mission_Count+" "+strmobinfo(1,.@mob)+".";
									break;
								}
							}
						}
					}
				}
			}
		}
	}
	end;

OnInit:
	set .Delay,0;		// Quest delay, in hours (0 to disable).
	set .Quests,4;		// Number of subquests per mission (increases rewards).
	set .Party,3;		// Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only)
	set .Reset,40000;	// Reset options: -1 (abandoning mission sets delay time), 0 (no delay time), [Zeny] (cost to abandon mission, no delay time)
	set .Maxdlevel,15	 // Maxima diferencia de nivel  <<<-- Max level difference.
	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")/300,getbattleflag("job_exp_rate")/300,2;
	setarray .Shop[0],	// Reward items: <ID>,<point cost> (about 10~20 points per hunt).
		6153,1,7539,1,7515,5,662,1,7828,1,7829,2,7773,3;
	set .Blacklist$,	// Blacklisted mob IDs.
		"1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"+
		"1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"+
		"1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"+
		"1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"+
		"1975,1976,1977,1978,1979";
	
	set .MaxLevel$,readparam(2)+.Maxdlevel; //<<< --- Trying to make the max lvl higher then char level.
	
			 
		
	npcshopdelitem "mission_shop",512;
	for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2)
		npcshopadditem "mission_shop", .Shop[.@i], .Shop[.@i+1];
	end;
}
-	shop	mission_shop	-1,512:-1


I made some modifications on the script :

 

set .Maxdlevel,15	 // Maxima diferencia de nivel  <<<-- Max level difference.

This part here is for the user so he can configure how high the monster diference is.

 

And this is the part where i keep failing at:

 

set .MaxLevel$,readparam(2)+.Maxdlevel; //<<< --- Trying to make the max lvl higher then char level.

Trying to make the variable .MaxLevel$ to be a number equal to (baselevel + maxlvldifference).

Edited by FEAR
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

No answer..... i ended up using lots of ifs.......

Link to comment
Share on other sites

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.

×
×
  • Create New...