Jump to content
×
×
  • Create New...

Quest Function - Observer for LUA


Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( Internal )

Hi guys again :D

 

Some managers wanna observermode in game but this code special just for gm. This situations not possible. But no longer you are use to this function ;)

 

I hope you are like it..

 

open questlua_pc.cpp and add this

	int pc_warp_to_map_observer_position(lua_State* L)
	{
		if(!lua_isnumber(L,1) || !lua_isnumber(L,2) || !lua_isnumber(L,3))
		{
			sys_err("QUEST: Wrong argument");
			return 0;
		}
		LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
		long mapIndex = (long)lua_tonumber(L,3);
		const TMapRegion * region = SECTREE_MANAGER::instance().GetMapRegion(mapIndex);

		if(!region)
		{
			sys_err("QUEST: Invalid map index %d..",mapIndex);
			return 0;
		}
		
		if(ch->IsObserverMode())
		{
			sys_err("QUEST: %s already in observermode !.",ch->GetName());
			return 0;
		}

		ch->SetObserverMode(true);
		ch->SaveExitLocation();
		ch->WarpSet((int)lua_tonumber(L,1),(int)lua_tonumber(L,2),mapIndex);
	}

and add this

{ "warp_to_map_observer_position", pc_warp_to_map_observer_position },

How use to this function in my quest? 

quest observerModeTest begin
	state start begin
		when 20354.chat."ObserverMode test with lua function... " with (is_test_server()) begin
			say("I will teleport you.. wait")
			wait()
			pc.warp_to_map_observer_position(coordinateX,coordianateY,mapindex)
		end
	end
end

Kind Regards

HaveBeen

  • Love 3

Plain logic saves lives.

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


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.