From 30c175a9041a17e0d2ef1d4750163c19ab3a7959 Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Wed, 27 Nov 2019 02:50:08 +0100 Subject: Change unload NPC behavior to kill mobs that were spawned by unloaded NPC (non-permanent monster spawns) [Issue #2530] Mobs spawned by NPC will be removed on @reloadnpc, @unloadnpc, and @unloadnpcfile. Additionally OnNPCUnload NPC label was added, to revert other changes made by NPC. For example set/removed mapflags or added mob drops. --- doc/atcommands.txt | 34 +++++++++++++++++++++++++--------- doc/script_commands.txt | 5 +++++ 2 files changed, 30 insertions(+), 9 deletions(-) (limited to 'doc') diff --git a/doc/atcommands.txt b/doc/atcommands.txt index 419cb0acd..0cddc1680 100644 --- a/doc/atcommands.txt +++ b/doc/atcommands.txt @@ -1273,31 +1273,47 @@ Example: --------------------------------------- -@unloadnpc - -Unloads an NPC. +@unloadnpc {} + +Unloads a NPC. +Flag: + 0 - do not unload mobs spawned by NPCs in file + 1 - unload mobs spawned by NPCs in file + Default is 1; every number other than 0 will be treaten as 1. + Mobs that were spawned with monster/areamonster/guardian/bg_monster/atcommand("@monster xy") are affected. +Note: + Be aware that some changes made by NPC are not reverted on unload. + Please use the OnNPCUnload label to clean things up by yourself. Commonly relevant for these script commands: + -> setmapflagnosave, setmapflag, removemapflags, setbattleflag, setcell, setwall + -> agitstart/agitstart2, agitend/agitend2, gvgon, gvgoff, pvpon, pvpoff + -> addmonsterdrop, setitemscript, npcshopitem, npcshopadditem, npcshopdelitem, hateffect, disguise + -> pcfollow, pcblockmove, setpcblock, setnpcdir, navigateto, viewpoint, add_group_command, skill/addtoskill + -> instance and battleground related stuff (excepting bg_monster) Example: -@unloadnpc Job Master +@unloadnpc Job Master 0 --------------------------------------- -@unloadnpcfile +@unloadnpcfile {} Unloads all NPCs in a file. +Flag: See @unloadnpc +Note: See @unloadnpc Example: -@unloadnpcfile npc/custom/jobmaster.txt +@unloadnpcfile npc/custom/jobmaster.txt 0 --------------------------------------- -@reloadnpc +@reloadnpc {} Unloads all NPCs in a file and reload it again. -Note: Be aware that mapflags and monsters spawned directly are not removed. +Flag: See @unloadnpc +Note: See @unloadnpc Example: -@reloadnpc npc/custom/jobmaster.txt +@reloadnpc npc/custom/jobmaster.txt 0 --------------------------------------- diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 244de4c0c..399af30b3 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1034,6 +1034,11 @@ will only execute once and will not execute if the map server reconnects to the char server later. Note that all those events will be executed upon scripts reloading. +OnNPCUnload: + +OnNPCUnload will be executed when a NPC is unloaded. +OnNPCUnload is called when @reloadscript, @reloadnpc, @unloadnpc or @unloadnpcfile is used. + OnAgitStart: OnAgitEnd: OnAgitInit: -- cgit v1.2.3-60-g2f50