Jump to content
  • 0

Request Script for MVP


Question

Posted

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!

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

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
  • 0
Posted
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 

 

  • 0
Posted
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.

 

 

  • 0
Posted
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.

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