MvP and @reloadscript

Well, it would be great if it's not just MVPs also regular mobs and mini-bosses. Quest items can be obtain in a regular mobs and mini-bosses. @reloadscript causes them to respawn also.

this could be done in src easily..

MVP killed -> save to db left respawn time

Server restarted or npc reloaded -> server fetch respawn time from db then parse then load to its ticking process before respawn

this will only work if the MVP mob dies after server initial start...

ATM just an idea and the codes are still in my brain..if I have time I'll do it.. 
default_smile.png
I agree with this, after killing MVPs you can save it to db, if uses @reloadscript it will fetch the respawn time from and calculate it like how it spawns normally but the the thing is alive MVPs. You'll figure it out malufett.

 
@Igniz

Maybe this would be a lot better if it was a suggestion for Hercules Devs? You think it'd be better if this got officially implemented for everyone in case this is done? In that case I could move this to `Suggestions` forum.

 
@reloadscript should not be used in production servers, at least not too often.

The real problem lies elsewhere. It's currently not possible to not use this command at all, because there is no way to unload mob spawns. If this was fixed, you could easily unload anything you want: mob spawnsets (with new command), scripts (NPCs, warps) and user functions (with @unloadnpc). I think it covers all that we have in /npc/ folder. 

 
How about @saveglobal will save all calculation into db, later @restoreglobal will put last state into alive again.

 
How about @saveglobal will save all calculation into db, later @restoreglobal will put last state into alive again.
That would be no purpose, in case map server saves respawn times of MvPs and minibosses to restore them automatically

 
The main problem its not reload all or reload only a thing, it's keeping the respawn times alive when you need to refresh functions or labels. If every mvp has his timer, it could be saved into the db and match the time when you reload the server. Maybe we can create a list in the db folder with the mobs that you want to keep dead (for main purposes for everyone).

Yeah, it shouldn't be used in production servers but what can you do when you need to refresh a function or call the OnInit labels again without duplicate the npc's? Massive Npc's that uses a main function can't be refreshed one by one due the main function is alive in the deepest code. It's @reloadnpc or do a shutdown on the server. (In my case, a lot of variables are temporal in order to avoid consuming a lot of memory in permanent variables)

 
The main problem its not reload all or reload only a thing, it's keeping the respawn times alive when you need to refresh functions or labels. If every mvp has his timer, it could be saved into the db and match the time when you reload the server. Maybe we can create a list in the db folder with the mobs that you want to keep dead (for main purposes for everyone).

Yeah, it shouldn't be used in production servers but what can you do when you need to refresh a function or call the OnInit labels again without duplicate the npc's? Massive Npc's that uses a main function can't be refreshed one by one due the main function is alive in the deepest code. It's @reloadnpc or do a shutdown on the server. (In my case, a lot of variables are temporal in order to avoid consuming a lot of memory in permanent variables)
That's exactly my point.

You want to make @reloadnpc save some part of what it reloads, because you don't want it to reload everything, but there's no other way. The correct solution in such case is to provide extra commands to unload just right things. 

As for things you mentioned, you can refresh a custom function just by loading an updated version of it with @loadnpc. You can also call OnInit label from another temporarily loaded script. Or you can use an NPC tthat would take your input (via inputbox) and call that event, like this one:

Code:
// NPC to trigger other NPC events manually// To "click" this NPC, whisper to NPC::donpcevent as you would// to any other player.-	script	donpcevent	-1,{	end;OnWhisperGlobal:	if (getgmlevel() >= 99)	{		while (1) {			mes "Please enter eventname in";			mes "^0000FFNPCName::Event^000000 format.";			mes "Enter ^FF00000^000000 to cancel.";			next;			input .@event$;			if (.@event$ != "" && compare(.@event$, "::"))				break;			if (.@event$ == "0")				close;		}		mes "Triggered event:";		mes "^0000FF" + .@event$ + "^000000.";		donpcevent .@event$;		close;	}	end;}
 
Last edited by a moderator:
I'm looking for the solution the whole day, but it seems there's none. Anyone?
You could spawn mvps manually and create a global variable for each one of them containing the time of the last spawn...Something like:

Code:
OnInit:	// Mvp ids	setarray $MVP_id[0],id1,id2,id3;	// Mvp maps NO GAT's!	setarray $MVP_maps$[0],"map1","map2","map3";	// Respawn time (HOURS)	setarray $MVP_tm[0],tm1,tm2,tm3;	initnpctimer;	// IT SHOULD FALL HERE!	OnTimer3600: // After a hour		for( set .@i,0; .@i < getarraysize($MVP_id); set .@i, .@i+1 )		{			set .@time, $MVP_tm[.@i]*3600; // Conversion to seconds so we can use gettimetick			if( ($MVP_last_respawn[.@i] + $MVP_tm[.@i]) > gettimetick(2) )				continue; // Time has yet to pass			monster "map",0,0,"--ja--",$MVP_id[.@i],1;			// Defines last respawn			set $MVP_last_respawn[.@i], gettimetick(2);		}		setnpctimer 0;		end;
 
Thank you!

Mob still respawn after server restart
default_sad.png


- script MVPTimer -1,{OnInit: // Mvp ids setarray $MVP_id[0],1112,1046; // Mvp maps NO GAT's! setarray $MVP_maps$[0],"treasure02","gef_dun02"; // Respawn time (HOURS) setarray $MVP_tm[0],60,60; initnpctimer; // IT SHOULD FALL HERE! OnTimer3600: // After a hour for( set .@i,0; .@i < getarraysize($MVP_id); set .@i, .@i+1 ) { set .@time, $MVP_tm[.@i]*3600; // Conversion to seconds so we can use gettimetick if( ($MVP_last_respawn[.@i] + $MVP_tm[.@i]) > gettimetick(2) ) continue; // Time has yet to pass monster "map",0,0,"--ja--",$MVP_id[.@i],1; // Defines last respawn set $MVP_last_respawn[.@i], gettimetick(2); } setnpctimer 0; end; }

And I'm getting this warning in my map-server 

buildin_monster: Attempted to spawn monster class 1112 on non-existing map 'map'
are my maps correct?

 
Last edited by a moderator:
Whoops I forgot to change the map name, sorry :x

Code:
OnInit:	// Mvp ids	setarray $MVP_id[0],id1,id2,id3;	// Mvp maps NO GAT's!	setarray $MVP_maps$[0],"map1","map2","map3";	// Respawn time (HOURS)	setarray $MVP_tm[0],tm1,tm2,tm3;	initnpctimer;	// IT SHOULD FALL HERE!	OnTimer3600: // After a hour		for( set .@i,0; .@i < getarraysize($MVP_id); set .@i, .@i+1 )		{			set .@time, $MVP_tm[.@i]*3600; // Conversion to seconds so we can use gettimetick			if( ($MVP_last_respawn[.@i] + $MVP_tm[.@i]) > gettimetick(2) )				continue; // Time has yet to pass			monster $MVP_maps$[.@i],0,0,"--ja--",$MVP_id[.@i],1;			// Defines last respawn			set $MVP_last_respawn[.@i], gettimetick(2);		}		setnpctimer 0;		end;
Don't forget to delete the other spawns of those MVPS, otherwise this will just spawn other mob. Also this "mvp timer" continues to tick even if your server is off.
 
Working now with no error. 

You mean removed them in npc/mobs respawn time?

    setarray $MVP_tm[0],60,60,60;

is 60 in time will give me 60 seconds or 60 hours?

 
What is the purpose of .@time variable?

Is this behavior normal? The MVP will respawn even the last MVP respawn is not yet killed?

Can you pls fix this. It keeps respawning even the boss not killed

 
Last edited by a moderator:
Last edited by a moderator:
I think we're almost there.. I got error in MVP_alive array? I'm wondering where you call that array.. also on first respawn, always 2 MVP same id are summoned...

 
I know i am a "bit" late with my opinion ^^ but I use a local test server for scripting and other things. In that server i can do @reloadscript as much as i want / need and no player is online to kill any monster. New scripts are uploaded when they work 100% fine and i do @reloads for very important bugfixes ONLY. All other stuff has to wait for the next monthly maintenance.

Regards

Snowflake
default_wink.png


 
I know i am a "bit" late with my opinion ^^ but I use a local test server for scripting and other things. In that server i can do @reloadscript as much as i want / need and no player is online to kill any monster. New scripts are uploaded when they work 100% fine and i do @reloads for very important bugfixes ONLY. All other stuff has to wait for the next monthly maintenance.

Regards

Snowflake
default_wink.png
Thats the ideal way to do it. But you cant control the crash of the server that makes all ur mobs re respawn on sever restart. Specially MvPs.

 
I know i am a "bit" late with my opinion ^^ but I use a local test server for scripting and other things. In that server i can do @reloadscript as much as i want / need and no player is online to kill any monster. New scripts are uploaded when they work 100% fine and i do @reloads for very important bugfixes ONLY. All other stuff has to wait for the next monthly maintenance.

Regards

Snowflake
default_wink.png
Thats the ideal way to do it. But you cant control the crash of the server that makes all ur mobs re respawn on sever restart. Specially MvPs.
True ^^ i can't control a crash. In that case it is usefull to have a time controlled re-spawn in case the mvp was killed already. So it would be nice when the server logs it and respawns MvPs only in case their respawn time is up.

 
Back
Top