PDA

View Full Version : movenpc function


8ball
09-12-2004, 01:07 PM
i couldnt find a function to move an npc so i decided to make one
there may be a few errors since i only know the basics of C++

parser.cpp
else if (!strcmp(strlwr(command),"movenpc")) {
if (other) other->MovePc((atoi(arglist[0])),(atof(arglist[1])),
(atof(arglist[2])),(atof(arglist[3])));

embparser.cpp
"sub movenpc{push(@cmd_queue,{func=>'movenpc',args=>join(',',@_)});}"

if there are any errors please post here with a fix. i dont have a server so i dont have a way to test it.

Cisyouc
09-12-2004, 01:09 PM
Um. MovePC moves the Player not an NPC I believe.........

And this is already quest::movepc();

Thats why theres a fourth arg, zoneid.

8ball
09-12-2004, 01:10 PM
yes.....thats why i made move NPC

Cisyouc
09-12-2004, 01:11 PM
yes.....thats why i made move NPC
Um.
other->MovePCI believe thats the same command used in movepc(). Let me check...

8ball
09-12-2004, 01:12 PM
ya sry i just noticed that
like i said i dont know c++ that well hehe...
i changed it to other->movenpc
not sure if that will work tho

Cisyouc
09-12-2004, 01:13 PM
Nevermind, My bad. But will this work crossing over a zone?

8ball
09-12-2004, 01:16 PM
not sure.
i have no way of testing it so if someone who has a server wants to test it go ahead :P

Cisyouc
09-12-2004, 01:20 PM
other. Hmm. Im not sure if its MovePC that targets the PC or CastToClient() that does. So I'm not sure if this will work.

Cisyouc
09-12-2004, 01:38 PM
Err, other->MoveNPC would have to be defined. It wont just 'know' that.

8ball
09-12-2004, 02:27 PM
how would i go about defining it?

killspree
09-12-2004, 04:38 PM
Well you could always try quest::moveto()...I think that starts the NPC on a path to the loc, but it will at least move them there(if it's working...haven't really tested it). There's no MoveNPC that I know of...you'd also have to take into account the fact that by simply "moving" them, you pretty much summon them. Summoned NPCs return to their spawn point as far as I know.

You'd have to alter their x/y/z above just moving them to the new location, or create a flag that disables the "return to spawn" code for special cases like this.

8ball
09-13-2004, 03:17 AM
the reason i decided to make this was so i could temorarily move an npc somewhere.
on live there was a monk quest where you had to fight Grand Master Glock. the quest moved you to an enclosed room that couldnt be accessed except by hailing master glock and then you'd get teleported to a new room. i think it was just an entirely different mob in there tho.
still, i think this could come in handy with certain things.

Cisyouc
09-13-2004, 07:12 AM
Well, it probably didn't move the NPC but it actually did

quest::spawn(samenpcnumber,x,y,z);
quest::movepc($zoneid,x,y,z);
quest::depop();

(but it would be in the format of however Sony does quests :D )

it just appeared like the npc moved.

8ball
09-13-2004, 10:57 AM
ya, i realized that when i was spacing out in math class about 3 hours ago lol