summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emap/status.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/emap/status.c b/src/emap/status.c
index bc3f0e3..262ea93 100644
--- a/src/emap/status.c
+++ b/src/emap/status.c
@@ -16,6 +16,7 @@
#include "map/map.h"
#include "map/npc.h"
#include "map/pc.h"
+#include "map/script.h"
#include "map/status.h"
#include "emap/data/itemd.h"
@@ -45,6 +46,17 @@ void estatus_set_viewdata_post(struct block_list *bl,
{
data->init = true;
npc->vd->sex = 3;
+ if (npc->subtype == SCRIPT)
+ {
+ if (npc->u.scr.script)
+ {
+ // here some magic to set npc local variable .id to bl.id
+ const int num = reference_uid(script->add_str(".id"), 0);
+ if (!npc->u.scr.script->local.vars)
+ npc->u.scr.script->local.vars = i64db_alloc(DB_OPT_RELEASE_DATA);
+ i64db_iput(npc->u.scr.script->local.vars, num, npc->bl.id);
+ }
+ }
}
}