Jump to content
  • 0

Help new function for spawn a mob in a map



Hi mates.


Actually im trying to do the same that mob.spawn(), but with a new argument for the map.


Like this:


mob.spawn_in_map(114, 20300, 200,200,1)


anyone can help me with this?.






Link to comment

8 answers to this question

Recommended Posts

  • 0
	int _spawn_mob_in_map(lua_State * L)
		if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L,4) || !lua_isnumber(L,5) || !lua_isboolean(L,6))
			sys_err("Missing argument!");
			return 1;

		long lMapIndex = static_cast<long>(lua_tonumber(L, 1));
		DWORD dwMobVnum = static_cast<DWORD>(lua_tonumber(L, 2));
		long x = static_cast<long>(lua_tonumber(L, 3));
		long y = static_cast<long>(lua_tonumber(L, 4));
		BYTE bSpawnCount = static_cast<BYTE>(lua_tonumber(L, 5));
		bool isAggressive = lua_toboolean(L, 6);

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

		if (pMonster)
			for (BYTE i = 0; i < bSpawnCount; ++i)
				LPCHARACTER pSpawnMonster = CHARACTER_MANAGER::instance().SpawnMobRange(
					x - number(200, 750),
					y - number(200, 750),
					x + number(200, 750),
					y + number(200, 750),
					pMonster->m_table.bType == CHAR_TYPE_STONE,

				if (pSpawnMonster)
			sys_log(0, "QUEST Spawn Monster: VNUM(%u) COUNT(%d) isAggressive(%d)", dwMobVnum, bSpawnCount, isAggressive);

		lua_pushnumber(L, 0);
		return 1;

How to use it ;


Kind Regards

Ken ~ TA

  • Love 3

Do not be sorry, be better.

Link to comment
  • 0

on is agressive what i need to put?


If you want to this mob as aggressive (when it's spawn, mob is attack to player)


if you want to this mob as aggressive ; true

if you don't want to this mob as aggressive ; false


Kind Regards

Ken ~ TA

Edited by Ken

Do not be sorry, be better.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

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