summaryrefslogtreecommitdiff
path: root/src/emap/script_buildins.c
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-04-26 20:27:54 -0400
committergumi <git@gumi.ca>2020-04-26 20:27:54 -0400
commitb3f44a8e8ef767617c5e09ba689c16aa3c00d448 (patch)
treeb4b1076ca9f5f5cb3f36257de6ea7b6a46520ec4 /src/emap/script_buildins.c
parent229ddd2afb47cf2aeeae42f5ce6064d59e69ac42 (diff)
downloadevol-hercules-b3f44a8e8ef767617c5e09ba689c16aa3c00d448.tar.gz
evol-hercules-b3f44a8e8ef767617c5e09ba689c16aa3c00d448.tar.bz2
evol-hercules-b3f44a8e8ef767617c5e09ba689c16aa3c00d448.tar.xz
evol-hercules-b3f44a8e8ef767617c5e09ba689c16aa3c00d448.zip
add buildin getnpcsubtype() to get nd->subtype
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r--src/emap/script_buildins.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 2899cc3..94ed92d 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -2349,6 +2349,30 @@ BUILDIN(isInstance)
return true;
}
+BUILDIN(getNpcSubtype)
+{
+ TBL_NPC *nd = map->id2bl(st->oid);
+
+ if (script_hasdata(st, 2))
+ {
+ if (script_isstringtype(st, 2)) {
+ nd = npc->name2id(script_getstr(st, 2));
+ } else {
+ nd = map->id2bl(script_getnum(st, 2));
+ }
+ }
+
+ if (!nd)
+ {
+ ShowWarning("npc not found\n");
+ script->reportsrc(st);
+ return false;
+ }
+
+ script_pushint(st, nd->subtype);
+ return true;
+}
+
/*==========================================
* return the battle stats of a structure
* Supported values are most of UDT_* ones