From f290bc97be1946848fd4bfc07fa14df2b621c373 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Wed, 2 Oct 2019 08:19:03 +0200 Subject: [PATCH] Fixed achievementexists script command (#4379) Fixes #4378 Thanks to @ecdarreola and @teededung --- doc/script_commands.txt | 2 +- src/map/script.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 781f1869ce..3824b30a37 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10362,7 +10362,7 @@ Returns true on success and false on failure. *achievementexists({,}); This function will return if the achievement exists on the player or the supplied -. + and is completed. Returns true on success and false on failure. --------------------------------------- diff --git a/src/map/script.cpp b/src/map/script.cpp index 7602f068b2..f251477a98 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -23808,7 +23808,7 @@ BUILDIN_FUNC(achievementexists) { } } - ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == achievement_id); + ARR_FIND(0, sd->achievement_data.count, i, sd->achievement_data.achievements[i].achievement_id == achievement_id && sd->achievement_data.achievements[i].completed > 0 ); script_pushint(st, i < sd->achievement_data.count ? true : false); return SCRIPT_CMD_SUCCESS; }