Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Valeu por contribuir fiz uma leve edição para o tópico ficar menor e melhor leitura

Compre seus Scripts Agora totalmente seguro e de forma rápida, aceitamos também encomendas.

discord.gg/phJZeHa2k4

 

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 31/05/2021 em 15:33, The Foxx disse:

teria um sistema desse pra poketibia?


Não é possível adicionar esse sistema para versões abaixo do TFS 1.2+
Poketibia, creio que que seja, 8.54 (0.4 or 0.3.6)

Então não :( 

Link para o post
Compartilhar em outros sites
  • 4 months later...
Em 16/05/2021 em 19:48, tataboy67 disse:

Dungeon System v1.1

A pedido de um usuário em meu Discord, resolvi ajuda-lo e desenvolver um sistema totalmente interativo e de qualidade aqui para vocês.
Bom, o sistema se baseia em uma ActionID que ao clicar, podemos ai entrar em uma dungeon, tendo tempo para finaliza-la e até um cooldown, caso queira entrar novamente.

Imagens do sistema:
 

  Ocultar conteúdo

Imagem 1 (Ao clicar no ActionID):
image.png.7f2a74c735112e23e20b933ff8e6efda.png


Imagem 2 (Detalhes da Dungeon):
image.png.0c9419abd5e4ce4d52f952983cabf16e.png


Imagem 3 (Ao tentar entrar sem Party):
image.png.cd206ec491c0634c1457c72a83800bd0.png

(Obs: existe diversas verificações a mais, tais como: "Todos os players, estão em PZ?", "Os players tem que estar a 'x' SQM de distancia do leader da PT para iniciar", ETC...)


Vamos ao Código:

Em actions, crie um arquivo com o nome de: Dungeon Actions.lua

  Mostrar conteúdo oculto

 



function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
	
	player:registerEvent("DungeonSystem_Modal")
	
	local window = ModalWindow(DUNGEON_SYSTEM.Modal.ID, DUNGEON_SYSTEM.Modal.Title, DUNGEON_SYSTEM.Modal.Msg)
	
	window:addButton(200, "Confirm")
	window:addButton(201, "Details")
	window:addButton(202, "Exit")
	
	for k,v in pairs(DUNGEON_SYSTEM.Dungeons) do
		window:addChoice(k, "[OPEN] " .. v.Name)
	end
	
	window:setDefaultEnterButton(200)
    window:setDefaultEscapeButton(202)
	
	window:sendToPlayer(player)
	
	return true
end

 

 

 

Em creaturescripts, crie um arquivo com o nome de: Dungeon Creaturescript.lua

  Mostrar conteúdo oculto

 



function onModalWindow(player, modalWindowId, buttonId, choiceId)  
    
	player:unregisterEvent("DungeonSystem_Modal")

	local dg = DUNGEON_SYSTEM.Dungeons
	local msg = DUNGEON_SYSTEM.Messages
	local modal = DUNGEON_SYSTEM.Modal
	local sto = DUNGEON_SYSTEM.Storages	

    if (modalWindowId == DUNGEON_SYSTEM.Modal.ID) then
		
		if buttonId == 200 then
			
			local players = {}
			for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
				for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
					for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
						local tile = Tile(x, y, z)
						local creature = tile:getTopCreature()
						if creature and creature:isPlayer() then
							players[#players+1] = creature
						end
					end
				end
			end
			
			if #players > 0 then
				player:getPosition():sendMagicEffect(CONST_ME_POFF)
				return player:sendTextMessage(MESSAGE_STATUS_SMALL, msg.PlayerInside)
			end
			
			if (dg[choiceId].NeedLevel) then
				if (player:getLevel() < dg[choiceId].Level) then
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedLevel, dg[choiceId].Level))
					return false
				end
			end
			
			local pt = player:getParty()
			local partyMembers
			
			local party = {}
			party = partyMembers
			
			local fromPosPlayer = player:getPosition()
			
			if (dg[choiceId].NeedParty) then
				
				if not pt then
					
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgUniqueNeedParty)
					return false
				
				else
					
					partyMembers = pt:getMembers()
					local party = player:getParty():getMemberCount()
					
					if not (pt:getLeader():getName() == player:getName()) then
						
						player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgLeaderParty)
						return false
					
					else
					
						local partyMaisUm = party+1
						
						if not (partyMaisUm == dg[choiceId].AmountParty) then
							player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedParty, dg[choiceId].AmountParty))
							return false
						end
						
						local names = {}
						local posOfPlayer = {}
						
						for i = 1, party do
						
							local ppt = partyMembers[i]
							local fromPosPpt = ppt:getPosition()
						
							if DUNGEON_SYSTEM.PzToEntry then
								if not getTileInfo(fromPosPpt).protection then
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzMsg)
								elseif not getTileInfo(fromPosPlayer).protection then
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
								end
							end
						
							-- SE TEM COOLDOWN
							if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 or ppt:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
								if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
									player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.diff(player:getStorageValue(sto.TimerCooldown)-os.time())))
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
								else
									player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.WaitFriendsCooldown, string.diff(ppt:getStorageValue(sto.TimerCooldown)-os.time())))
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
								end
								return false
							end
							
							names[i] = ppt:getName()
							
						end
						
						local positionPlayer = player:getPosition()
						local distance = DUNGEON_SYSTEM.SQMsDistanceOfLeader
						
						for x = positionPlayer.x - distance, positionPlayer.x + distance do
							for y = positionPlayer.y - distance, positionPlayer.y + distance do
								for z = positionPlayer.z, positionPlayer.z do
									local tileP = Tile(x, y, z)
									local creatureP = tileP:getTopCreature()
									if creatureP and creatureP:isPlayer() then
										for xx = 1, #names do
											if creatureP:getName() == names[xx] then
												posOfPlayer[#posOfPlayer+1] = creatureP
											end
										end
									end
								end
							end
						end
						
						if #posOfPlayer+1 ~= dg[choiceId].AmountParty then
							return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgDistanceLeader)
						end
						
						if dg[choiceId].SpawnMonsters then
							for m, l in pairs(dg[choiceId].Monsters) do
								Game.createMonster(m, l)
							end
						end
						
						player:teleportTo(dg[choiceId].DungeonPos)
						player:getPosition():sendMagicEffect(40)
						player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
						
						addEvent(function()
							player:teleportTo(fromPosPlayer)
							player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
							player:getPosition():sendMagicEffect(40)
							player:popupFYI(msg.ToFail)
							
							-- Remove All monsters
							local monsterPos = {}
							for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
								for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
									for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
										local tile = Tile(x, y, z)
										local monster = tile:getTopCreature()
										if monster and monster:isMonster() then
											monster:remove()
										end
									end
								end
							end
							
						end, dg[choiceId].DungeonTime*1000)	
						
						for mx = 1, party do
						
							local ppt = partyMembers[mx]
							local fromPosPpt = ppt:getPosition()
						
							ppt:teleportTo(dg[choiceId].DungeonPos)
							ppt:getPosition():sendMagicEffect(40)
							
							addEvent(function()
								ppt:teleportTo(fromPosPpt)
								ppt:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
								ppt:getPosition():sendMagicEffect(40)
								ppt:popupFYI(msg.ToFail)
							end, dg[choiceId].DungeonTime*1000)	
						
						end
						
					end
					
				end
				
			else
				
				if DUNGEON_SYSTEM.PzToEntry then
					if not getTileInfo(fromPosPlayer).protection then
						player:getPosition():sendMagicEffect(CONST_ME_POFF)
						return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
					end
				end
				
				if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
					player:getPosition():sendMagicEffect(CONST_ME_POFF)
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.diff(player:getStorageValue(sto.TimerCooldown)-os.time())))
					return false
				end
				
				if dg[choiceId].SpawnMonsters then
					for m, l in pairs(dg[choiceId].Monsters) do
						Game.createMonster(m, l)
					end
				end
					
				-- To Dungeon
				player:teleportTo(dg[choiceId].DungeonPos)
				player:getPosition():sendMagicEffect(40)
				player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
				player:setStorageValue(sto.TimerDungeon, os.time() + dg[choiceId].DungeonTime)
				
				-- Back Dungeon
				addEvent(function()
					player:teleportTo(fromPosPlayer)
					player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
					player:getPosition():sendMagicEffect(40)
					player:popupFYI(msg.ToFail)
					
					-- Remove All monsters
					local monsterPos = {}
					for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
						for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
							for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
								local tile = Tile(x, y, z)
								local monster = tile:getTopCreature()
								if monster and monster:isMonster() then
									monster:remove()
								end
							end
						end
					end
					
				end, dg[choiceId].DungeonTime*1000)
				
			end
			
			
		elseif buttonId == 201 then
			
			player:registerEvent("DungeonSystemDetails_Modal")
			
			local needPartyMsg, needLevelMsg = "", ""
			
			if (dg[choiceId].NeedParty) then
				needPartyMsg = string.format("Party: %s players", dg[choiceId].AmountParty)
			else
				needPartyMsg = "Party: 1 players"
			end
			
			if (dg[choiceId].NeedLevel) then
				needLevelMsg = string.format("Level: %s+", dg[choiceId].Level)
			else
				needLevelMsg = "Don't need Level"
			end
			
			local detailsModal = ModalWindow(modal.IDDetails, modal.TitleDetails, string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.diff(dg[choiceId].DungeonTime)))
			
			detailsModal:addButton(100, "Back")
			
			detailsModal:setDefaultEnterButton(100)
			detailsModal:setDefaultEscapeButton(100)
			
			detailsModal:sendToPlayer(player)
			
			-- player:popupFYI(string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.diff(dg[choiceId].DungeonTime)))

		end
    
	end
	
end

 

 

 

Ainda em creaturescripts, crie outro arquivo com o nome de: Type Dungeon Creaturescript.lua

  Mostrar conteúdo oculto

 



function modalDungeon(player)

	player:registerEvent("DungeonSystem_Modal")
	
	local window = ModalWindow(DUNGEON_SYSTEM.Modal.ID, DUNGEON_SYSTEM.Modal.Title, DUNGEON_SYSTEM.Modal.Msg)
	
	window:addButton(200, "Confirm")
	window:addButton(201, "Details")
	window:addButton(202, "Exit")
	
	for k,v in pairs(DUNGEON_SYSTEM.Dungeons) do
		window:addChoice(k, "[OPEN] " .. v.Name)
	end
	
	window:setDefaultEnterButton(200)
    window:setDefaultEscapeButton(202)
	
	window:sendToPlayer(player)
	
end

function onModalWindow(player, modalWindowId, buttonId, choiceId)  
    
	player:unregisterEvent("DungeonSystemType_Modal")

	local dg = DUNGEON_SYSTEM.Dungeons
	local msg = DUNGEON_SYSTEM.Messages
	local modal = DUNGEON_SYSTEM.Modal
	local sto = DUNGEON_SYSTEM.Storages	
	
	if buttonId == 100 then
		
		modalDungeon(player)
		
	end
	
end

 

 

 

 

 Na LIB, crie um arquivo com o nome de Dungeon System Lib.lua, e adicione:

  Mostrar conteúdo oculto

 



DUNGEON_SYSTEM = {

	Storages = {
		timerDungeon = 49356,
		timerCooldown = 50203,
		storageReward = 50205,
	},
	
	Modal = {
		IDType = 2049,
		TitleType = "Type Dungeon, by: Tataboy67",
		MsgType = "Select this type:",
	
		ID = 2050,
		Title = "Dungeon System, by: Tataboy67!",
		Msg = "Select your Dungeon:",
		
		IDDetails = 2051,
		TitleDetails = "Details Dungeon",
	},
	
	Messages = {
		ToEntry = "Welcome to Dungeon",
		ToFail = "You were unable to complete the dungeon\n\nPlease try again!",
		
		WaitFriendsCooldown = "Wait your friend: %s",
		ToCooldown = "You're in cooldown to enter in a dungeon again. Cooldown: %s.",
		MsgNeedLevel = "You don't have level required. You need level %s.",
		MsgUniqueNeedParty = "You need party, to entry in dungeon",
		MsgNeedParty = "You need to be at a party to enter the dungeon. You need %s players",
		MsgLeaderParty = "You are not the leader of the Party.",
		
		MsgDistanceLeader = "Your friends need to be close to you.",
		
		NeedPzSoloMsg = "You need to be in a safe area [PZ].",
		NeedPzMsg = "Your team needs to go a safe area [PZ].",
	
		PlayerInside = "Already has inside.",
	},
	
	CooldownTime = 1,
	
	PzToEntry = true,
	
	SQMsDistanceOfLeader = 5,

	Dungeons = {

		[1] = {
			-- Name
			Name = "Diabolic Hyper",
			
			-- Party
			NeedParty = true,
			AmountParty = 2,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},
		
		[2] = {
			-- Name
			Name = "Supreme Rat's",
			
			-- Party
			NeedParty = false,
			AmountParty = 1,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},
		
		[3] = {
			-- Name
			Name = "Triple",
			
			-- Party
			NeedParty = true,
			AmountParty = 3,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},

	},
	
}

 

 

 

 

Em creaturescripts.xml, adicione:

  Mostrar conteúdo oculto

 



	<!-- Dungeon System -->
	<event type="modalwindow" name="DungeonSystem_Modal" script="Dungeon Creaturescript.lua"/>
	<event type="modalwindow" name="DungeonSystemType_Modal" script="Type Dungeon Creaturescript.lua"/>
	<event type="modalwindow" name="DungeonSystemDetails_Modal" script="Type Dungeon Creaturescript.lua"/>

 

 

 

 
 

Em actions.xml, adicione:

  Mostrar conteúdo oculto

 



	<!-- Dungeon System -->
	<action actionid="5597" script="Dungeon Actions.lua"/>

 

 

 Em libs.lua, adicione:


dofile('data/lib/Dungeon System Lib.lua')

 

v1.1 (Nova atualização, agora pode spawnar mobs dentro da DG, e ao sair, eles são removidos)

(CREDITOS TOTAIS A MIM: @tataboy67)

Essa é a primeira versão. Ainda pretendo colocar para nascer mobs, remover mobs ao entrar, etc etc...

 

Pega em tfs 1.2?

Link para o post
Compartilhar em outros sites
12 horas atrás, Jnofom disse:

Pega em tfs 1.2?

Acho que sim.
O teste foi feito no 1.3

Link para o post
Compartilhar em outros sites

parabéns pelo script, ta muito bom, porém, estou tendo alguns problemas com o mesmo

tipo, o player/party mata todos os monstros da area da dungeon e nada acontece, tem q esperar o timer acabar pra ser kickado do lugar, é realmente assim que deveria funcionar ? 

e outro problema, qndo alguém morre la dentro, outro player/party pode entrar na dungeon, porém, os monstros anteriores não são removidos, então fica duplicado, além disso, o player morto é teleportado pra saída da dungeon qnd o " tempo expira "

há alguma forma de contornar isso ? configurar pra party toda matar todos os monstros e ser teleportado pra uma area de ' recompensa '

e se alguém morrer la dentro, todos os monstros são removidos 

Link para o post
Compartilhar em outros sites
  • 6 months later...
  • 3 months later...
Em 16/05/2022 em 15:12, raphadoidera disse:

@tataboy67 irmão, você poderia criar um sistema desse para OTX?


Ele funciona também em OTX, só não adaptei para TFS 1.5, nem para revscript.

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 13/09/2022 em 10:51, tataboy67 disse:


Ele funciona também em OTX, só não adaptei para TFS 1.5, nem para revscript.

Mano to com dificuldade nisso, sei que é em lib.lua, mas quando vou em data/lib, aparece os arquivos .lua

Não sei o arquivo exato pra adicionar dofile('data/lib/Dungeon System Lib.lua') pode me ajudar?

 

 

Tá dando esse erro no creaturescripts, não sei se é porque eu preciso adicionar isso na lib.luaimage.thumb.png.52f325246008d4ccedaa53e17e4045dd.png 
lib.lua, não tenho nenhum arquivo com esse nome na pasta
image.thumb.png.52190ade8965646a9504859f14748a60.png

 

 @tataboy67

Editado por raphadoidera (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 21/09/2022 em 15:23, raphadoidera disse:

Mano to com dificuldade nisso, sei que é em lib.lua, mas quando vou em data/lib, aparece os arquivos .lua

Não sei o arquivo exato pra adicionar dofile('data/lib/Dungeon System Lib.lua') pode me ajudar?

 

 

Tá dando esse erro no creaturescripts, não sei se é porque eu preciso adicionar isso na lib.luaimage.thumb.png.52f325246008d4ccedaa53e17e4045dd.png 
lib.lua, não tenho nenhum arquivo com esse nome na pasta
image.thumb.png.52190ade8965646a9504859f14748a60.png

 

 @tataboy67


Irmão, está faltando você adicionar o sistema do Modal no seu servidor.


Adiciona isso e funcionará.

Em 21/09/2022 em 15:23, raphadoidera disse:

Mano to com dificuldade nisso, sei que é em lib.lua, mas quando vou em data/lib, aparece os arquivos .lua

Não sei o arquivo exato pra adicionar dofile('data/lib/Dungeon System Lib.lua') pode me ajudar?

 

 

Tá dando esse erro no creaturescripts, não sei se é porque eu preciso adicionar isso na lib.luaimage.thumb.png.52f325246008d4ccedaa53e17e4045dd.png 
lib.lua, não tenho nenhum arquivo com esse nome na pasta
image.thumb.png.52190ade8965646a9504859f14748a60.png

 

 @tataboy67


Irmão, está faltando você adicionar o sistema do Modal no seu servidor.


Adiciona isso e funcionará.

Link para o post
Compartilhar em outros sites
  • 3 months later...
  • 1 year later...

Mais alguém recebe esse erro(primeira imagem)? To usando o tfs 1.2.
Eu configurei a posi da dungeon em dungeon system lib. No caso eu editei a dungeonPos pra onde eu quero que comece a dungeon, em fromPos toPos eu coloquei a ultima sqm de cima esqueda e o ultimo sqm de baixo direita. Tem mais alguma coisa que precisa configurar além disso?
A também to recebendo outro erro(segunda imagem) quando eu clico em detalhes. Será que tenho que adicionar alguma function a mais na source?

imagem18.png

imagem19.png

 

EDIT:
O primeiro erro eu consegui arrumar. Ele entra na dungeon, mas a dungeon nunca termina. mata os bixos e nada acontece.

Editado por leolovee69 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 3 weeks later...
Em 16/05/2021 em 19:48, tataboy67 disse:

Dungeon System v1.1

A pedido de um usuário em meu Discord, resolvi ajuda-lo e desenvolver um sistema totalmente interativo e de qualidade aqui para vocês.
Bom, o sistema se baseia em uma ActionID que ao clicar, podemos ai entrar em uma dungeon, tendo tempo para finaliza-la e até um cooldown, caso queira entrar novamente.

Imagens do sistema:
 

  Ocultar conteúdo

Imagem 1 (Ao clicar no ActionID):
image.png.7f2a74c735112e23e20b933ff8e6efda.png


Imagem 2 (Detalhes da Dungeon):
image.png.0c9419abd5e4ce4d52f952983cabf16e.png


Imagem 3 (Ao tentar entrar sem Party):
image.png.cd206ec491c0634c1457c72a83800bd0.png

(Obs: existe diversas verificações a mais, tais como: "Todos os players, estão em PZ?", "Os players tem que estar a 'x' SQM de distancia do leader da PT para iniciar", ETC...)


Vamos ao Código:

Em actions, crie um arquivo com o nome de: Dungeon Actions.lua

  Ocultar conteúdo

 



function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
	
	player:registerEvent("DungeonSystem_Modal")
	
	local window = ModalWindow(DUNGEON_SYSTEM.Modal.ID, DUNGEON_SYSTEM.Modal.Title, DUNGEON_SYSTEM.Modal.Msg)
	
	window:addButton(200, "Confirm")
	window:addButton(201, "Details")
	window:addButton(202, "Exit")
	
	for k,v in pairs(DUNGEON_SYSTEM.Dungeons) do
		window:addChoice(k, "[OPEN] " .. v.Name)
	end
	
	window:setDefaultEnterButton(200)
    window:setDefaultEscapeButton(202)
	
	window:sendToPlayer(player)
	
	return true
end

 

 

 

Em creaturescripts, crie um arquivo com o nome de: Dungeon Creaturescript.lua

  Mostrar conteúdo oculto

 



function onModalWindow(player, modalWindowId, buttonId, choiceId)  
    
	player:unregisterEvent("DungeonSystem_Modal")

	local dg = DUNGEON_SYSTEM.Dungeons
	local msg = DUNGEON_SYSTEM.Messages
	local modal = DUNGEON_SYSTEM.Modal
	local sto = DUNGEON_SYSTEM.Storages	

    if (modalWindowId == DUNGEON_SYSTEM.Modal.ID) then
		
		if buttonId == 200 then
			
			local players = {}
			for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
				for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
					for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
						local tile = Tile(x, y, z)
						local creature = tile:getTopCreature()
						if creature and creature:isPlayer() then
							players[#players+1] = creature
						end
					end
				end
			end
			
			if #players > 0 then
				player:getPosition():sendMagicEffect(CONST_ME_POFF)
				return player:sendTextMessage(MESSAGE_STATUS_SMALL, msg.PlayerInside)
			end
			
			if (dg[choiceId].NeedLevel) then
				if (player:getLevel() < dg[choiceId].Level) then
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedLevel, dg[choiceId].Level))
					return false
				end
			end
			
			local pt = player:getParty()
			local partyMembers
			
			local party = {}
			party = partyMembers
			
			local fromPosPlayer = player:getPosition()
			
			if (dg[choiceId].NeedParty) then
				
				if not pt then
					
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgUniqueNeedParty)
					return false
				
				else
					
					partyMembers = pt:getMembers()
					local party = player:getParty():getMemberCount()
					
					if not (pt:getLeader():getName() == player:getName()) then
						
						player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgLeaderParty)
						return false
					
					else
					
						local partyMaisUm = party+1
						
						if not (partyMaisUm == dg[choiceId].AmountParty) then
							player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedParty, dg[choiceId].AmountParty))
							return false
						end
						
						local names = {}
						local posOfPlayer = {}
						
						for i = 1, party do
						
							local ppt = partyMembers[i]
							local fromPosPpt = ppt:getPosition()
						
							if DUNGEON_SYSTEM.PzToEntry then
								if not getTileInfo(fromPosPpt).protection then
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzMsg)
								elseif not getTileInfo(fromPosPlayer).protection then
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
								end
							end
						
							-- SE TEM COOLDOWN
							if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 or ppt:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
								if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
									player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.diff(player:getStorageValue(sto.TimerCooldown)-os.time())))
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
								else
									player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.WaitFriendsCooldown, string.diff(ppt:getStorageValue(sto.TimerCooldown)-os.time())))
									player:getPosition():sendMagicEffect(CONST_ME_POFF)
									ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
								end
								return false
							end
							
							names[i] = ppt:getName()
							
						end
						
						local positionPlayer = player:getPosition()
						local distance = DUNGEON_SYSTEM.SQMsDistanceOfLeader
						
						for x = positionPlayer.x - distance, positionPlayer.x + distance do
							for y = positionPlayer.y - distance, positionPlayer.y + distance do
								for z = positionPlayer.z, positionPlayer.z do
									local tileP = Tile(x, y, z)
									local creatureP = tileP:getTopCreature()
									if creatureP and creatureP:isPlayer() then
										for xx = 1, #names do
											if creatureP:getName() == names[xx] then
												posOfPlayer[#posOfPlayer+1] = creatureP
											end
										end
									end
								end
							end
						end
						
						if #posOfPlayer+1 ~= dg[choiceId].AmountParty then
							return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgDistanceLeader)
						end
						
						if dg[choiceId].SpawnMonsters then
							for m, l in pairs(dg[choiceId].Monsters) do
								Game.createMonster(m, l)
							end
						end
						
						player:teleportTo(dg[choiceId].DungeonPos)
						player:getPosition():sendMagicEffect(40)
						player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
						
						addEvent(function()
							player:teleportTo(fromPosPlayer)
							player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
							player:getPosition():sendMagicEffect(40)
							player:popupFYI(msg.ToFail)
							
							-- Remove All monsters
							local monsterPos = {}
							for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
								for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
									for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
										local tile = Tile(x, y, z)
										local monster = tile:getTopCreature()
										if monster and monster:isMonster() then
											monster:remove()
										end
									end
								end
							end
							
						end, dg[choiceId].DungeonTime*1000)	
						
						for mx = 1, party do
						
							local ppt = partyMembers[mx]
							local fromPosPpt = ppt:getPosition()
						
							ppt:teleportTo(dg[choiceId].DungeonPos)
							ppt:getPosition():sendMagicEffect(40)
							
							addEvent(function()
								ppt:teleportTo(fromPosPpt)
								ppt:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
								ppt:getPosition():sendMagicEffect(40)
								ppt:popupFYI(msg.ToFail)
							end, dg[choiceId].DungeonTime*1000)	
						
						end
						
					end
					
				end
				
			else
				
				if DUNGEON_SYSTEM.PzToEntry then
					if not getTileInfo(fromPosPlayer).protection then
						player:getPosition():sendMagicEffect(CONST_ME_POFF)
						return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
					end
				end
				
				if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
					player:getPosition():sendMagicEffect(CONST_ME_POFF)
					player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.diff(player:getStorageValue(sto.TimerCooldown)-os.time())))
					return false
				end
				
				if dg[choiceId].SpawnMonsters then
					for m, l in pairs(dg[choiceId].Monsters) do
						Game.createMonster(m, l)
					end
				end
					
				-- To Dungeon
				player:teleportTo(dg[choiceId].DungeonPos)
				player:getPosition():sendMagicEffect(40)
				player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
				player:setStorageValue(sto.TimerDungeon, os.time() + dg[choiceId].DungeonTime)
				
				-- Back Dungeon
				addEvent(function()
					player:teleportTo(fromPosPlayer)
					player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
					player:getPosition():sendMagicEffect(40)
					player:popupFYI(msg.ToFail)
					
					-- Remove All monsters
					local monsterPos = {}
					for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
						for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
							for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
								local tile = Tile(x, y, z)
								local monster = tile:getTopCreature()
								if monster and monster:isMonster() then
									monster:remove()
								end
							end
						end
					end
					
				end, dg[choiceId].DungeonTime*1000)
				
			end
			
			
		elseif buttonId == 201 then
			
			player:registerEvent("DungeonSystemDetails_Modal")
			
			local needPartyMsg, needLevelMsg = "", ""
			
			if (dg[choiceId].NeedParty) then
				needPartyMsg = string.format("Party: %s players", dg[choiceId].AmountParty)
			else
				needPartyMsg = "Party: 1 players"
			end
			
			if (dg[choiceId].NeedLevel) then
				needLevelMsg = string.format("Level: %s+", dg[choiceId].Level)
			else
				needLevelMsg = "Don't need Level"
			end
			
			local detailsModal = ModalWindow(modal.IDDetails, modal.TitleDetails, string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.diff(dg[choiceId].DungeonTime)))
			
			detailsModal:addButton(100, "Back")
			
			detailsModal:setDefaultEnterButton(100)
			detailsModal:setDefaultEscapeButton(100)
			
			detailsModal:sendToPlayer(player)
			
			-- player:popupFYI(string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.diff(dg[choiceId].DungeonTime)))

		end
    
	end
	
end

 

 

 

Ainda em creaturescripts, crie outro arquivo com o nome de: Type Dungeon Creaturescript.lua

  Mostrar conteúdo oculto

 



function modalDungeon(player)

	player:registerEvent("DungeonSystem_Modal")
	
	local window = ModalWindow(DUNGEON_SYSTEM.Modal.ID, DUNGEON_SYSTEM.Modal.Title, DUNGEON_SYSTEM.Modal.Msg)
	
	window:addButton(200, "Confirm")
	window:addButton(201, "Details")
	window:addButton(202, "Exit")
	
	for k,v in pairs(DUNGEON_SYSTEM.Dungeons) do
		window:addChoice(k, "[OPEN] " .. v.Name)
	end
	
	window:setDefaultEnterButton(200)
    window:setDefaultEscapeButton(202)
	
	window:sendToPlayer(player)
	
end

function onModalWindow(player, modalWindowId, buttonId, choiceId)  
    
	player:unregisterEvent("DungeonSystemType_Modal")

	local dg = DUNGEON_SYSTEM.Dungeons
	local msg = DUNGEON_SYSTEM.Messages
	local modal = DUNGEON_SYSTEM.Modal
	local sto = DUNGEON_SYSTEM.Storages	
	
	if buttonId == 100 then
		
		modalDungeon(player)
		
	end
	
end

 

 

 

 

 Na LIB, crie um arquivo com o nome de Dungeon System Lib.lua, e adicione:

  Mostrar conteúdo oculto

 



DUNGEON_SYSTEM = {

	Storages = {
		timerDungeon = 49356,
		timerCooldown = 50203,
		storageReward = 50205,
	},
	
	Modal = {
		IDType = 2049,
		TitleType = "Type Dungeon, by: Tataboy67",
		MsgType = "Select this type:",
	
		ID = 2050,
		Title = "Dungeon System, by: Tataboy67!",
		Msg = "Select your Dungeon:",
		
		IDDetails = 2051,
		TitleDetails = "Details Dungeon",
	},
	
	Messages = {
		ToEntry = "Welcome to Dungeon",
		ToFail = "You were unable to complete the dungeon\n\nPlease try again!",
		
		WaitFriendsCooldown = "Wait your friend: %s",
		ToCooldown = "You're in cooldown to enter in a dungeon again. Cooldown: %s.",
		MsgNeedLevel = "You don't have level required. You need level %s.",
		MsgUniqueNeedParty = "You need party, to entry in dungeon",
		MsgNeedParty = "You need to be at a party to enter the dungeon. You need %s players",
		MsgLeaderParty = "You are not the leader of the Party.",
		
		MsgDistanceLeader = "Your friends need to be close to you.",
		
		NeedPzSoloMsg = "You need to be in a safe area [PZ].",
		NeedPzMsg = "Your team needs to go a safe area [PZ].",
	
		PlayerInside = "Already has inside.",
	},
	
	CooldownTime = 1,
	
	PzToEntry = true,
	
	SQMsDistanceOfLeader = 5,

	Dungeons = {

		[1] = {
			-- Name
			Name = "Diabolic Hyper",
			
			-- Party
			NeedParty = true,
			AmountParty = 2,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},
		
		[2] = {
			-- Name
			Name = "Supreme Rat's",
			
			-- Party
			NeedParty = false,
			AmountParty = 1,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},
		
		[3] = {
			-- Name
			Name = "Triple",
			
			-- Party
			NeedParty = true,
			AmountParty = 3,
			
			-- Level
			NeedLevel = false,
			Level = 50,
						
			-- Dungeon
			DungeonTime = 10, -- 5 min, 30 seconds
			DungeonPos = Position(1165, 934, 7),

			-- Position Dungeon
			FromPos = {x = 1161, y = 930, z = 7}, 	-- Position /\ < from the dungeon
			ToPos = {x = 1226, y = 940, z = 7},		-- Position \/ > from the dungeon
			
			SpawnMonsters = true,
			Monsters = {
				["Demon"] = Position(1170, 934, 7),
				["Rat"] = Position(1170, 935, 7),
				["Hydra"] = Position(1167, 932, 7),
			},
			
		},

	},
	
}

 

 

 

 

Em creaturescripts.xml, adicione:

  Mostrar conteúdo oculto

 



	<!-- Dungeon System -->
	<event type="modalwindow" name="DungeonSystem_Modal" script="Dungeon Creaturescript.lua"/>
	<event type="modalwindow" name="DungeonSystemType_Modal" script="Type Dungeon Creaturescript.lua"/>
	<event type="modalwindow" name="DungeonSystemDetails_Modal" script="Type Dungeon Creaturescript.lua"/>

 

 

 

 
 

Em actions.xml, adicione:

  Mostrar conteúdo oculto

 



	<!-- Dungeon System -->
	<action actionid="5597" script="Dungeon Actions.lua"/>

 

 

 Em libs.lua, adicione:


dofile('data/lib/Dungeon System Lib.lua')

 

v1.1 (Nova atualização, agora pode spawnar mobs dentro da DG, e ao sair, eles são removidos)

(CREDITOS TOTAIS A MIM: @tataboy67)

Essa é a primeira versão. Ainda pretendo colocar para nascer mobs, remover mobs ao entrar, etc etc...

 

Tu faz sistema 1.2 ? preciso de um sistema faz orçamento ? 

Link para o post
Compartilhar em outros sites
  • 4 weeks later...

Boa tarde!

 

No meu está dando esse erro ao clicar em um item que coloquei no mapa com a action ID 5597 (A que está no actions.xml).

 

image.thumb.png.64b812b3c88e5fdd2ca248ed1f9979e5.png

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por L3K0T
      Como diz o título? Você pode gerar as funções do seu TFS em um arquivo de texto. Para fazer isso, basta ir em uma das bibliotecas (LIB) e adicionar o seguinte código no final. 
       
      -- Função para obter todas as funções disponíveis no ambiente Lua
      function getLuaFunctions()
          local function iterateTable(tbl, prefix)
              local str = ""
              for key, value in pairs(tbl) do
                  if type(value) == 'function' then
                      str = str .. prefix .. key .. ','
                  elseif type(value) == 'table' then
                      str = str .. iterateTable(value, prefix .. key .. '.')
                  end
              end
              return str
          end
          local str = iterateTable(_G, "")
          return string.explode(str, ',')
      end
      -- Obtém todas as funções disponíveis
      local functionsList = getLuaFunctions()
      -- Ordena a lista de funções
      table.sort(functionsList)
      -- Cria uma string de data no formato 'YYYY-MM-DD'
      local currentDate = os.date('%Y-%m-%d')
      -- Salva a lista de funções em um arquivo de texto com a data atual
      local fileName = 'funcoes_do_seu_servidor_' .. currentDate .. '.txt'
      local file = io.open(fileName, 'w')
      for i, funcName in ipairs(functionsList) do
          if funcName ~= "" then
              file:write((i - 1) .. ' - ' .. funcName .. '\n')
          end
      end
      file:close()
      -- Criado por L3K0T
       
      Depois, é só iniciar o seu servidor e assim todas as funções do seu servidor vão aparecer no arquivo TXT com a data de criação.
       
      "Isso é útil para resolver problemas de scripts e trabalhar de forma mais eficiente, manipulando as funções."
    • Por Imperius
      Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar.
       
      É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/
       
      Como funciona?
       
      O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte.
       
      O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador.
       
      Para entender melhor o seu funcionamento, segue o GIF abaixo:
       

       
       
      em data > actions > actions.xml
       
       
      em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua
       
       
      no banco de dados do servidor, adicione o seguinte código em "SQL":
       
       
       

      Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros.
       

       
       
      Espero ter ajudado de alguma forma! : )
       
      treasure_chest.php
    • Por PokemonXdemon
      [Quest System]
       
       
      Estava ontem analisando minha base, aonde tinha várias quests em arquivos separados.
      Então, pq não organizar tudo em apenas um arquivo exemplo:
      Então fiz esse script, meio simples mas útil para organizar tudo.
       
       
      Agora vamos entender oq precisamos fazer!
       
       Uma pequena atualização,  agora fica em um lugar separado a configuração para ficar mais  fácil modificar.
      Agora pode adicionar o boost que voce deseja no pokemon.
       
      Bem é isso.
    • Por Anderson Sacani
      Venho publicar uma alteração que eu e minha equipe fizemos no script já existente do Canary.
      O arquivo do script se chama quest_system1.lua.
      Fizemos essa alteração, porque o sistema original não entregava chave com actionid ao jogador. A chave vinha com o código 0000, ou seja, não abria nenhuma porta.
      A alteração que fizemos foi justamente para arrumar esse bug, por tanto, agora quando o quest ter uma chave com actionid dentro do baú, o jogador receberá essa mesma chave com o actionid definido.
       
      local specialQuests = { -- {x = 32752, y = 32343, z = 14} [52167] = Storage.DreamersChallenge.Reward, -- {x = 32806, y = 32230, z = 11} [52003] = Storage.PitsOfInferno.WeaponReward, -- {x = 32311, y = 32211, z = 8} [51400] = Storage.ThievesGuild.Reward, [51324] = Storage.WrathoftheEmperor.mainReward, -- {x = 32232, y = 31066, z = 7} [51715] = Storage.SvargrondArena.RewardGreenhorn, -- {x = 32232, y = 31059, z = 7} [51716] = Storage.SvargrondArena.RewardScrapper, -- {x = 32232, y = 31052, z = 7} [51717] = Storage.SvargrondArena.RewardWarlord } local questsExperience = { [3101] = 1 -- dummy values } local questLog = { [8213] = Storage.HiddenCityOfBeregar.DefaultStart } local tutorialIds = { [50080] = 5, [50082] = 6, [50084] = 10, [50086] = 11 } local hotaQuest = { 50950, 50951, 50952, 50953, 50954, 50955 } local questSystem1 = Action() function questSystem1.onUse(player, item, fromPosition, target, toPosition, isHotkey) local storage = specialQuests[item.actionid] if not storage then storage = item.uid if storage > 65535 then return false end end if storage == 23644 or storage == 24632 or storage == 14338 then player:setStorageValue(Storage.SvargrondArena.PitDoor, -1) end if player:getStorageValue(storage) > 0 and player:getAccountType() < ACCOUNT_TYPE_GOD then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.') return true end local function copyContainer(originalContainer, newContainer) for i = 0, originalContainer:getSize() - 1 do local originalItem = originalContainer:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end newContainer:addItemEx(newItem) end end local items, reward = {} local size = item:isContainer() and item:getSize() or 0 if size == 0 then local actionId = item:getActionId() reward = Game.createItem(item.itemid, item.type) reward:setActionId(actionId) reward:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) else local container = Container(item.uid) for i = 0, container:getSize() - 1 do local originalItem = container:getItem(i) local newItem = Game.createItem(originalItem.itemid, originalItem.type) newItem:setActionId(originalItem:getActionId()) newItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, originalItem:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION)) if originalItem:isContainer() then copyContainer(Container(originalItem.uid), Container(newItem.uid)) end items[#items + 1] = newItem end if size == 1 then reward = items[1] end end local result = '' if reward then local ret = ItemType(reward.itemid) if ret:isRune() then result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)' elseif ret:isStackable() and reward:getCount() > 1 then result = reward:getCount() .. ' ' .. ret:getPluralName() elseif ret:getArticle() ~= '' then result = ret:getArticle() .. ' ' .. ret:getName() else result = ret:getName() end else if size > 20 then reward = Game.createItem(item.itemid, 1) elseif size > 8 then reward = Game.createItem(2854, 1) else reward = Game.createItem(2853, 1) end for i = 1, size do local tmp = items[i] if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then Spdlog.warn("[questSystem1.onUse] - Could not add quest reward to container") end end local ret = ItemType(reward.itemid) result = ret:getArticle() .. ' ' .. ret:getName() end if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then local weight = reward:getWeight() if player:getFreeCapacity() < weight then player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100))) else player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.') end return true end if questsExperience[storage] then player:addExperience(questsExperience[storage], true) end if questLog[storage] then player:setStorageValue(questLog[storage], 1) end if tutorialIds[storage] then player:sendTutorial(tutorialIds[storage]) if item.uid == 50080 then player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3) end end if isInArray(hotaQuest, item.uid) then if player:getStorageValue(Storage.TheAncientTombs.DefaultStart) ~= 1 then player:setStorageValue(Storage.TheAncientTombs.DefaultStart, 1) end end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.') player:setStorageValue(storage, 1) return true end for index, value in pairs(specialQuests) do questSystem1:aid(index) end questSystem1:aid(2000) questSystem1:register()  
    • Por Anderson Sacani
      local config = { scrollId = 14758, premiumDays = 30, } local days = config.premiumDays local premiumScroll = Action() function premiumScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey) player:addPremiumDays(days) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu " .. days .. " dias de conta premium.") item:remove(1) addEvent(function() if player:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "No total voce tem " .. player:getPremiumDays() .. " dias de conta premium.") end end, 2500) return true end premiumScroll:id(config.scrollId) premiumScroll:register() Percebi que alguns servidores estão vindo sem o script do premium scroll, então criei esse script para adicionar 30 dias de premium na conta do jogador que usar o premium scroll.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo