Jump to content
Igniz

MvP and @reloadscript

Recommended Posts

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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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:

// 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;}

Share this post


Link to post
Share on other sites

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:

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;

Share this post


Link to post
Share on other sites

Thank you!

 

Mob still respawn after server restart :(

 

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

Edited by Hadeszeus

Share this post


Link to post
Share on other sites

Whoops I forgot to change the map name, sorry :x

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Edited by Hadeszeus

Share this post


Link to post
Share on other sites

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

Everything should be fixed now, even the .@time variable c:

http://pastebin.com/sAX7KazV

 

EDIT:

Script corrected, forgot to remove a 'setd'

http://pastebin.com/nrXrGEbT

Edited by pan

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ;)

Share this post


Link to post
Share on other sites

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 ;)

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.

Share this post


Link to post
Share on other sites

 

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 ;)

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.

Share this post


Link to post
Share on other sites

Hello there,

 

In case the topic still interests people, THIS is what I used when I was using rAthena (switched to Hercules recently).

Hope it helps.

Edited by Adam

Share this post


Link to post
Share on other sites

@malufett:

 

you said some months ago you want to take care of this suggestion.

what happened to it?

 

this suggestions is a very nice suggestion i still hope you guys will implement it.

 

 

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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