how can i teleport my self to a npc with command?

01/23/2011 15:04 EternityViruz#1
Title says it all xP
how can i teleport my self to a npc with command?
Thanks :)
01/23/2011 18:23 §hift#2
Code:
if (Cmd[0] == "/mmtonpc")
                                    {
                                        foreach (Game.NPC N in World.H_NPCs.Values)
                                        {
                                            if (uint.Parse(Cmd[1]) == N.EntityID)
                                                GC.MyChar.Teleport(N.Loc.Map, N.Loc.X, N.Loc.Y);
                                        }
                                        break;
                                    }
so your command is /mmtonpc NPCENTITYID
if you Don't know what's EntityID, let me help you
here's an example from NPCs.txt
Quote:
101736 1507 21 0 1039 481 289
The Red one is entity ID

__________________________________________

Press thanks if it helped :P
01/23/2011 19:18 .Beatz#3
Quote:
Originally Posted by §hift View Post
Code:
if (Cmd[0] == "/mmtonpc")
                                    {
                                        foreach (Game.NPC N in World.H_NPCs.Values)
                                        {
                                            if (uint.Parse(Cmd[1]) == N.EntityID)
                                                GC.MyChar.Teleport(N.Loc.Map, N.Loc.X, N.Loc.Y);
                                        }
                                        break;
                                    }
so your command is /mmtonpc NPCENTITYID
if you Don't know what's EntityID, let me help you
here's an example from NPCs.txt

The Red one is entity ID

__________________________________________

Press thanks if it helped :P
Can't remember how to do this right but you wouldn't want to tele direct onto the NPC so you would want to make the X and Y coords like -1 or +1

GC.MyChar.Teleport(N.Loc.Map, N.Loc.X -1, N.Loc.Y -1);

Well that is in my source lol but going right onto an NPC I think would bug the char and you wouldnt be able to move... (I hope im right lol if not I look like an idiot) haha
01/23/2011 19:39 §hift#4
Quote:
Originally Posted by .Beatz View Post
Can't remember how to do this right but you wouldn't want to tele direct onto the NPC so you would want to make the X and Y coords like -1 or +1

GC.MyChar.Teleport(N.Loc.Map, N.Loc.X -1, N.Loc.Y -1);

Well that is in my source lol but going right onto an NPC I think would bug the char and you wouldnt be able to move... (I hope im right lol if not I look like an idiot) haha
I tested it , it works fine..Character isn't stuck.
01/23/2011 19:44 .Beatz#5
Ah okay then was just a thought...but wouldn't it be better to tele like -1 coord away from the NPC anyway... Just a thought