Jump to content

[C++] Move a Char?


Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hey Metin2Dev Com,

 

i was try to move a charakter with quest commands.

I try

"Move(...)"

"Goto(...)"

"SendMovePacket(...)"

 

but nothing works.. does anyone have an idea how i can move Charakter like monsters with coward?

 

hope you unterstand..

Thanks 4 help

check this 

ACMD(do_goto)
{
char arg1[256], arg2[256];
int x = 0, y = 0, z = 0;
 
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
 
if (!*arg1 && !*arg2)
{
ch->ChatPacket(CHAT_TYPE_INFO, "Usage: goto <x meter> <y meter>");
return;
}
 
if (isnhdigit(*arg1) && isnhdigit(*arg2))
{
str_to_number(x, arg1);
str_to_number(y, arg2);
 
PIXEL_POSITION p;
 
if (SECTREE_MANAGER::instance().GetMapBasePosition(ch->GetX(), ch->GetY(), p))
{
x += p.x / 100;
y += p.y / 100;
}
 
ch->ChatPacket(CHAT_TYPE_INFO, "You goto ( %d, %d )", x, y);
}
else
{
int mapIndex = 0;
BYTE empire = 0;
 
if (*arg1 == '#')
str_to_number(mapIndex,  (arg1 + 1));
 
if (*arg2 && isnhdigit(*arg2))
{
str_to_number(empire, arg2);
empire = MINMAX(1, empire, 3);
}
else
empire = ch->GetEmpire();
 
if (CHARACTER_GoToName(ch, empire, mapIndex, arg1))
{
ch->ChatPacket(CHAT_TYPE_INFO, "Cannot find map command syntax: /goto <mapname> [empire]");
return;
}
 
return;
 
/*
  int iMapIndex = 0;
  for (int i = 0; aWarpInfo.c_pszName != NULL; ++i)
  {
  if (iMapIndex != 0)
  {
  if (iMapIndex != aWarpInfo.iMapIndex)
  continue;
  }
  else if (!FindInString(arg1, aWarpInfo.c_pszName))
  continue;
 
  if (aWarpInfo.bEmpire == 0 || aWarpInfo.bEmpire == bEmpire)
  {
  x = aWarpInfo.x * 100;
  y = aWarpInfo.y * 100;
 
  ch->ChatPacket(CHAT_TYPE_INFO, "You warp to ( %d, %d )", x, y);
  ch->WarpSet(x, y);
  ch->Stop();
  return;
  }
  }
*/
 
}
 
x *= 100;
y *= 100;
 
ch->Show(ch->GetMapIndex(), x, y, z);
ch->Stop();
}
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.