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:
Lemongrass3110
2022-11-07 00:41:10 +01:00
committed by GitHub
parent 774d4ca2e8
commit a763ad0629
12 changed files with 265 additions and 24 deletions

View File

@@ -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] */