Jump to content

Quest Function - Observer for LUA


Recommended Posts

M2 Download Center

This is the hidden content, please
( 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

  • Metin2 Dev 2
  • Love 3

Plain logic saves lives.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Announcements



  • Similar Content

  • Similar Content

  • Similar Content

  • Tags

  • Activity

    1. 4

      Feeding game source to LLM

    2. 0

      Quest 6/7 Problem

    3. 5

      Effect weapons

    4. 0

      [C++] Fix Core Downer Using Negative Number in GM Codes

    5. 3

      Crystal Metinstone

    6. 4

      Feeding game source to LLM

    7. 113

      Ulthar SF V2 (TMP4 Base)

    8. 4

      Feeding game source to LLM

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.