BUILDIN_FUNC(mobexists) //added code start { struct mob_db *mob, *mob_array[MAX_SEARCH]; const char* mob_id = script_getstr(st,2); int count; int i, j, k; if (!mob_id){ ShowError("buildin_mobexists: No Monster ID set."); return -1; } // If monster identifier/name argument is a name if ((i = mobdb_checkid(atoi(mob_id)))) { mob_array[0] = mob_db(i); count = 1; } else count = mobdb_searchname_array(mob_array, MAX_SEARCH, mob_id); if (!count) { script_pushint(st,-1); } if (count > MAX_SEARCH) { count = MAX_SEARCH; } for (k = 0; k < count; k++) { mob = mob_array[k]; for (i = 0; i < ARRAYLENGTH(mob->spawn) && mob->spawn[i].qty; i++) { j = map_mapindex2mapid(mob->spawn[i].mapindex); if (j < 0) continue; } if (i == 0) { script_pushint(st,-1); } else { script_pushint(st,1); } } return 0; } //added code end