summaryrefslogtreecommitdiff
path: root/src/emap/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-27 21:24:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-27 21:24:42 +0300
commitfd4184140cd6f61243035398391adec06de5666c (patch)
treef2d53ad778eba77b75bbceedc0e0cf4b6f72cde7 /src/emap/script.c
parent9e4be5dcf5bd2bc1674b93441a6ef57283a1e14b (diff)
downloadplugin-fd4184140cd6f61243035398391adec06de5666c.tar.gz
plugin-fd4184140cd6f61243035398391adec06de5666c.tar.bz2
plugin-fd4184140cd6f61243035398391adec06de5666c.tar.xz
plugin-fd4184140cd6f61243035398391adec06de5666c.zip
Allow get/set npc speed by variable '.speed'.
Diffstat (limited to 'src/emap/script.c')
-rw-r--r--src/emap/script.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/emap/script.c b/src/emap/script.c
index 3d67429..002d581 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -107,6 +107,15 @@ void escript_set_reg_npc_num(struct script_state* st, struct reg_db *n, int64 *n
npc->setclass(nd, class_);
hookStop();
}
+ else if (!strcmp(name, ".speed"))
+ {
+ getND();
+
+ unit->bl2ud2(&nd->bl); // ensure nd->ud is safe to edit
+ nd->speed = *val;
+ nd->ud->state.speed_changed = 1;
+ hookStop();
+ }
}
int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, struct script_data* data)
@@ -155,6 +164,12 @@ int escript_get_val_npcscope_num(struct script_state* st, struct reg_db *n, stru
hookStop();
return nd->class_;
}
+ else if (!strcmp(name, ".speed"))
+ {
+ getNDReturn(0);
+ hookStop();
+ return nd->speed;
+ }
return 0;
}