Jump to content

hacer que un npc aparezca cada cierto tiempo


sol

Mensajes recomendados

quest mob begin
	state start begin
		function Tiempo()
			local mTime = 60*60*24*30	--Cada 30 dias
				return mTime
		end
		
		function Valores()
			local mValue = { (pc.getqf("uso")), (pc.getqf("tiempo")) }
				return mValue
		
		when x.use begin
			say_title'hola'
			say'....'
			pc.setqf("uso", 1)	
			pc.setqf("tiempo", get_time() + mob.Tiempo())
			chat'en 30 dias el mob sera invocado'
		end
		
		when login with mob.Valores()[1] > 0 begin
			if get_time() > mob.Valores()[2] then
				pc.invocar_mob(id,x,y)
			end
		end
	end
end
		
		
questlua_pc.cpp
#ifdef ENABLE_INVOCAR_MOB
int pc_invocar_mob(lua_State* L)
	{
		if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
		{
			sys_err("argumento invalido");
			return 0;
		}

		CQuestManager& mob = CQuestManager::instance();
		DWORD vid = 0;
		DWORD dwVnum = (DWORD) lua_tonumber(L, 1);
		long x = (long) lua_tonumber(L, 2);
		long y = (long) lua_tonumber(L, 3);
		float radius = lua_isnumber(L, 4) ? (float) lua_tonumber(L, 4) : 0;
		DWORD count = (lua_isnumber(L, 5)) ? (DWORD) lua_tonumber(L, 5) : 1;
		if (count == 0)
			count = 1;
		while (count --)
		{
			if (radius<1)
			{
				LPCHARACTER ch = mob->CaerMob(dwVnum, x, y);
				if (ch && !vid)
					vid = ch->GetVID();
			}
			else
			{
				float angle = number(0, 999) * M_PI * 2 / 1000;
				float r = number(0, 999) * radius / 1000;

				long nx = x + (long)(r * cos(angle));
				long ny = y + (long)(r * sin(angle));

				LPCHARACTER ch = mob->CaerMob(dwVnum, nx, ny);
				if (ch && !vid)
					vid = ch->GetVID();
			}
		}

		lua_pushnumber(L, vid);
		return 1;
	}
#endif
#ifdef ENABLE_INVOCAR_MOB
			{ "invocar_mob",		pc_invocar_mob			},
#endif
		
service.h
#define ENABLE_INVOCAR_MOB

 

Enlace para comentar
Compartir en otros sitios

hace 23 minutos, Jfirewall dijo:

quest mob begin
	state start begin
		function Tiempo()
			local mTime = 60*60*24*30	--Cada 30 dias
				return mTime
		end
		
		function Valores()
			local mValue = { (pc.getqf("uso")), (pc.getqf("tiempo")) }
				return mValue
		
		when x.use begin
			say_title'hola'
			say'....'
			pc.setqf("uso", 1)	
			pc.setqf("tiempo", get_time() + mob.Tiempo())
			chat'en 30 dias el mob sera invocado'
		end
		
		when login with mob.Valores()[1] > 0 begin
			if get_time() > mob.Valores()[2] then
				pc.invocar_mob(id,x,y)
			end
		end
	end
end
		
		
questlua_pc.cpp
#ifdef ENABLE_INVOCAR_MOB
int pc_invocar_mob(lua_State* L)
	{
		if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
		{
			sys_err("argumento invalido");
			return 0;
		}

		CQuestManager& mob = CQuestManager::instance();
		DWORD vid = 0;
		DWORD dwVnum = (DWORD) lua_tonumber(L, 1);
		long x = (long) lua_tonumber(L, 2);
		long y = (long) lua_tonumber(L, 3);
		float radius = lua_isnumber(L, 4) ? (float) lua_tonumber(L, 4) : 0;
		DWORD count = (lua_isnumber(L, 5)) ? (DWORD) lua_tonumber(L, 5) : 1;
		if (count == 0)
			count = 1;
		while (count --)
		{
			if (radius<1)
			{
				LPCHARACTER ch = mob->CaerMob(dwVnum, x, y);
				if (ch && !vid)
					vid = ch->GetVID();
			}
			else
			{
				float angle = number(0, 999) * M_PI * 2 / 1000;
				float r = number(0, 999) * radius / 1000;

				long nx = x + (long)(r * cos(angle));
				long ny = y + (long)(r * sin(angle));

				LPCHARACTER ch = mob->CaerMob(dwVnum, nx, ny);
				if (ch && !vid)
					vid = ch->GetVID();
			}
		}

		lua_pushnumber(L, vid);
		return 1;
	}
#endif
#ifdef ENABLE_INVOCAR_MOB
			{ "invocar_mob",		pc_invocar_mob			},
#endif
		
service.h
#define ENABLE_INVOCAR_MOB

 

holis, por lo que veo es por quest y source.  ??

otra pregunta también veo que es por 30 días, como seria para cambiar el tiempo.

muchas gracias  

Enlace para comentar
Compartir en otros sitios

  • Dilong locked this tema
Guest
Este tema está cerrado a otras respuestas.
  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...