Hey, this system looks great, but I have troubles figuring proper cleanUp/onDestroy/GameEnd etc event for NPCs:
1st part is easy:
Code:
if ds_exists(defaultMap, ds_type_map) {
ds_map_destroy(defaultMap);
}
if ds_exists(chatMap, ds_type_map) {
ds_map_destroy(chatMap);
}
But after that there also numeral ds_lists op0[_on0,_on1] and op1[_on0,_on1] created in "while" loop with local vars _on0 and_on1.
What is good way of destroying them could be?
I thinking of storing their "names" in an extra ds (another list?) then going through it in a loop destroing every incuded list, then that extra list themself.
Have no idea if it's best way.
Could be nice to have cleanUp/onDestroy event included in Example.
upd: what do you say, next thing will work?
Code:
if ds_exists(optionsList, ds_type_list){
if !ds_list_empty(optionsList){
for (var i = 0; i < ds_list_size(optionsList); ++i) {
var j = ds_list_find_value(optionsList, i);
ds_list_destroy(j);
}
}
ds_list_destroy(optionsList);
}
in load_npcChat list "optionsList" getting created if there was none, when meets "(OPTION): " string and later
ds_list_add(optionsList, op0[_on0,_on1]); and ds_list_add(optionsList, op1[_on0,_on1]); right after their respective creations.