Jump to content

Recommended Posts

How i can convert database coord in minimap coord. Character is in same place about 1 hour. I need for a traget system... and i need coords from db but don't work , just with minimap.

Qhz7Anu.jpg

Or to modifi this to work with database coord:

	int target_pos(lua_State* L)
	{
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		int iQuestIndex = CQuestManager::instance().GetCurrentPC()->GetCurrentQuestIndex();

		if (!lua_isstring(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
		{
			sys_err("invalid argument, name: %s, quest_index %d", ch->GetName(), iQuestIndex);
			return 0;
		}

		PIXEL_POSITION pos;

		if (!SECTREE_MANAGER::instance().GetMapBasePositionByMapIndex(ch->GetMapIndex(), pos))
		{
			sys_err("cannot find base position in this map %d", ch->GetMapIndex());
			return 0;
		}

		int x = pos.x + (int) lua_tonumber(L, 2) * 100;
		int y = pos.y + (int) lua_tonumber(L, 3) * 100;

		CTargetManager::instance().CreateTarget(ch->GetPlayerID(),
				iQuestIndex,
				lua_tostring(L, 1),
				TARGET_TYPE_POS,
				x,
				y,
				(int) lua_tonumber(L, 4),
				lua_isstring(L, 5) ? lua_tostring(L, 5) : NULL,
				lua_isnumber(L, 6) ? (int)lua_tonumber(L, 6): 1);

		return 0;
	}

If i put minimap coord work ex :target.pos("__TARGET__", 382, 687, 41, "Test Titlu")  but with database coord not work ex :target.pos("__TARGET__", 959890, 273537, 41, "Test Titlu")

How i can modifi this to work with database coord?

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Well the coordinates you have in db are global whereas the one in game are local (map). 

Try checking the coordinates against atlasinfo.txt it should be (global map coordinates + local coordinates = values in db) if this is true then all you have to do is write up map indexes with their global coordinates do some math against the coordinates from db and you have your plain local coords.

Link to comment
Share on other sites

Acum 40 minute, asdajdja a spus:

Well the coordinates you have in db are global whereas the one in game are local (map). 

Try checking the coordinates against atlasinfo.txt it should be (global map coordinates + local coordinates = values in db) if this is true then all you have to do is write up map indexes with their global coordinates do some math against the coordinates from db and you have your plain local coords.

I think best solution is to edit  target_pos  function to work with global coordinates. But i don't know how..

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.