1. Delete or Comment all MVP and mini boss spawn at npc/pre-re/mobs/dungeons/ or /fields.
2. add all MobID, spawn time and map of mvp to array.
OnInit:
setarray .mvpid[0],1511,1039; <- osiris and baphomet
setarray .mvptime[0],60,60;
setarray .mvpmaps$[0],"moc_pryd06","prt_maze03";
3. Upon script load add global variables to each item in .mvpid and initialize timer.
OnInit:
/* Loop to each mvp.
lets set global variable
getd("$S"+.mvpid[.@i] = 0 <- not set
getd("$S"+.mvpid[.@i] = 1 <- alive
getd("$S"+.mvpid[.@i] = 2 <- dead
*/
for( .@i = 0; .@i < getarraysize(.mvpid); .@i++ ) {
/*
if variable is not yet set or getd("$S"+.mvpid[.@i] < 2 (alive or not set) OR time from setarray .mvptime[0] has elapse
setd("$S"+.mvpid[.@i],1); (alive)
spawn .mvpid[.@i]
}
*/
}
initnpctimer();
4 Check every 1 minutes
OnTimer60000:
for( .@i = 0; .@i < getarraysize(.mvpid); .@i++ ) {
/* same thing just check on each mvp if flag is dead then skip, if alive then spawn.
if variable is not yet set or getd("$S"+.mvpid[.@i] < 2 (alive or not set) OR time from setarray .mvptime[0] has elapse
set global mvp status variable to (alive)
clear global mvp death variable.
spawn .mvpid[.@i]
}
*/
}
initnpctimer();
5. Finally, record if mvp is killed and set flag to killed.
Code:
/* must load that useful function array_find from meko
https://herc.ws/board/files/file/326-array-manipulation-functions/
*/
OnNPCKillEvent:
if(array_find(.mvpid, killedrid) >= 0 ){ // check if monster killed is part of your mvp array
// loop to that array until it matches mvpid and map
for( .@i = 0; .@i < getarraysize(.mvpid); .@i++ ) {
// if match then set variable to dead and set the global mvptime variable to timestamp.
break;
}
}
end;