Implemented dynamic NPCs (#7402)
This is required for features like #6640 Added COLOR_LIGHT_YELLOW Cleaned up color definitions, its useless to store them as string first. Dynamic NPCs will stay when you switch map and come back in time. Dynamic NPCs will be removed instantly when you log out. You can only create one dynamic NPC at a time. Thanks to @Atemo!
This commit is contained in:
@@ -3426,6 +3426,19 @@ int unit_free(struct block_list *bl, clr_type clrtype)
|
||||
sd->npc_id = 0;
|
||||
}
|
||||
|
||||
if( sd->npc_id_dynamic != 0 ){
|
||||
struct npc_data* nd = map_id2nd( sd->npc_id_dynamic );
|
||||
|
||||
if( nd != nullptr ){
|
||||
// Delete the NPC
|
||||
npc_unload( nd, true );
|
||||
// Update NPC event database
|
||||
npc_read_event_script();
|
||||
}
|
||||
|
||||
sd->npc_id_dynamic = 0;
|
||||
}
|
||||
|
||||
sd->combos.clear();
|
||||
|
||||
if( sd->sc_display_count ) { /* [Ind] */
|
||||
|
||||
Reference in New Issue
Block a user