Jump to content

Mob random spawn


Recommended Posts

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 comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 comment
Share on other sites

  • Premium

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 comment
Share on other sites

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 comment
Share on other sites

 

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