Jump to content

[DUNGEON BELÉPÉS] Map,Tárgy, Szint, CD Party ellenörzéssel [LUA] [UPDATED]


Recommended Posts

Remélem valakinek hasznos lehet

https://imgur.com/a/eLk2EK0

Ha TMP4 forrásod van ezt írd át:

  • create_run(idx, x, y, need_item, item_count, need_lvl, key, flag)
  • pc.getf(key, flag)
     

Erre:

  • create_run(idx, x, y, need_item, item_count, need_lvl, flag)
  • pc.getqf(flag)

 

Spoiler

--Használat martysama:
create_run(351,7780,6541,30319, 1, 120, "d", "t") --mapindex, x, y, item, itemdb, szint, qkey, qflag

--TMP4
create_run(351,7780,6541,30319, 1, 120, "d.t") --mapindex, x, y, item, itemdb, szint, qflag

when 20019.chat."Teszt" begin
    say("Bemész")
    if select("Igen","Nem") == 1 then
        create_run(351,7780,6541,30319, 1, 120, "d", "t")
    end
end

 



Másold be a questlib.lua fájlba:

Spoiler

function create_run(idx, x, y, need_item, item_count, need_lvl, key, flag)
	if party.is_party() then
		local all_ok = true
		local pid = {party.get_member_pids()}
		local check = {}
		for _, pid in ipairs(pid) do
			q.begin_other_pc_block(pid)
			local name, count, lvl, getcd = pc.get_name(), pc.count_item(need_item), pc.get_level(), pc.getf(key, flag)
			q.end_other_pc_block()
			table.insert(check, {name, lvl, count, getcd})
		end
		
		local reqitem, reqlvl, reqcd = {}, {}, {}
		for i = 1, table.getn(check) do
			local name, lvl, count, getcd = check[i][1], check[i][2], check[i][3], check[i][4]
			if count < 1 then
				table.insert(reqitem, name)
			end
			if lvl < need_lvl then
				table.insert(reqlvl, name)
			end
			if getcd >= get_time() then
				table.insert(reqcd, name)
			end
		end
		
		if table.getn(reqitem) > 0 or table.getn(reqlvl) > 0 or table.getn(reqcd) > 0 then
			all_ok = false
		end
		
		if table.getn(reqitem) > 0 then
			setcolor(0,216,255)
			say("The following players lack an entry item:")
			setcolor(255,255,0)
			say(table.concat(reqitem, ", ").."[ENTER]")
		end
		if table.getn(reqlvl) > 0 then
			setcolor(0,216,255)
			say("The following players don't meet the level requirement:")
			setcolor(255,255,0)
			say(table.concat(reqlvl, ", ").."[ENTER]")
		end
		if table.getn(reqcd) > 0 then
			setcolor(0,216,255)
			say("The following players are still on cooldown:")
			setcolor(255,255,0)
			say(table.concat(reqcd, ", ").."[ENTER]")
		end
		
		if all_ok then
			for _, pid in ipairs(pid) do
				q.begin_other_pc_block(pid)
				if not pc.is_gm() then
					pc.remove_item(need_item, item_count)
				end
				q.end_other_pc_block()
			end

			d.new_jump_party(idx, x, y)
		else
			return
		end
	elseif not party.is_party() then
		local all_ok = true
		local item, lvl, getcd = pc.count_item(need_item), pc.get_level(), pc.getf(key, flag)
		
		if (item < item_count) or (lvl < need_lvl) or (getcd > get_time()) then
			all_ok = false
		end
    
		if item < item_count then
			setcolor(0,216,255)
			say("You do not have an entry pass.[ENTER]")
		end
		if lvl < need_lvl then
			setcolor(0,216,255)
			say("Your level is not high enough.[ENTER]")
		end
		if getcd > get_time() then
			setcolor(0,216,255)
			say("You're still on cooldown.")
		end
		
		if all_ok then
			d.new_jump(idx, x*100, y*100)
			if not pc.is_gm() then
				pc.remove_item(need_item, item_count)
			end
		end
	end
end

 

 

  • Like 1
Link to post
Share on other sites
  • FuveZeq changed the title to [DUNGEON BELÉPÉS] Map,Tárgy, Szint, CD Party ellenörzéssel [LUA] [UPDATED]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...