Jump to content
astralprojection

MVP Spawn Controller

Recommended Posts

//===== Hercules Script ======================================
//= MVP Spawn Timer
//===== By: ==================================================
//= jawbreaker
//===== Current Version: =====================================
//= 1.1
//===== Description: =========================================
//= Control MVP Spawn with script. MVP will not respawn on server start or reload using flag.
//===== Additional Comments: =================================
//= 1.0 Remove/Comment all MVP spawn at npc/pre-re/mobs/dungeons/ or /fields.  
//= 1.1 Initialize TimeStamp when not set to all MVP           Fixed typo on MVP_Map array.
//============================================================
-    script    MVPTimer    -1,{
OnInit:
	// Mvp ids
	setarray $MVP_ID[0],1511,1785,1785,1785,1785,1785,1039,1272,1272,1719,
		1046,1046,1389,1112,1115,1115,1418,1252,1768,1086,
		1885,1832,1734,1688,1373,1147,1147,1059,1150,1087,
		1087,1190,1038,1157,1159,1623,1492,1251,1583,1312,
		1751,1685,1630;
	// Mvp maps
	setarray $MVP_Maps$[0],"moc_pryd06","ra_fild02","ra_fild03","ra_fild04","ve_fild01","ve_fild02","prt_maze03","gl_chyard","gld_dun04","abyss_03",
		"gef_dun02","gld_dun02","gef_dun01","treasure02","gld_dun01","pay_fild11","gon_dun03","xmas_fild01","ra_san05","prt_sewb4",
		"mosk_dun03","thor_v03","kh_dun02","ayo_dun02","niflheim","gld_dun03","anthell02","mjolnir_04","pay_dun04","gef_fild02",
		"gef_fild14","gef_fild10","moc_pryd04","in_sphinx5","moc_fild15","ein_dun02","ama_dun03","xmas_dun02","beach_dun","tur_dun04",
		"odin_tem03","jupe_core","lou_dun03";
	// Respawn time (minutes)
	setarray $MVP_Time[0],60,240,180,300,180,360,120,60,480,180,
		120,480,60,120,480,120,94,120,300,60,
		120,660,120,420,91,480,120,120,60,1440,
		60,120,60,60,120,125,91,60,300,60,
		480,120,117;
	// Respawn only undead MVP's on server start or reload
	for ( set .@i,0; .@i < getarraysize($MVP_ID); set .@i, .@i+1 ) {
		// check whether MPV is alive or $MVP_Status variable is not yet set.
		// 1 - Dead, 2 - Alive
		if ( $MVP_Status[.@i] == 2 || $MVP_Status[.@i] == 0 || $MVP_TimeStamp[.@i] == 0  ) {
			monster $MVP_maps$[.@i],0,0,"--ja--",$MVP_ID[.@i],1;
			set $MVP_Status[.@i], 2;
		} else {
			// don't respawn MVP and wait for next spawn time
			set $MVP_Status[.@i], 1;
		}
	}
	initnpctimer;
OnTimer60000:
	// Check every 1 minute
	for( set .@i,0; .@i < getarraysize($MVP_ID); set .@i, .@i+1 ) {
		set .@time, $MVP_Time[.@i]*60;
		// Conversion to seconds so we can use gettimetick
		if( ($MVP_TimeStamp[.@i] + .@time) <= gettimetick(2) && $MVP_Status[.@i] == 1 ) {
			monster $MVP_Maps$[.@i],0,0,"--ja--",$MVP_ID[.@i],1;
			// Defines last respawn
			set $MVP_TimeStamp[.@i], gettimetick(2);
			set $MVP_Status[.@i], 2;
		}
	}
	setnpctimer 0;
	end;
OnNPCKillEvent:
	if( getmonsterinfo(killedrid, MOB_MVPEXP) > 0 )
		// process only MVP Monsters
		for( set .@i,0; .@i < getarraysize($MVP_ID); set .@i, .@i+1 ) {
			if( (killedrid == $MVP_ID[.@i]) && (strcharinfo(3) == $MVP_Maps$[.@i])) {
				set $MVP_Status[.@i],1;
				// set flag  mvp has died
				set $MVP_TimeStamp[.@i], gettimetick(2); 
				// set mpv death time
			}
		}
	end;
}

 

Share this post


Link to post
Share on other sites

At least it'll parse corretly if you fix the uncommented line 12 author left uncommented and fix a wrong case usage on the $MVP_Maps$ array (there is one with Maps in all lowercases). So I think yes provided you fix the aforementioned issues.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.