Jump to content

quest - npc.is_gm / npc.get_gm_level


Go to solution Solved by Syreldar,

Recommended Posts

hello every one

I tried to do  quest function as shown below

 

	int npc_is_gm(lua_State* L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushboolean(L, npc->GetGMLevel() >= GM_HIGH_WIZARD);
		return 1;
	}

	int npc_get_gm_level(lua_State* L)
	{
		LPCHARACTER npc = CQuestManager::instance().GetCurrentNPCCharacterPtr();
		lua_pushnumber(L, npc->GetGMLevel());
		return 1;
	}

But it didn't work in quest , does any one know where is the problem?

The purpose of the function is to create a quest that will send the player to the city if he is killed by GM

		when death with npc.is_gm() begin 
			if game.get_event_flag("send_home") == 1 and pc.get_map_index() == 182 then
				warp_to_village()
			end
		end

 

@ Syreldar Maybe you can help at this

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Premium
  • Solution

..?

when kill with npc.is_pc() and pc.is_gm() and pc.get_map_index() == 182 begin
	local my_vid = pc.get_vid();
	pc.select(npc.get_vid());
	--
	notice("You've been killed by a GM. You'll be warped to your village.")
	warp_to_village();
	--
	pc.select(my_vid);
end -- when

 

Edited by Syreldar

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

8 hours ago, Syreldar said:

..?

when kill with npc.is_pc() and pc.is_gm() and pc.get_map_index() == 182 begin
	local my_vid = pc.get_vid();
	pc.select(npc.get_vid());
	--
	notice("You've been killed by a GM. You'll be warped to your village.")
	warp_to_village();
	--
	pc.select(my_vid);
end -- when

 

Works well, thank you

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.