Jump to content
  • 0

Mob random spawn


Danilo89

Question

Hi everyone, I am fixing the ochao temple and I have problems with the (Guardian En-Tai vnum: 6405). I need help with a quest that makes me randomly spawn in various areas of the map the coordinates I have already taken here: 

local coordinates = {{8892, 14464}, {8835, 14276}, {8639, 14224}, {8570, 14292}, {8671, 14465}, {8825, 14688}, {8796, 14787}} can you help me please?

Link to post

5 answers to this question

Recommended Posts

  • 0

it is the Temple of Ochao normal map, I would like that monster to change position once killed the coordinates are the ones I put in the first post.

29 minutes ago, Sonitex said:

Heya, is it a dungeon instance or just a normal map?

it is the Temple of Ochao normal map, I would like that monster to change position once killed the coordinates are the ones I put in the first post.

Edited by Danilo89
Link to post
  • 0
  • VIP

questlua_global.cpp

	int _spawn_mob_in_map(lua_State* L)
	{
		if (false == lua_isnumber(L, 1) || false == lua_isnumber(L, 2) || false == lua_isnumber(L, 3) 
			|| false == lua_isnumber(L, 4) || false == lua_isnumber(L, 5) || false == lua_isboolean(L, 6))
		{
			lua_pushnumber(L, 0);
			return 1;
		}

		const DWORD dwVnum = static_cast<DWORD>(lua_tonumber(L, 1));
		const size_t count = MINMAX(1, static_cast<size_t>(lua_tonumber(L, 2)), 10);
		const long lMapIndex = static_cast<long>(lua_tonumber(L, 3));
		const long lX = static_cast<long>(lua_tonumber(L, 4));
		const long lY = static_cast<long>(lua_tonumber(L, 5));
		const bool isAggresive = static_cast<bool>(lua_toboolean(L, 6));

		size_t SpawnCount = 0;

		const CMob* pMonster = CMobManager::instance().Get(dwVnum);

		if (NULL != pMonster)
		{
			const LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();

			for (size_t i = 0; i < count; ++i)
			{
				const LPCHARACTER pSpawnMonster = CHARACTER_MANAGER::instance().SpawnMob(dwVnum,
					lMapIndex,
					lX,
					lY,
					0,
					true,
					-1,
					pMonster->m_table.bType == CHAR_TYPE_STONE,
					isAggresive);

				if (NULL != pSpawnMonster)
				{
					++SpawnCount;
				}
			}

			sys_log(0, "QUEST Spawn Monster: VNUM(%u) COUNT(%u) isAggresive(%b)", dwVnum, SpawnCount, isAggresive);
		}

		lua_pushnumber(L, SpawnCount);

		return 1;
	}

	{	"spawn_mob_in_map",					_spawn_mob_in_map						},

 

Quest part:

local coordinates = 
{
	{8892, 14464}, 
	{8835, 14276}, 
	{8639, 14224}, 
	{8570, 14292}, 
	{8671, 14465}, 
	{8825, 14688}, 
	{8796, 14787}
}

local n = math.random(1, 7)	

-- Vnum Count MapIndex X Y IsAggressive
-- Also add did this function to quest_functions file
spawn_mob_in_map(VNUM, COUNT, MAP_INDEX, coordinates[n][1], coordinates[n][2], false)

 

Try this :) 

Link to post
  • 0
2 hours ago, Sonitex said:

questlua_global.cpp

	int _spawn_mob_in_map(lua_State* L)
	{
		if (false == lua_isnumber(L, 1) || false == lua_isnumber(L, 2) || false == lua_isnumber(L, 3) 
			|| false == lua_isnumber(L, 4) || false == lua_isnumber(L, 5) || false == lua_isboolean(L, 6))
		{
			lua_pushnumber(L, 0);
			return 1;
		}

		const DWORD dwVnum = static_cast<DWORD>(lua_tonumber(L, 1));
		const size_t count = MINMAX(1, static_cast<size_t>(lua_tonumber(L, 2)), 10);
		const long lMapIndex = static_cast<long>(lua_tonumber(L, 3));
		const long lX = static_cast<long>(lua_tonumber(L, 4));
		const long lY = static_cast<long>(lua_tonumber(L, 5));
		const bool isAggresive = static_cast<bool>(lua_toboolean(L, 6));

		size_t SpawnCount = 0;

		const CMob* pMonster = CMobManager::instance().Get(dwVnum);

		if (NULL != pMonster)
		{
			const LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();

			for (size_t i = 0; i < count; ++i)
			{
				const LPCHARACTER pSpawnMonster = CHARACTER_MANAGER::instance().SpawnMob(dwVnum,
					lMapIndex,
					lX,
					lY,
					0,
					true,
					-1,
					pMonster->m_table.bType == CHAR_TYPE_STONE,
					isAggresive);

				if (NULL != pSpawnMonster)
				{
					++SpawnCount;
				}
			}

			sys_log(0, "QUEST Spawn Monster: VNUM(%u) COUNT(%u) isAggresive(%b)", dwVnum, SpawnCount, isAggresive);
		}

		lua_pushnumber(L, SpawnCount);

		return 1;
	}

	{	"spawn_mob_in_map",					_spawn_mob_in_map						},

 

Quest part:

local coordinates = 
{
	{8892, 14464}, 
	{8835, 14276}, 
	{8639, 14224}, 
	{8570, 14292}, 
	{8671, 14465}, 
	{8825, 14688}, 
	{8796, 14787}
}

local n = math.random(1, 7)	

-- Vnum Count MapIndex X Y IsAggressive
-- Also add did this function to quest_functions file
spawn_mob_in_map(VNUM, COUNT, MAP_INDEX, coordinates[n][1], coordinates[n][2], false)

 

Try this :) 

ok thx for now i try

Link to post
  • 0

 

5 hours ago, Sonitex said:

questlua_global.cpp

	int _spawn_mob_in_map(lua_State* L)
	{
		if (false == lua_isnumber(L, 1) || false == lua_isnumber(L, 2) || false == lua_isnumber(L, 3) 
			|| false == lua_isnumber(L, 4) || false == lua_isnumber(L, 5) || false == lua_isboolean(L, 6))
		{
			lua_pushnumber(L, 0);
			return 1;
		}

		const DWORD dwVnum = static_cast<DWORD>(lua_tonumber(L, 1));
		const size_t count = MINMAX(1, static_cast<size_t>(lua_tonumber(L, 2)), 10);
		const long lMapIndex = static_cast<long>(lua_tonumber(L, 3));
		const long lX = static_cast<long>(lua_tonumber(L, 4));
		const long lY = static_cast<long>(lua_tonumber(L, 5));
		const bool isAggresive = static_cast<bool>(lua_toboolean(L, 6));

		size_t SpawnCount = 0;

		const CMob* pMonster = CMobManager::instance().Get(dwVnum);

		if (NULL != pMonster)
		{
			const LPCHARACTER pChar = CQuestManager::instance().GetCurrentCharacterPtr();

			for (size_t i = 0; i < count; ++i)
			{
				const LPCHARACTER pSpawnMonster = CHARACTER_MANAGER::instance().SpawnMob(dwVnum,
					lMapIndex,
					lX,
					lY,
					0,
					true,
					-1,
					pMonster->m_table.bType == CHAR_TYPE_STONE,
					isAggresive);

				if (NULL != pSpawnMonster)
				{
					++SpawnCount;
				}
			}

			sys_log(0, "QUEST Spawn Monster: VNUM(%u) COUNT(%u) isAggresive(%b)", dwVnum, SpawnCount, isAggresive);
		}

		lua_pushnumber(L, SpawnCount);

		return 1;
	}

	{	"spawn_mob_in_map",					_spawn_mob_in_map						},

 

Quest part:

local coordinates = 
{
	{8892, 14464}, 
	{8835, 14276}, 
	{8639, 14224}, 
	{8570, 14292}, 
	{8671, 14465}, 
	{8825, 14688}, 
	{8796, 14787}
}

local n = math.random(1, 7)	

-- Vnum Count MapIndex X Y IsAggressive
-- Also add did this function to quest_functions file
spawn_mob_in_map(VNUM, COUNT, MAP_INDEX, coordinates[n][1], coordinates[n][2], false)

 

Try this :) 

nothing to do I can not do it are a real disaster!

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 0

      EVENT FLAG NOTICE

    2. 0

      Sash bug +19% absorb

    3. 1

      TRANSMUTATION WITH BLESSING SCROLL AND MAGIC STONE 100%

    4. 1

      [HowTo] The "hello world" of metin2

    5. 1

      TRANSMUTATION WITH BLESSING SCROLL AND MAGIC STONE 100%

    6. 0

      Sash absorb bug

    7. 0

      Debug DB vanilla Core

    8. 0

      Give item after kill monster [c++]

  • Recently Browsing

    No registered users viewing this page.

Shoutbox

Shoutbox

Chatroom Rules

 

Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules

 

×
×
  • 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.