summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-06-21 22:42:57 -0400
committerJared Adams <jaxad0127@gmail.com>2009-06-22 03:59:30 +0000
commite82db6d8164e1f98e0d9458b2342728f6d7159e1 (patch)
treea82a5a0075f3391875d21e68362d76891557992c
parent0af91d28c322dfd25c29f2c0b93759e26e6612cc (diff)
downloadtmwa-e82db6d8164e1f98e0d9458b2342728f6d7159e1.tar.gz
tmwa-e82db6d8164e1f98e0d9458b2342728f6d7159e1.tar.bz2
tmwa-e82db6d8164e1f98e0d9458b2342728f6d7159e1.tar.xz
tmwa-e82db6d8164e1f98e0d9458b2342728f6d7159e1.zip
Addes the fakenpcname script function
It pretty much follows the documentation listed below Minus the fact the sprite id is not optional http://www.valholl.ca/ref/eAthenaScriptCommands.html#fakenpcname
-rw-r--r--src/map/script.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index dddb395..94f03f7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -284,6 +284,7 @@ int buildin_areatimer(struct script_state *st); // [Jaxad0127]
int buildin_isin(struct script_state *st); // [Jaxad0127]
int buildin_shop(struct script_state *st); // [MadCamel]
int buildin_isdead(struct script_state *st); // [Jaxad0127]
+int buildin_fakenpcname(struct script_state *st); //[Kage]
void push_val(struct script_stack *stack,int type,int val);
int run_func(struct script_state *st);
@@ -488,7 +489,8 @@ struct {
{buildin_areatimer,"areatimer","siiiiis"},
{buildin_isin,"isin","siiii"},
{buildin_shop,"shop","s"},
- {buildin_isdead,"isdead","i"}, // End Additions
+ {buildin_isdead,"isdead","i"},
+ {buildin_fakenpcname,"fakenpcname","ssi"}, //End Additions
{NULL,NULL,NULL},
};
int buildin_message(struct script_state *st); // [MouseJstr]
@@ -5946,6 +5948,32 @@ int buildin_isdead(struct script_state *st)
return 0;
}
+/*========================================
+ * Changes a NPC name, and sprite
+ *----------------------------------------
+ */
+int buildin_fakenpcname(struct script_state *st)
+{
+ char *name, *newname;
+ int newsprite;
+ struct npc_data *nd;
+
+ name = conv_str(st,& (st->stack->stack_data[st->start+2]));
+ newname = conv_str(st,& (st->stack->stack_data[st->start+3]));
+ newsprite = conv_num(st,& (st->stack->stack_data[st->start+4]));
+ nd = npc_name2id(name);
+ if (!nd)
+ return 1;
+ strncpy(nd->name, newname, 24);
+ nd->class = newsprite;
+
+ // Refresh this npc
+ npc_enable(name,0);
+ npc_enable(name,1);
+
+ return 0;
+}
+
//
// ŽÀs•”main
//