Jump to content

Recommended Posts

  • Honorable Member
when kill begin -- Trigger for killing anything.
	if npc.is_pc() then
		return -- Ignore dropping the item below if the target was a player.
	end

	local level_difference = 15 -- Level difference.
	local min_limit = npc.get_level() - level_difference
	local max_limit = npc.get_level() + level_difference

	if pc.get_level() >= min_limit and pc.get_level() <= max_limit then
		game.drop_item_with_ownership(19, 1) -- 1 Sword+9
	end
end

 

Edited by Owsap
Link to comment
Share on other sites

It's kinda long but try it

cd /usr/ports/lang/lua53 && make install clean

Go to your source -> liblua/Makefile. If there is no -llua in CFLAGS add:

LIBDIR += -L/usr/local/lib
CFLAGS += -llua

Do the same for the game/src/Makefile

Rebuild liblua and then rebuild game (or just gmake all)

Try again implementing the quest.

IMPORTANT: Keep source backup!

Link to comment
Share on other sites

quest event_drop begin
	state start begin			
		when 55706.kill or 55707.kill or 55708.kill or 55709.kill or 2598.kill or 2493.kill 
		or 2491.kill or 2492.kill or 2192.kill or 2206.kill or 1091.kill or 1093.kill
		or 1901.kill or 2092.kill or 2094.kill or 1304.kill or 1192.kill or 691.kill with game.get_event_flag("nameevent") == 1 and not npc.is_pc() begin
			local plvl = pc.get_level()
			local mlvl
			local chance = number(1,10)
			local vnumlist_man = {701,703,704} -- vnumlist man
			local vnumlist_woman = {701,703,704} -- vnumlist woman
			local drop = number(1,16)
			if npc.get_race() < 8015 then
				mlvl = (npc.get_race()-8000)*5
			else
				mlvl = (npc.get_race()-8009)*5
			end

			if mlvl-plvl >= -10 then
				if chance*10 == 100 then
					if pc.get_sex() == 1 then
						game.drop_item_with_ownership(vnumlist_woman[drop],1) --drop
					else
						game.drop_item_with_ownership(vnumlist_man[drop],1)  --drop
					end
				end
			end
		end
	end	

 

Link to comment
Share on other sites

La 21.12.2018 la 20:50, Iηfιηιт²⁴ᵏ a spus:

how do I put a limit of lv drop in this quest

 

If i have lv 120 and i kill 55706 i'm getting the item,and i want drop item only +- 10 level difference

 

here is the quest

https://paste2.org/gbJj86D4

Try this(it's your quest, with minor changes ) :)

Spoiler

quest puntos_boss_kill2 begin
	state start begin
		when login begin
			cmdchat("DnD1 "..q.getcurrentquestindex())
		end
		when 55706.kill or 55707.kill or 55708.kill or 55709.kill or 2598.kill or 2493.kill 
			or 2491.kill or 2492.kill or 2192.kill or 2206.kill or 1091.kill or 1093.kill
			or 1901.kill or 2092.kill or 2094.kill or 1304.kill or 1192.kill or 691.kill begin

		local boss_kill = {
			[55706] = {x,40494,1,"Scroafa Eveniment"},
			[55707] = {x,40494,1,"Chuong Eveniment"},
			[55708] = {x,40494,1,"Orc Sef Eveniment"},
			[55709] = {x,40494,1,"Generalul Yonghan Event"},
			[2598] = {x,40494,1,"Azrael"},
			[2493] = {x,40494,1,"Dragon Albastru"},
			[2491] = {x,40494,1,"Capitanul Yonghan"},
			[2492] = {x,40494,1,"Generalul Yonghan"},
			[2192] = {x,40494,1,"Testoasa Desert"},	
			[2206] = {x,40494,1,"Regele Focului"},
			[1091] = {x,40494,1,"Rege Demon"},
			[1093] = {x,40494,1,"Ingerul cu Coasa"},
			[1901] = {x,40494,1,"Vulpea 9 Cozi"},
			[2092] = {x,40494,1,"Regina Paianjen"},
			[2094] = {x,40494,1,"Rege Paianjen"},
			[1304] = {x,40494,1,"Fantoma Tigrului G."},
			[1192] = {x,40494,1,"Regina de Gheata"},
			[691] = {x,40494,1,"Orc Sef"}
		}
		--[[ where you have to change "x" with your boss level(get that from mob_proto)]]--
		
		local mlvl = boss_kill[npc.get_race()][1]
		local plvl = pc.get_level()
			if plvl - mlvl <= 10 or mlvl - plvl <= 10 then
				pc.give_item2(boss_kill[npc.get_race()][2],boss_kill[npc.get_race()][3])
				chat("Ai ucis "..boss_kill[npc.get_race()][4]..", si ai obtinut "..boss_kill[npc.get_race()][3].." punct suprem!")
			else
				return
			end
		end
		when button or info begin
			items = {
				{["vnum"] = 27992, ["point"] = 40949, ["buy"] = 1, ["req"] = 1},
				{["vnum"] = 27993, ["point"] = 40949, ["buy"] = 1, ["req"] = 1},
				{["vnum"] = 27994, ["point"] = 40949, ["buy"] = 1, ["req"] = 2},
				{["vnum"] = 25041, ["point"] = 40949, ["buy"] = 1, ["req"] = 20},
				{["vnum"] = 25040, ["point"] = 40949, ["buy"] = 1, ["req"] = 5},
				{["vnum"] = 40495, ["point"] = 40949, ["buy"] = 1, ["req"] = 1},
				{["vnum"] = 40496, ["point"] = 40949, ["buy"] = 1, ["req"] = 3},
				{["vnum"] = 50512, ["point"] = 40949, ["buy"] = 1, ["req"] = 100},
				{["vnum"] = 70031, ["point"] = 40949, ["buy"] = 1, ["req"] = 45},
				{["vnum"] = 70024, ["point"] = 40949, ["buy"] = 1, ["req"] = 1},
				{["vnum"] = 40480, ["point"] = 40949, ["buy"] = 1, ["req"] = 3},
			}
			items_list = {}
			info_pct = boss_kill[npc.get_race()][2]
			
			for i in items do
				table.insert(items_list, item_name(items[i]["vnum"]))
			end
			table.insert(items_list, "Renunta")
			say("Premii cu puncte!")
			say("")
			say("Salut "..pc.get_name().." aici poti sa cheltui punctele tale")
			say("pe care le poti castiga distrugand")
			say("cei mai puternici bosi ai jocului!")
			say("")
			say("Fiecare iti va da 1 punct")
			say("In acest moment ai "..pc.count_item(info_pct).." puncte")
			say("")
			say("Ce vrei sa faci?")
			say("")
			if select("Cumpara", "Renunta") == 2 then
			return
			else
			say_size(350,350)
			say("Alege ce obiect doresti:")
			list = select_table(items_list)
				if list == table.getn(items_list) then
					return
				else
				item = items[list]["vnum"]
				point = items[list]["point"]
				req = items[list]["req"]
				buy = items[list]["buy"]
				have = pc.count_item(point)
				diff_num = req - have
				say_size(300,350)
				say_title("Premii cu puncte")
				say("")
				say(string.format("Sigur doresti sa cumperi x%s %s?", buy, item_name(item)))
				say_show_item(item)
				say("")
				say(string.format("Sunt necesare: x%s %s", req, item_name(point)))
				say_show_item(point)
				say("")
					if (select("Da", "Nu") == 1) then
						if pc.count_item(point) < req then
							say("Premii cu puncte")
							say("")
							say("Pentru a face negotul ai nevoie de:")
							say(string.format("x%s %s", req, item_name(point)))
							say_show_item(point)
							say(string.format("Insa tu ai %s ", have))
							say(string.format("Revino cand aduni inca %s %s", diff_num, item_name(point)))
							return
						else
							say_title("Premii cu puncte")
							say("")
							say("Negot finalizat cu succes! Ai primit:")
							say("")
							say(string.format("%sx %s", buy, item_name(item)))
							say_show_item(item)
							pc.give_item2(item, buy)
							pc.remove_item(point, req)
						end
					end
				end	
			end
		end
	end
end

 

Pay atention to that little comment into the quest.

 

Best regards.

  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...
Acum 11 ore, Iηfιηιт²⁴ᵏ a spus:

You're the boss of the money!

 

Ty.

 

but if I want to put the chance to the items?

Then, you can add a local like ...idk "local chance = number(1, 100)"-> if chance <= yournumber then pc.give_item2(youritem).

This is only an example, you have to properly add to your quest.

 

Best regards.

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.