summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.cpp2
-rw-r--r--src/map/script.cpp24
2 files changed, 24 insertions, 2 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 772adac..c3c22de 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -535,7 +535,7 @@ int mmo_char_init(void)
static
void mmo_char_sync(void)
{
- int i, j, k;
+ int i;
int lock;
FILE *fp;
diff --git a/src/map/script.cpp b/src/map/script.cpp
index a76563f..b5e2aca 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -4291,11 +4291,32 @@ void builtin_isdead(ScriptState *st)
push_val(st->stack, ScriptCode::INT, pc_isdead(sd));
}
+/*========================================
+ * Changes a NPC name, and sprite
+ *----------------------------------------
+ */
+static
+void builtin_fakenpcname(ScriptState *st)
+{
+ const char *name = conv_str(st, &(st->stack->stack_data[st->start + 2]));
+ const char *newname = conv_str(st, &(st->stack->stack_data[st->start + 3]));
+ int newsprite = conv_num(st, &(st->stack->stack_data[st->start + 4]));
+ struct npc_data *nd = npc_name2id(name);
+ if (!nd)
+ return;
+ strzcpy(nd->name, newname, sizeof(nd->name));
+ nd->npc_class = newsprite;
+
+ // Refresh this npc
+ npc_enable(name, 0);
+ npc_enable(name, 1);
+
+}
+
/*============================
* Gets the PC's x pos
*----------------------------
*/
-
static
void builtin_getx(ScriptState *st)
{
@@ -5229,6 +5250,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(shop, "s"),
BUILTIN(isdead, ""),
BUILTIN(unequipbyid, "i"),
+ BUILTIN(fakenpcname, "ssi"),
BUILTIN(getx, ""),
BUILTIN(gety, ""),
BUILTIN(getmap, ""),