Jump to content
  • 0

#mapflag droprate


vulcan1991

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

I search in the forum and this comes, is there any guide on adding mapflag in the latest rathena?

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  148
  • Reputation:   18
  • Joined:  03/03/19
  • Last Seen:  

1 hour ago, edwinooi1991 said:

it doesnt matter if we need to recompile the src. as long as it works. >.<

 

I dont know how to make a patch but ive included my src + mapflag conf at the bottom of the post, ill include instructions on how to add them yourself though. And how to adjust the rates will be first

drop rates - mob.c

find this

#ifdef RENEWAL_DROP
			if( drop_modifier != 100 ) {
				drop_rate = apply_rate(drop_rate, drop_modifier);
				if( drop_rate < 1 )
					drop_rate = 1;
			}
#endif
			if(map_getmapflag(m, MF_DROPRATE300))
				drop_rate = (int)( (drop_rate * 300) / 100. );
			
			if(map_getmapflag(m, MF_DROPRATE50))
				drop_rate = (int)( (drop_rate * 30) / 100. );
			
			// attempt to drop the item
			if (rnd() % 10000 >= drop_rate)
				continue;

			if( mvp_sd && it->type == IT_PETEGG ) {
				pet_create_egg(mvp_sd, md->db->dropitem[i].nameid);
				continue;

insert

			if(map_getmapflag(m, MF_DROPRATE300))
				drop_rate = (int)( (drop_rate * 300) / 100. );
			
			if(map_getmapflag(m, MF_DROPRATE50))
				drop_rate = (int)( (drop_rate * 90) / 100. );

above the comment

//attempt to drop the item

(drop_rate * 300) = +200%? 100 would be normal 

and

 (drop_rate * 30) = 30% of normal drop rate

these are the only numbers you need to change

I havnt tested with gum but it should be normal

 

next NPC.c

find this

		case MF_BATTLEGROUND:
			if (state) {
				union u_mapflag_args args = {};

				if (sscanf(w4, "%11d", &args.flag_val) < 1)
					args.flag_val = 1; // Default value

				map_setmapflag_sub(m, MF_BATTLEGROUND, true, &args);
			} else
				map_setmapflag(m, MF_BATTLEGROUND, false);
			break;
			
		case MF_DROPRATE50:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE50, state);
				else
					map_setmapflag(m, MF_DROPRATE50, 100);
				} else
					map_setmapflag(m, MF_DROPRATE50, 100);
			break;
		case MF_DROPRATE300:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE300, state);
				else
					map_setmapflag(m, MF_DROPRATE300, 100);
				} else
					map_setmapflag(m, MF_DROPRATE300, 100);
			break;
			
		case MF_NOCOMMAND:
			if (state) {
				union u_mapflag_args args = {};

				if (sscanf(w4, "%11d", &args.flag_val) < 1)
					args.flag_val = 100; // No level specified, block everyone.

				map_setmapflag_sub(m, MF_NOCOMMAND, true, &args);
			} else
				map_setmapflag(m, MF_NOCOMMAND, false);
			break;

insert

		case MF_DROPRATE50:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE50, state);
				else
					map_setmapflag(m, MF_DROPRATE50, 100);
				} else
					map_setmapflag(m, MF_DROPRATE50, 100);
			break;
		case MF_DROPRATE300:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE300, state);
				else
					map_setmapflag(m, MF_DROPRATE300, 100);
				} else
					map_setmapflag(m, MF_DROPRATE300, 100);
			break;

under MF_BATTLEGROUND(doesnt matter)

 

NEXT - MAP.H

find

	MF_NOEXP,
	MF_PRIVATEAIRSHIP_SOURCE,
	MF_PRIVATEAIRSHIP_DESTINATION,
	MF_SKILL_DURATION,
	MF_DROPRATE50,
	MF_DROPRATE300,
	MF_MAX

add MF_DROPRATE50, and MF_DROPRATE300, 

commas matter 

 

Last in your SRC find SCRIPT_CONSTANTS.H

and add our 2 new map flags like above

	export_constant(MF_NOEXP);
	export_constant(MF_PRIVATEAIRSHIP_SOURCE);
	export_constant(MF_PRIVATEAIRSHIP_DESTINATION);
	export_constant(MF_DROPRATE50);
	export_constant(MF_DROPRATE300);
	export_constant(MF_SKILL_DURATION);

 

recompile i hope it works

 

 

afterwards you also need to make changes in your NPC folder 

scripts_mapflags

npc: npc/mapflag/skill_duration.txt
npc: npc/mapflag/droprate.txt

then in the file it should look like this

prontera	mapflag	droprate50
geffen	mapflag	droprate300

 

just merge my files with yours if you want and please let me know if you have problems

 

droprate.rar

Edited by AndyTheGoblin
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

@AndyTheGoblin can you teach me how to do it in details please. Newbie here. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

@AndyTheGoblin the patch doesnt work with latest rathena. >.< please

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

Thankkkkkkkiu! 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

6 hours ago, AndyTheGoblin said:

Well i see our problem,

So far ive been able to rewrite a new mapflag that changes the drop rate by a fixed amount like 100% - 500%... im still trying to figure out how to add a modifiable number to it, ill let you know again tomorrow

Thanks man. Is it able to make it also 10% 50% , like reduction number

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

it doesnt matter if we need to recompile the src. as long as it works. >.<

6 hours ago, AndyTheGoblin said:

I dont see why not

I dont really know how to make it adjustable without recompiling the src... but ill post a few new mapflags for you later and how to adjust yourself

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

10 hours ago, AndyTheGoblin said:

I dont know how to make a patch but ive included my src + mapflag conf at the bottom of the post, ill include instructions on how to add them yourself though. And how to adjust the rates will be first

drop rates - mob.c

find this


#ifdef RENEWAL_DROP
			if( drop_modifier != 100 ) {
				drop_rate = apply_rate(drop_rate, drop_modifier);
				if( drop_rate < 1 )
					drop_rate = 1;
			}
#endif
			if(map_getmapflag(m, MF_DROPRATE300))
				drop_rate = (int)( (drop_rate * 300) / 100. );
			
			if(map_getmapflag(m, MF_DROPRATE50))
				drop_rate = (int)( (drop_rate * 30) / 100. );
			
			// attempt to drop the item
			if (rnd() % 10000 >= drop_rate)
				continue;

			if( mvp_sd && it->type == IT_PETEGG ) {
				pet_create_egg(mvp_sd, md->db->dropitem[i].nameid);
				continue;

insert


			if(map_getmapflag(m, MF_DROPRATE300))
				drop_rate = (int)( (drop_rate * 300) / 100. );
			
			if(map_getmapflag(m, MF_DROPRATE50))
				drop_rate = (int)( (drop_rate * 90) / 100. );

above the comment

//attempt to drop the item

(drop_rate * 300) = +200%? 100 would be normal 

and

 (drop_rate * 30) = 30% of normal drop rate

these are the only numbers you need to change

I havnt tested with gum but it should be normal

 

next NPC.c

find this


		case MF_BATTLEGROUND:
			if (state) {
				union u_mapflag_args args = {};

				if (sscanf(w4, "%11d", &args.flag_val) < 1)
					args.flag_val = 1; // Default value

				map_setmapflag_sub(m, MF_BATTLEGROUND, true, &args);
			} else
				map_setmapflag(m, MF_BATTLEGROUND, false);
			break;
			
		case MF_DROPRATE50:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE50, state);
				else
					map_setmapflag(m, MF_DROPRATE50, 100);
				} else
					map_setmapflag(m, MF_DROPRATE50, 100);
			break;
		case MF_DROPRATE300:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE300, state);
				else
					map_setmapflag(m, MF_DROPRATE300, 100);
				} else
					map_setmapflag(m, MF_DROPRATE300, 100);
			break;
			
		case MF_NOCOMMAND:
			if (state) {
				union u_mapflag_args args = {};

				if (sscanf(w4, "%11d", &args.flag_val) < 1)
					args.flag_val = 100; // No level specified, block everyone.

				map_setmapflag_sub(m, MF_NOCOMMAND, true, &args);
			} else
				map_setmapflag(m, MF_NOCOMMAND, false);
			break;

insert


		case MF_DROPRATE50:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE50, state);
				else
					map_setmapflag(m, MF_DROPRATE50, 100);
				} else
					map_setmapflag(m, MF_DROPRATE50, 100);
			break;
		case MF_DROPRATE300:
			if (state) {
			union u_mapflag_args args = {};
			
				if (sscanf(w4, "%11d", &args.flag_val) == 1)
					map_setmapflag(m, MF_DROPRATE300, state);
				else
					map_setmapflag(m, MF_DROPRATE300, 100);
				} else
					map_setmapflag(m, MF_DROPRATE300, 100);
			break;

under MF_BATTLEGROUND(doesnt matter)

 

NEXT - MAP.H

find


	MF_NOEXP,
	MF_PRIVATEAIRSHIP_SOURCE,
	MF_PRIVATEAIRSHIP_DESTINATION,
	MF_SKILL_DURATION,
	MF_DROPRATE50,
	MF_DROPRATE300,
	MF_MAX

add MF_DROPRATE50, and MF_DROPRATE300, 

commas matter 

 

Last in your SRC find SCRIPT_CONSTANTS.H

and add our 2 new map flags like above


	export_constant(MF_NOEXP);
	export_constant(MF_PRIVATEAIRSHIP_SOURCE);
	export_constant(MF_PRIVATEAIRSHIP_DESTINATION);
	export_constant(MF_DROPRATE50);
	export_constant(MF_DROPRATE300);
	export_constant(MF_SKILL_DURATION);

 

recompile i hope it works

 

 

afterwards you also need to make changes in your NPC folder 

scripts_mapflags


npc: npc/mapflag/skill_duration.txt
npc: npc/mapflag/droprate.txt

then in the file it should look like this


prontera	mapflag	droprate50
geffen	mapflag	droprate300

 

just merge my files with yours if you want and please let me know if you have problems

 

droprate.rar 128.65 kB · 2 downloads

@AndyTheGoblin thanks mate! it works. one more question, is it able to sustain the db droprate announcement. for example the default droprate for poring card is 1%. I use the droprate flag make it to 2% but i still want the announcement 1% to happen. is that possible?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

2 hours ago, AndyTheGoblin said:

well if you do @mi poring it says the drop rates dont change if you are on the maps with flags

 

i have no idea

So I set the @autoloot 1% and set the poring card from 1% to 2% using mapflag

the poring card does collected by @autoloot ( means system still take it as 1% drop )

but there is no rare announcement ( means system take the value as after mapflag ) 

have you checked the previous mapflag? There are some lines which I couldn’t understand. Don’t know if it helps. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   0
  • Joined:  03/05/19
  • Last Seen:  

19 hours ago, AndyTheGoblin said:

thats pretty specific,

Not sure but i can take a look at it

where can i find the rare announcement ? which conf 

I can’t seem to find it. Maybe it is hard coded. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

How to set Droprate at 1%?

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