Jump to content
  • 0

Request Script for MVP


K i n G

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  17
  • Reputation:   1
  • Joined:  11/05/22
  • Last Seen:  

Looking for MVP Script.

If the MVP is alive PVP is on.
If the MVP is die it will announce the killer of the Boss. Plus PVP is disabled.
Also, may I request an MVP Board?

Thanks a lot!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

This script will enable pvp when there is atleast one living mvp on a map. If the last mvp gets killed, it will announce the kill and end pvp until a mvp is spawned again.

Optionally, you can disable the dynamic mobs option in monster.conf. This will result in pvp already being enabled on a living mvps map, when a player loads it.
Otherwise, it might take a second to refresh, since the script has to check the newly loaded mobs first. The downside is of course that disabling dynamic mobs
will take more ram. 

-	script	MVP_PVP_MODE	FAKE_NPC,{
	function mapHasAliveMVP;
	function mobHasMvpMode;

	OnInit:
		setarray(.mvp_maps$, 
			"moc_pryd06","ra_fild03","ra_fild04","ve_fild01","ve_fild02",
			"lou_dun03","prt_maze03","abbey03",
			"gl_chyard","abyss_03","gef_dun02","gef_dun01","treasure02",
			"pay_fild10","gon_dun03","abbey02","xmas_fild01","ra_san05",
			"prt_sewb4","mosk_dun03","thor_v03","ama_dun03",
			"kh_dun02","ayo_dun02","niflheim","anthell02",
			"mjolnir_04","pay_dun04","gef_fild03","gef_fild10",
			"moc_pryd04","in_sphinx5","moc_fild17","ein_dun02","xmas_dun02",
			"beach_dun","thana_boss","tur_dun04","odin_tem03",
			"jupe_core","lhz_dun02");

		freeloop(1);
		while(true) {
			for(.@i = 0; .@i < getarraysize(.mvp_maps$); .@i++)
				if(mapHasAliveMVP(.mvp_maps$[.@i])) pvpon(.mvp_maps$[.@i]);

			sleep(1000);
		}
		freeloop(0);
	end;

	OnNPCKillEvent:
		getunitdata(killedgid, .@data);

		.@map$ = mapid2name(.@data[UMOB_MAPID]);

		if(!mobHasMvpMode(.@data[UMOB_MODE]) || mapHasAliveMVP(.@map$)) end;

		announce(strcharinfo(0) + " killed " + strmobinfo(1, killedrid) + "!", bc_all);
		pvpoff(.@map$);
	end;


	function mapHasAliveMVP {
		.@map$ = getarg(0);

		getmapunits(BL_MOB, .@map$, .@mobs);
		for(.@i = 0; .@i < getarraysize(.@mobs); .@i++) {
			getunitdata(.@mobs[.@i], .@data);

			if(.@data[UMOB_HP] == 0 || !mobHasMvpMode(.@data[UMOB_MODE])) continue;

			return 1;
		}

		return 0;
	}

	function mobHasMvpMode {
		return getarg(0) & MD_MVP;
	}
}

 

Edited by Winterfox
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.03
  • Content Count:  640
  • Reputation:   82
  • Joined:  04/07/14
  • Last Seen:  

16 hours ago, K i n G said:

Looking for MVP Script.

If the MVP is alive PVP is on.
If the MVP is die it will announce the killer of the Boss. Plus PVP is disabled.
Also, may I request an MVP Board?

Thanks a lot!

I use this mod when mvp is alive 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  17
  • Reputation:   1
  • Joined:  11/05/22
  • Last Seen:  

On 8/30/2023 at 4:45 AM, Winterfox said:

This script will enable pvp when there is atleast one living mvp on a map. If the last mvp gets killed, it will announce the kill and end pvp until a mvp is spawned again.

Optionally, you can disable the dynamic mobs option in monster.conf. This will result in pvp already being enabled on a living mvps map, when a player loads it.
Otherwise, it might take a second to refresh, since the script has to check the newly loaded mobs first. The downside is of course that disabling dynamic mobs
will take more ram. 

-	script	MVP_PVP_MODE	FAKE_NPC,{
	function mapHasAliveMVP;
	function mobHasMvpMode;

	OnInit:
		setarray(.mvp_maps$, 
			"moc_pryd06","ra_fild03","ra_fild04","ve_fild01","ve_fild02",
			"lou_dun03","prt_maze03","abbey03",
			"gl_chyard","abyss_03","gef_dun02","gef_dun01","treasure02",
			"pay_fild10","gon_dun03","abbey02","xmas_fild01","ra_san05",
			"prt_sewb4","mosk_dun03","thor_v03","ama_dun03",
			"kh_dun02","ayo_dun02","niflheim","anthell02",
			"mjolnir_04","pay_dun04","gef_fild03","gef_fild10",
			"moc_pryd04","in_sphinx5","moc_fild17","ein_dun02","xmas_dun02",
			"beach_dun","thana_boss","tur_dun04","odin_tem03",
			"jupe_core","lhz_dun02");

		freeloop(1);
		while(true) {
			for(.@i = 0; .@i < getarraysize(.mvp_maps$); .@i++)
				if(mapHasAliveMVP(.mvp_maps$[.@i])) pvpon(.mvp_maps$[.@i]);

			sleep(1000);
		}
		freeloop(0);
	end;

	OnNPCKillEvent:
		getunitdata(killedgid, .@data);

		.@map$ = mapid2name(.@data[UMOB_MAPID]);

		if(!mobHasMvpMode(.@data[UMOB_MODE]) || mapHasAliveMVP(.@map$)) end;

		announce(strcharinfo(0) + " killed " + strmobinfo(1, killedrid) + "!", bc_all);
		pvpoff(.@map$);
	end;


	function mapHasAliveMVP {
		.@map$ = getarg(0);

		getmapunits(BL_MOB, .@map$, .@mobs);
		for(.@i = 0; .@i < getarraysize(.@mobs); .@i++) {
			getunitdata(.@mobs[.@i], .@data);

			if(.@data[UMOB_HP] == 0 || !mobHasMvpMode(.@data[UMOB_MODE])) continue;

			return 1;
		}

		return 0;
	}

	function mobHasMvpMode {
		return getarg(0) & MD_MVP;
	}
}

 

Thank you! I will try this one.

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  17
  • Reputation:   1
  • Joined:  11/05/22
  • Last Seen:  

On 8/30/2023 at 4:45 AM, Winterfox said:

This script will enable pvp when there is atleast one living mvp on a map. If the last mvp gets killed, it will announce the kill and end pvp until a mvp is spawned again.

Optionally, you can disable the dynamic mobs option in monster.conf. This will result in pvp already being enabled on a living mvps map, when a player loads it.
Otherwise, it might take a second to refresh, since the script has to check the newly loaded mobs first. The downside is of course that disabling dynamic mobs
will take more ram. 

-	script	MVP_PVP_MODE	FAKE_NPC,{
	function mapHasAliveMVP;
	function mobHasMvpMode;

	OnInit:
		setarray(.mvp_maps$, 
			"moc_pryd06","ra_fild03","ra_fild04","ve_fild01","ve_fild02",
			"lou_dun03","prt_maze03","abbey03",
			"gl_chyard","abyss_03","gef_dun02","gef_dun01","treasure02",
			"pay_fild10","gon_dun03","abbey02","xmas_fild01","ra_san05",
			"prt_sewb4","mosk_dun03","thor_v03","ama_dun03",
			"kh_dun02","ayo_dun02","niflheim","anthell02",
			"mjolnir_04","pay_dun04","gef_fild03","gef_fild10",
			"moc_pryd04","in_sphinx5","moc_fild17","ein_dun02","xmas_dun02",
			"beach_dun","thana_boss","tur_dun04","odin_tem03",
			"jupe_core","lhz_dun02");

		freeloop(1);
		while(true) {
			for(.@i = 0; .@i < getarraysize(.mvp_maps$); .@i++)
				if(mapHasAliveMVP(.mvp_maps$[.@i])) pvpon(.mvp_maps$[.@i]);

			sleep(1000);
		}
		freeloop(0);
	end;

	OnNPCKillEvent:
		getunitdata(killedgid, .@data);

		.@map$ = mapid2name(.@data[UMOB_MAPID]);

		if(!mobHasMvpMode(.@data[UMOB_MODE]) || mapHasAliveMVP(.@map$)) end;

		announce(strcharinfo(0) + " killed " + strmobinfo(1, killedrid) + "!", bc_all);
		pvpoff(.@map$);
	end;


	function mapHasAliveMVP {
		.@map$ = getarg(0);

		getmapunits(BL_MOB, .@map$, .@mobs);
		for(.@i = 0; .@i < getarraysize(.@mobs); .@i++) {
			getunitdata(.@mobs[.@i], .@data);

			if(.@data[UMOB_HP] == 0 || !mobHasMvpMode(.@data[UMOB_MODE])) continue;

			return 1;
		}

		return 0;
	}

	function mobHasMvpMode {
		return getarg(0) & MD_MVP;
	}
}

 

The tomb and announcement are working. But when the MVP is up the PVP is off.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  17
  • Reputation:   1
  • Joined:  11/05/22
  • Last Seen:  

bump

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