From e82db6d8164e1f98e0d9458b2342728f6d7159e1 Mon Sep 17 00:00:00 2001 From: Chuck Miller Date: Sun, 21 Jun 2009 22:42:57 -0400 Subject: 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 --- src/map/script.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/map') 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 // -- cgit v1.2.3-70-g09d2