Tokei

Adding reloadnpc as an atcommand

Recommended Posts

Heya,

I would like to suggest adding @reloadnpc as an official atcommand to reload scripts. Currently we have to use @unloadnpcfile followed by @loadnpc which is a bit awkward when you want to create a new script. With @reloadnpc, you'd be able to load and reload NPCs with the same command.

ACMD_FUNC(reloadnpc) {
	if (!message || !*message) {
		clif_displaymessage(fd, "Usage: @reloadnpc <file name>");
		return -1;
	}

	if (npc_unloadfile(message))
		clif_displaymessage(fd, msg_txt(sd,1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed.

	if (!npc_addsrcfile(message) || !npc_parsesrcfile(message,true)) {
		clif_displaymessage(fd, msg_txt(sd,261));
		return -1;
	}

	npc_read_event_script();

	clif_displaymessage(fd, msg_txt(sd,262));
	return 0;
}

 

  • Upvote 6

Share this post


Link to post
Share on other sites

It would be nice to see this implemented. We've talk about it too ( Issue: 203 )

Share this post


Link to post
Share on other sites