Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Lindo o Sistema,
 mas se eu quiser que o player aprenda as recipes atraves de quests e ou compre de npc/usando itens
   se eu quiser add novas skills no server tbm posso editar isso na receita?
     e se quiser colocar a receita para aparecer em um livro igual spellbook?
   alguem pode so me indicar o caminho.
  eu estou olhando essas possibilidades, estudando meu O, tsou novo com otservers mas ja programo outras coisas.
abraços

Link para o post
Compartilhar em outros sites

Gostaria de saber se assim:

Quero fazer um Great Shield que precise de 10 dwarven shield ( exemplo ). Preciso fazer assim :

[iDitem] = {

items = {

{2379, 1}

{2379, 1}

{2379, 1}

colocando 10 veses com o count = 1, ou posso botar 10 ali ? sendo que o item nao é agrupavel

 

aconselho o pessoal nao fazer assim, criar o itens proprio agrupável, pq eu fiz o teste e nem sempre descontava todos os itens

Toda terça-feira um tópico novo:

Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/

Peça sua spell (Suporte):                https://tibiaking.com/forums/topic/84162-peça-sua-spell/                        

Chuva de flechas (Spell):                https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/

Doom (Spell):                                https://tibiaking.com/forums/topic/51622-doom-spell/

Utilização do VS Code (Infra)       https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/

SD com Combo (Spell):                 https://tibiaking.com/forums/topic/94520-sd-modificada/

Alteração attack speed (C++):        https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/  

Bônus de Speed (NPC)                  https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
 

Link para o post
Compartilhar em outros sites
  • 5 months later...

Ola!

 

 

Quero fazer uma recipe, que para criar uma MAGIC LONGSWORD, precise de 2x magic sword e 100 gold ingots... 

 

 

estou fazendo assim

magiclongsword = RecipeHandler:new()
magiclongsword:setItem(2390)
magiclongsword:setRecipeItem(9971, 100)
magiclongsword:setRecipeItem(2400, 1)
magiclongsword:setRecipeItem(2400, 1)

MAS NAO FUNCIONA

 

 

COMO FAÇO ???

Link para o post
Compartilhar em outros sites
  • 2 years later...
  • 1 year later...
Em 08/03/2012 em 18:47, Garou disse:

 

 

ADVANCED FORGE SYSTEM

 

 

 

O SISTEMA DE CRIAÇÃO DE ITENS PARA SEU SERVIDOR

 

 

 

 

Creio que muitos já conhecem o sistema de forja criado por mim, acontece que o código já estava um pouco obsoleto, então resolvi reescrever ele do 0.

 

Simplesmente consiste em um sistema de criação de itens avançado que ressuscita um pouco do RPG perdido nos servidores de hoje em dia. O jogador poderá criar itens através de forja, agindo como um verdadeiro ferreiro medieval. Adiciona itens em cima de uma bigorna previamente colocada no mapa e com um martelo cria um item totalmente novo.

 

CARACTERÍSTICAS DA VERSÃO FINAL:

 

- Configuração intuitiva e fácil de compreender;

- Mini-tutorial auxiliando criação de novas receitas;

- Receitas podem conter até 250 itens diferentes com suas respectivas quantidades;

- Sistema inteligente que identifica uma receita em qualquer ordem;

- Código totalmente orientado a objetos;

- Possibilidade de configurar diferentes requerimentos, diferentes skills, magic level e level

 

 

 

Há dois modos de instalar o Advanced Forge System, o primeiro é seguir os passos deste tópico e o segundo e baixar pasta data/ anexada no tópico com os arquivos em seus respectivos diretórios, precisando apenas o registro das chaves nos arquivos XML.

 

Escolha o modo que mais convém a você.

 

 

 

 

Crie um arquivo em data/lib chamado forgesystem.lua e cole o conteúdo abaixo:

 

 

 

--[[


	ADVANCED FORGE SYSTEM

				FINAL


	Criado por Oneshot


	É proibido a venda ou a cópia sem os devidos créditos desse script.


]]--


RecipeHandler = {

	itemtype = 0,

	items = {},

	level = 1,

	maglevel = 0,

	skills = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0}

}


Forge = {

	type = nil,

	position = nil,

	magicEffect = CONST_ME_MAGIC_GREEN,

	messages = {

		class = MESSAGE_STATUS_DEFAULT,

		success = "You have successfully forged a %s.",

		needskill = "You don't have enough %s to create a %s.",

		needlevel = "You need level %s to create a %s.",

		needmaglevel = "You need magic level %s to create a %s."

	}

}


function RecipeHandler:new(itemtype, items, level, maglevel, skills)

	local obj = {

		itemtype = (itemtype or 0),

		items = (items or {}),

		level = (level or 1),

		maglevel = (maglevel or 0),

		skills = (skills or {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0})

	}

	table.insert(Recipes, obj)

	return setmetatable(obj, {__index = self})

end


function RecipeHandler:setItem(itemtype)

	self.itemtype = (itemtype or 0)

end


function RecipeHandler:setRecipe(...)

	self.items = {...}

end


function RecipeHandler:setRecipeItem(itemid, amount)

	table.insert(self.items, {itemid, amount})

end


function RecipeHandler:setSkill(skillid, value)

	self.skills[skillid] = value

end


function RecipeHandler:setLevel(value)

	self.level = value

end


function RecipeHandler:setMagLevel(value)

	self.maglevel = value

end


function RecipeHandler:check(position)

	local match = false


	for n, item in ipairs(self.items) do

		local thing = getTileItemById(position, item[1])

		if thing.uid > 0 and math.max(1, thing.type) >= item[2] then

			if n == #self.items then

				match = true

			end

		else

			break

		end

	end


	return match

end


function RecipeHandler:get(position)

	if self:check(position) == true then

		return setmetatable({type = self, position = position}, {__index = Forge})

	end

	return false

end


function Forge:create(cid)

	if self.type.itemid == 0 then

		print("[FORGE SYSTEM - ERROR] ATTEMPT TO CREATE A RECIPE ITEMID 0")

		return

	end


	local status = true

	if(cid) then

		if getPlayerLevel(cid) < self.type.level then

			doPlayerSendTextMessage(cid, self.messages.class, self.messages.needlevel:format(self.type.level, getItemNameById(self.type.itemtype)))

			return

		end


		if getPlayerMagLevel(cid) < self.type.maglevel then

			doPlayerSendTextMessage(cid, self.messages.class, self.messages.needmaglevel:format(self.type.maglevel, getItemNameById(self.type.itemtype)))

			return

		end


		for skillid, value in pairs(self.type.skills) do

			if getPlayerSkillLevel(cid, skillid) < value then

				status = false

				doPlayerSendTextMessage(cid, self.messages.class, self.messages.needskill:format(SKILL_NAMES[skillid], getItemNameById(self.type.itemtype)))

				break

			end

		end

	end


	if status == true then

		for _, item in ipairs(self.type.items) do

			local thing = getTileItemById(self.position, item[1])

			doRemoveItem(thing.uid, item[2])

		end

		doSendMagicEffect(self.position, self.magicEffect)

		doPlayerSendTextMessage(cid, self.messages.class, self.messages.success:format(getItemNameById(self.type.itemtype)))

		doCreateItem(self.type.itemtype, self.position)

	end

end


dofile(getDataDir() .."/lib/recipes.lua")

Crie um arquivo em data/lib chamado recipes.lua e adicione o conteúdo abaixo:

 

----------------------------------------

-----** TUTORIAL DE CONFIGURAÇÃO **-----

----------------------------------------


--[[


	O 'ADVANCED FORGE SYSTEM' é muito fácil e intuitivo de configurar, você só precisa chamar

	a função RecipeHandler:new(...), sendo que você já configurar os atributos da receita nela

	ou usar outras funções para isso.


	Por exemplo, quero criar uma Magic Sword que precise de 100 Gold Nuggets.


	RecipeHandler:new(2400, {{2157, 100}})


	Ou então


	Magic_Sword = RecipeHandler:new()

	Magic_Sword:setItem(2400)

	Magic_Sword:setRecipe({2157, 100})


	Funções do Sistema:


	RecipeHandler:new(itemtype, items, level, maglevel, skills) --> Cria uma nova instância de forja.

	RecipeHandler:setItem(itemtype) --> Atribui um certo itemid como resultado da receita.

	RecipeHandler:setRecipe(recipe) --> Atribui uma receita.

	RecipeHandler:setRecipeItem(itemid, amount) --> Adiciona um itemid e sua quantidade a receita.

	RecipeHandler:setSkill(skillid, value) --> Atribui um valor necessário de uma certa skill para poder criar a receita.

	RecipeHandler:setLevel(value) --> Atribui o level necessário para criar uma receita.

	RecipeHandler:setMagLevel(value) --> Atribui o magic level necessário para criar uma receita.


]]--



--[[	

	Este é um exemplo de receita usando algumas funções.


	É uma Magic Sword (ITEMID: 2400) que precisa de 100 Gold Nuggets (ITEMID: 2157),

	além disso, o personagem que tentar forjar, precisa ter Level 100 e Sword Fighting 50.

]]--


Recipes = {}


magicsword = RecipeHandler:new()

magicsword:setItem(2400)

magicsword:setRecipeItem(2157, 100)

magicsword:setLevel(100)

magicsword:setSkill(2, 50)

Agora em data/actions/scripts, crie um arquivo chamado iron_hammer.lua e adicione o conteúdo abaixo:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

	local recipe = nil


	for _, v in ipairs(Recipes) do

		recipe = v:get(toPosition)

		if(recipe ~= false) then

			break

		end

	end


	if(recipe) then

		recipe:create(cid)

	else

		doPlayerSendCancel(cid, "This is not a valid recipe.")

	end

	return true

end

E por fim em actions.xml, adicione a seguinte linha:

 

<action itemid="4846" event="script" value="iron_hammer.lua"/>

OPCIONAL - TALKACTION A talkaction abaixo mostra ao jogadoras receitas configuradas no servidor que ele pode fazer. Em data/talkactions/scripts, crie um arquivo chamado recipes.lua e adicione o conteúdo abaixo:

 

function onSay(cid, words, param, channel)

	local ret = {}


	local msg = "		 ADVANCED FORGE SYSTEM\n"



	for _, recipe in ipairs(Recipes) do

		local skills = true

		for skillid, value in pairs(recipe.skills) do

			if getPlayerSkillLevel(cid, skillid) < value then

				skills = false

				break

			end

		end


		if skills == true then

			if getPlayerLevel(cid) >= recipe.level and getPlayerMagLevel(cid) >= recipe.maglevel then

				table.insert(ret, {recipe, true})

			else

				table.insert(ret, {recipe, false})

			end

		else

			table.insert(ret, {recipe, false})

		end

	end


	for _, recipe in ipairs(ret) do

		msg = msg .."\nRecipe for ".. getItemNameById(recipe[1].itemtype) ..":\n\n"

		if recipe[2] == true then

			for _, item in ipairs(recipe[1].items) do

				msg = msg .."* ".. getItemNameById(item[1]) .." [".. math.min(item[2], math.max(0, getPlayerItemCount(cid, item[1]))) .."/".. item[2] .."]\n"

			end

		else

			msg = msg .."[LOCKED]\n"

		end

	end

	doShowTextDialog(cid, 2555, msg)

	return true

end

Em data/talkactions/talkactions.xml, adicione a linha:

 

<talkaction words="/recipes" event="script" value="recipes.lua"/>

 

 

 


 

Siga as instruções para configuração de novas receitas.

 

Em breve vídeo de funcionamento :)

 

 

 

 

 

Pessoal, coloquei o sistema, mas não está funcionando aqui. O /recipes funciona e me mostra as receitas, mas não estou conseguindo fazer a ação de forjar funcionar. Não aparece erro nenhum no sistema. Coloquei o id da action 4846 tanto na bigorna (id 2555) quanto no iron hammer (id 2422), mas quando coloco os itens em cima em cima da bigorna e utilizo o iron hammer, nada acontece. Alguem pode me ajudar?

12 minutos atrás, Icaro Simoes disse:

Pessoal, coloquei o sistema, mas não está funcionando aqui. O /recipes funciona e me mostra as receitas, mas não estou conseguindo fazer a ação de forjar funcionar. Não aparece erro nenhum no sistema. Coloquei o id da action 4846 tanto na bigorna (id 2555) quanto no iron hammer (id 2422), mas quando coloco os itens em cima em cima da bigorna e utilizo o iron hammer, nada acontece. Alguem pode me ajudar?

 

Deixa pessoal, consegui, era o iron hammer que eu estava usando que tinha uma id diferente

 

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

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 Kimoszin
      Informações
      Oque é o Rent System?
      É um sistema feito para os jogadores poderem alugar alguns itens por uma quantia e por um certo tempo.
      Hmmm, legal... mas para que esse sistema seria util?
      Bom, para o jogador antes de comprar algum item vip, por exemplo. Ele poderia testar para ver seus hits.
      Ok, Mas como ele funciona?
      O sistema vai entregar para o player um item, depois do tempo configuravel ele irá remover, não importa onde esteja, ele vai remover.
      Instalação
      \mods\rent.xml
      <?xml version="1.0" encoding="UTF-8"?> <mod name="Rent System" version="1.0" author="Kimoszin" contact="tibiaking.com" enabled="yes"> <config name="rent_config"><![CDATA[ messages = { sucess = MESSAGE_INFO_DESCR, fail = MESSAGE_STATUS_WARNING, } warningStorage = 45768 items = { ["knight armor"] = {id=2476, time=1, price=3000, premium=true, cap=false}, ["demon legs"] = {id=2495, time=3, price=3000, premium=true, cap=true}, ["blue legs"] = {id=7730, time=2, price=3000, premium=true, cap=true}, ["demon shield"] = {id=2520, time=1, price=3000, premium=true, cap=true}, } function doWarningItemWasRemoved(cid) if (getCreatureStorage(cid, warningStorage) > -1) then local item = items[getItemNameById(getCreatureStorage(cid, warningStorage))] doPlayerSendTextMessage(cid, messages.sucess, "Ok, "..item.time..(item.time > 1 and " minutes" or " minute").." has passed, the rent of "..getItemNameById(item.id).." ended.") doCreatureSetStorage(cid, warningStorage, -1) end end ]]></config> <talkaction words="!rent" event="buffer"><![CDATA[ domodlib('rent_config') local item, itemuid = items[param:lower()], math.random(1000, 65535) if (param == "") then return doPlayerSendTextMessage(cid, messages.fail, "Sorry, you need to inform parameters.") end if (param == "list") then local str = "~* Rent System by Kimoszin *~\n\n" for name, iten in pairs(items) do str = str..string.sub(name, 0, 1):upper()..string.sub(name, 2):lower().." - "..iten.price.."gps \n" end str = str .."\n WWW.TIBIAKING.COM" return doPlayerPopupFYI(cid, str) end if not(item) then return doPlayerSendTextMessage(cid, messages.fail, "Sorry, but it is not possible to rent this item.") end if (item.premium and not(isPremium(cid))) then return doPlayerSendTextMessage(cid, messages.fail, "You need a premium account.") end if (item.cap and not(getPlayerFreeCap(cid) >= getItemWeightById(item.id, 1, 1))) then return doPlayerSendTextMessage(cid, messages.fail, "You don't have capacity.") end if not(doPlayerRemoveMoney(cid, item.price)) then return doPlayerSendTextMessage(cid, messages.fail, "Sorry, you do not have any money.") end doItemSetAttribute(doPlayerAddItem(cid, item.id, 1), "uid", itemuid) doPlayerSendTextMessage(cid, messages.sucess, "You rented a "..getItemNameById(item.id).." for "..item.time.. (item.time > 1 and " minutes" or " minute")..".") doCreatureSetStorage(cid, warningStorage, item.id) local player_id = getPlayerGUID(cid) addEvent(function() local player = getPlayerByGUID(player_id) if not(isPlayer(player)) then db.executeQuery("DELETE FROM `player_items` WHERE `player_items`.`player_id` = "..player_id.." AND `itemtype` = "..item.id..";") else doPlayerSendTextMessage(cid, messages.sucess, "Ok, "..item.time..(item.time > 1 and " minutes" or " minute").." has passed, the rent of "..getItemNameById(item.id).." ended.") doCreatureSetStorage(cid, warningStorage, -1) doRemoveItem(itemuid, 1) end end, item.time * 60 * 1000) ]]></talkaction> <creatureevent name="rentLogin" type="login" event="buffer"><![CDATA[ domodlib('rent_config') doWarningItemWasRemoved(cid) ]]></creatureevent> </mod>  
      Explicações
      ♣ Comandos:
      !rent itemname: vai alugar o item !rent list: vai mostrar a lista dos item que são alugaveis. ♣ Variaveis
      id: id do item que vai ser alugado time: tempo do item que vai ser alugado price: preço do item que vai ser alugado premium: vai verificar se o player é premium cap: vai verificar se o player tem capacidade para alugar o item
    • Por MatheusMkalo
      Todos os scripts foram testados em um ot 8.6
      Bem o script é auto-explicativo, e ainda tem um video do sistema, acho que nao preciso explicar o que faz ne?
      AGORA EM MOD, MUITO MAIS PRATICO DE INSTALAR. SE FOR USAR O MOD VA ATE O FINAL DO POST, É EXATAMENTE IGUAL A VERSAO NORMAL, SO QUE MAIS PRATICO. FUNCIONA DO MESMO JEITO.
      Video:
      obs: Veja em fullscreen para ver melhor as msgs que retornam.
      Vá em data/lib e adicione esse script.lua com o nome de WarArenaLib:
        -- [[ Area and Positions Infos ]] -- areaplayersteam = { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } areateam1ext = {x=80, y=305, z=7} -- Ponta superior esquerda da area do time um areateam2ext = {x=87, y=305, z=7} -- Ponta superior esquerda da area do time dois leaderteam1pos = {x=83, y=307, z=7, stackpos=255} -- Posição do lider do time um (que puxara a alavanca) leaderteam2pos = {x=87, y=307, z=7, stackpos=255} -- Posição do lider do time dois (que puxara a alavanca) newplayersposteam1 = {x=67, y=300, z=7} -- Posição para onde os players do time um serao teleportados newplayersposteam2 = {x=67, y=330, z=7} -- Posição para onde os players do time dois serao teleportados team1leverpos = {x=84, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time um puxara team2leverpos = {x=86, y=307, z=7, stackpos=1} -- Posição da alavanca que o lider do time dois puxara leverafter, leverbefore = 9825, 9826 -- Ids das alavancas antes de puxadas e depois, consecutivamente (9825 = antes; 9826 = depois) posbenterteam1 = {x=78, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 1 posbenterteam2 = {x=92, y=307, z=7} -- Posiçao do sqm antes de entrar na arena do time 2 backteampos = {x=77, y=307, z=7} -- [[ Storage Infos ]] -- team1leverstorage = 123497 -- Storage que sera usado quando puxarem a alavanca do time 1 team2leverstorage = 123498 -- Storage que sera usado quando puxarem a alavanca do time 2 haveteaminarena = 123499 -- Storage que sera usado para ve se tem algum time lutando na arena storageteam1death = 123500 -- Storage usado para ver quantos morreram do time 1 storageteam2death = 123501 -- Storage usado para ver quantos morreram do time 2 storageteam1 = 123502 -- Storage usado para ver quantas pessoas entraram na arena no time 1 storageteam2 = 123503 -- Storage usado para ver quantas pessoas entraram na arena no time 2 storageleader1 = 123504 -- Storage onde ficara guardado o uid do lider do time 1 storageleader2 = 123505 -- Storage onde ficara guardado o uid do lider do time 2 storageplayersteam1 = 123506 -- Storage que todos os players do team 1 iram ter. storageplatersteam2 = 123507 -- Storage que todos os players do team 2 iram ter. -- [[ Player Infos ]] -- needlevelarena = 20 -- Level que os outros jogadores sem ser o lider teram que ter. leaderlevel = 4000 -- Level que o lider tera que ter. onlyguildwars = true -- Se os membros de um time tem que ser da mesma guild do lider. (Nesse caso somente o lider da guild podera puxar a alavanca.) needplayers = 2 -- Quantidade de players que cada time tem que ter. -- [[ Functions ]] -- function getUidsFromArea(firstpos, area) local result = {} for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then table.insert(result, getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) end end end return result end function teleportUidsToPos(uids, pos) for i,x in pairs(uids) do doTeleportThing(x, pos) end end function isAllUidsSameGuild(uids, guildid) for i,x in pairs(uids) do if not (getPlayerGuildId(x) == guildid) then return false end end return true end function isAllUidsLevel(uids, level) for i,x in pairs(uids) do if not (getPlayerLevel(x) >= level) then return false end end return true end function haveQuantPlayersInArea(firstpos, area, quant) local result = 0 for i,x in pairs(area) do for s,z in pairs(x) do if isPlayer(getThingFromPos({x=firstpos.x+s-1, y=firstpos.y+i-1, z=firstpos.z, stackpos=255}).uid) then result = result+1 end end end return result >= quant end function addStorageToUids(uids, storage, value) for i,x in pairs(uids) do setPlayerStorageValue(x, storage, value) end end function checkPoses(pos1, pos2) if pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z then return true end return false end function startArena() setGlobalStorageValue(storageleader1, getThingFromPos(leaderteam1pos).uid) setGlobalStorageValue(storageleader2, getThingFromPos(leaderteam2pos).uid) addStorageToUids(team1uids, storageplayersteam1, 1) addStorageToUids(team2uids, storageplayersteam2, 1) teleportUidsToPos(team1uids, newplayersposteam1) teleportUidsToPos(team2uids, newplayersposteam2) setGlobalStorageValue(storageteam1, #team1uids) registerCreatureEventUids(team1uids, "DeathTeam1") registerCreatureEventUids(team2uids, "DeathTeam2") setGlobalStorageValue(storageteam2, #team2uids) setGlobalStorageValue(haveteaminarena, 1) setGlobalStorageValue(team1leverstorage, 0) setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end function haveTeamInArena() return getGlobalStorageValue(haveteaminarena) == 1 and true or false end function isSqmFromArea(firstpos, area, sqmpos) for i,x in pairs(area) do for s,z in pairs(x) do if sqmpos.x == firstpos.x+s-1 and sqmpos.y == firstpos.y+i-1 and sqmpos.z == firstpos.z then return true end end end return false end function registerCreatureEventUids(uids, event) for i,x in pairs(uids) do registerCreatureEvent(x, event) end end Agora vá em data/actions/scripts e adicione um script.lua com o nome de WarArenaLever:
        function onUse(cid, item, fromPosition, itemEx, toPosition) team1uids = getUidsFromArea(areateam1ext, areaplayersteam) team2uids = getUidsFromArea(areateam2ext, areaplayersteam) if haveTeamInArena() then return doPlayerSendCancel(cid, "Already have a team in arena.") end if checkPoses(toPosition, team1leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam1pos) then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) return doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team1uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team1uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team1leverstorage, 1) doTransformItem(getThingFromPos(team1leverpos).uid, leverbefore) if getGlobalStorageValue(team2leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end elseif checkPoses(toPosition, team2leverpos) then if checkPoses(getCreaturePosition(cid), leaderteam2pos) then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) return doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end if onlyguildwars and getPlayerGuildLevel(cid) < 3 then return doPlayerSendCancel(cid, "You need to be the leader of your guild.") end if onlyguildwars and not isAllUidsSameGuild(team2uids, getPlayerGuildId(cid)) then return doPlayerSendCancel(cid, "All of your team need to be in your guild.") end if not isAllUidsLevel(team2uids, needlevelarena) then return doPlayerSendCancel(cid, "All of your team need to be level " .. needlevelarena .. " or more.") end if getPlayerLevel(cid) < leaderlevel then return doPlayerSendCancel(cid, "You, the leader of the team, need to be level " .. leaderlevel .. " or more.") end if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then return doPlayerSendCancel(cid, "Your team need " .. tostring(needplayers) .. " players.") end setGlobalStorageValue(team2leverstorage, 1) doTransformItem(getThingFromPos(team2leverpos).uid, leverbefore) if getGlobalStorageValue(team1leverstorage) >= 1 then startArena() end else doPlayerSendCancel(cid, "You must be the leader of the team to pull the lever.") end end return TRUE end E em actions.xml bote essa linha:
        <action actionid="12349" event="script" value="WarArenaLever.lua"/> Agora vá em data/creaturescripts/scripts e adicione dois scripts.lua com esses nomes: WarArenaDeathTeam1:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam1, 0) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end WarArenaDeathTeam2:
        function onDeath(cid) setPlayerStorageValue(cid, storageplayersteam2, 0) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end return TRUE end Agora abra o creaturescripts.xml e adicione essas linhas:
        <event type="death" name="DeathTeam1" event="script" value="WarArenaDeathTeam1.lua"/> <event type="death" name="DeathTeam2" event="script" value="WarArenaDeathTeam2.lua"/> Agora vá em data/movements/scripts e adicione tres scripts.lua com esses nomes: WarArenaMovement1:
        function onStepOut(cid, item, position, fromPosition) local team = (fromPosition.x == leaderteam1pos.x and fromPosition.y == leaderteam1pos.y and fromPosition.z == leaderteam1pos.z) and "team1" or (fromPosition.x == leaderteam2pos.x and fromPosition.y == leaderteam2pos.y and fromPosition.z == leaderteam2pos.z) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end WarArenaMovement2:
        function onStepIn(cid, item, position, fromPosition) local team = isSqmFromArea(areateam1ext, areaplayersteam, fromPosition) and "team1" or isSqmFromArea(areateam2ext, areaplayersteam, fromPosition) and "team2" if team == "team1" then if getGlobalStorageValue(team1leverstorage) == 1 then if not haveQuantPlayersInArea(areateam1ext, areaplayersteam, needplayers) then setGlobalStorageValue(team1leverstorage, 0) doTransformItem(getThingFromPos(team1leverpos).uid, leverafter) end end elseif team == "team2" then if getGlobalStorageValue(team2leverstorage) == 1 then if not haveQuantPlayersInArea(areateam2ext, areaplayersteam, needplayers) then setGlobalStorageValue(team2leverstorage, 0) doTransformItem(getThingFromPos(team2leverpos).uid, leverafter) end end end if getGlobalStorageValue(team1leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam1) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end elseif getGlobalStorageValue(team2leverstorage) == 1 then if checkPoses(fromPosition, posbenterteam2) then doTeleportThing(cid, fromPosition) return doPlayerSendCancel(cid, "You can't enter now.") end end end WarArenaMovement3:
        function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, storageplayersteam1) >= 1 then setPlayerStorageValue(cid, storageplayersteam1, 0) doTeleportThing(cid, posbenterteam1) setGlobalStorageValue(storageteam1death, getGlobalStorageValue(storageteam1death) >= 0 and getGlobalStorageValue(storageteam1death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam1death) >= getGlobalStorageValue(storageteam1) then if onlyguildwars then doBroadcastMessage("The Team 2 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader2)) .. ".") else doBroadcastMessage("The Team 2 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader2)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end elseif getPlayerStorageValue(cid, storageplayersteam2) >= 1 then setPlayerStorageValue(cid, storageplayersteam2, 0) doTeleportThing(cid, posbenterteam2) setGlobalStorageValue(storageteam2death, getGlobalStorageValue(storageteam2death) >= 0 and getGlobalStorageValue(storageteam2death)+1 or 1) if getGlobalStorageValue(haveteaminarena) >= 1 then if getGlobalStorageValue(storageteam2death) >= getGlobalStorageValue(storageteam2) then if onlyguildwars then doBroadcastMessage("The Team 1 won the war, guild " .. getPlayerGuildName(getGlobalStorageValue(storageleader1)) .. ".") else doBroadcastMessage("The Team 1 won the war, team leader name is " .. getCreatureName(getGlobalStorageValue(storageleader1)) .. ".") end setGlobalStorageValue(storageteam1death, 0) setGlobalStorageValue(storageteam2death, 0) setGlobalStorageValue(haveteaminarena, 0) end end end return TRUE end E adicione essas linhas em movements.xml:
        <movevent type="StepOut" actionid="12350" event="script" value="WarArenaMovement1.lua"/> <movevent type="StepIn" actionid="12351" event="script" value="WarArenaMovement2.lua"/> <movevent type="StepIn" actionid="12352" event="script" value="WarArenaMovement3.lua"/> Pronto acabou rairiaria. Adicionando os Actions IDS: Nas 2 alavancas, adicione o actionid 12349. Nos 2 sqms que os players vao estar antes de entrar na arena adicione o actionid 12351. Nos 2 quadrados aonde os lideres irao ficar (na frente da alavanca) bote o actionid 12350. No sqm de sair da arena bote o actionid 12352. NA AREA DOS TIMES E NA ARENA, BOTE PELO MAP EDITOR PARA NAO PODER LOGAR. (Se voce nao fizer isso pode haver bugs.) Bem, se voce souber ler o script da lib, vai saber configura-lo para seu otserver. Versão MOD: (Abra o spoiler)
      O modo de configurar é exatamente igual ao normal. Flws.
      By MatheusMkalo
    • Por maleskinho
      Olá pessoal, vi que muitos estavam tentando resolver o problema de um "CityWar Anti-Entrosa".de tal Empresa...
       
      "O script só roda uma vez a  war e depois ele TRAVA, ."
      Estava olhando o script aonde ocorria o problema e consegui resolver fiz vários testes e está rodando 100% sem erros! 
       
      No arquivo tem o tutorial que ensina a instalar, se ajudei deixa um rep+
       

       
      File:Link
      Scan: Link
       
       
      -- EDIT---
      Summon que matava os player na war fazia cair o servidor, agora está 100% estável o script.
       
      Substituir o arquivo diretório talkactions/lib/war.lua 
      @Way20 Créditos pela ajuda.
       

    • Por Guilherme.
      Mark Of The Assassin












      O Player causa dano e marca a criatura por 10 segundos. Quando o alvo é marcado, ele recebe 50% de dano a mais.











      Entre em data/mods/ e crie um arquivo chamado mark.xml em seguida cole o código abaixo dentro do arquivo, salve e feche.




      <?xml version="1.0" encoding="UTF-8"?> <mod name="Mark of the Assassin" version="1.0" author="Snake Royal" contact="otland.net" enabled="yes"> <instant name="Mark of the Assassin" words="exori sin" lvl="50" mana="140" prem="1" range="5" needtarget="1" blockwalls="1" needweapon="1" exhaustion="7000" needlearn="0" event="script"> <vocation id="4"/> <vocation id="8"/> <![CDATA[ local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE) function onGetFormulaValues(cid, level, skill, attack, factor) local skillTotal, levelTotal = skill + attack, level / 5 return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal) end function onTargetCreature(cid, target) registerCreatureEvent(target, "Mark of the Assassin/statschange001") doCreatureSetStorage(target, 1000, os.time() + 10) doCreatureSetStorage(target, 1001, cid) return true end setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature") setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues") function onCastSpell(cid, var) return doCombat(cid, combat, var) end ]]> </instant> <event type="statschange" name="Mark of the Assassin/statschange001" event="script"><![CDATA[ function onStatsChange(cid, attacker, type, combat, value) if (getCreatureStorage(cid, 1000) > os.time() and getCreatureStorage(cid, 1001) == attacker and type == STATSCHANGE_HEALTHLOSS) then doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN) doCreatureAddHealth(cid, -math.ceil(value * 0.5)) end return true end ]]></event> </mod>




      A configuração é básica assim como toda spell, basta entender um pouquinho de otserv, esse é uma spell/mod feita por Snake Royal

    • Por xWhiteWolf
      Aeeeeeee carai, hoje vim trazer pra vocês meu mais novo sistema *-*. É uma fodenda spell que você seleciona alguém pra ser seu voodoo e a partir disso durante um tempo X ela vai receber todos os hit's que você deveria receber... INCRÍVEL, NÃO?
      Agora se nesse meio tempo ela deslogar ou entrar em pz você vai tomar o dano normal, mas se ainda tiver nesse tempo X e ela sair ela vai receber o dano instantaneamente (É BOM DEMAIS PRA SER VERDADE).

      Agora você deve estar imaginando, e se eu usar a magia pra transferir o dano pra um amigo e ele fizer a mesma coisa em mim, pra onde vai o dano?
      PRA LUGAR NENHUM!!!! Até porque eu já me previni contra esse bug fazendo com que não seja possível fazer alguém de voodoo se ele já tiver alguém de voodoo.
      Testado em versão 8.54 TFS Crying Damnson mas deve funcionar em todas as versões que tenham a função onStatsChange no creaturescripts.
      Bom, o script tá 100% funcional e livre de bugs (se vc achar algum eu te dou 3 REP).

      Agora vamos à mágica:
       
      Crie um arquivo em mods com extensão .xml e adiciona isso daqui nele
      <?xml version="1.0" encoding="UTF-8"?> <mod name="Voodoo System" version="1.0" author="Night Wolf" contact="none" enabled="yes"> ------------------------------------------------------------------------------------ <config name="feitisso"><![CDATA[ configuration = { storage = 24567,  tempo = 20, cooldown = 45, effect1 = 13, effect2 = 65 } storagecool = 24568 ]]></config> ---------------------------------------------------------------------------------- <event type="login" name="registerVoodoo" event="script"><![CDATA[ function onLogin(cid) domodlib('feitisso') if getPlayerStorageValue(cid, configuration.storage) > 0 then doPlayerSendTextMessage(cid, 22, "Your victim is not receiving your hits anymore.") doPlayerSetStorageValue(cid, configuration.storage, 0) end registerCreatureEvent(cid,"voodoo") return true end ]]></event> ------------------------------------------------------------------------------------ <instant name="Feitiço" words="voodoo" lvl="50" mana="10" prem="1" range="3" needtarget="1" blockwalls="1" exhaustion="1000" needlearn="0" event="script"> <vocation id="5"/> <vocation id="6"/> <vocation id="7"/> <vocation id="8"/> <![CDATA[ function onCastSpell(cid, var) domodlib('feitisso') if not (isPlayer(variantToNumber(var))) then doPlayerSendCancel(cid, "You can only use this spell in players.") return false end if getPlayerStorageValue(variantToNumber(var), configuration.storage) > 0 then doPlayerSendCancel(cid, "You can't make a voodoo of someone who already has a voodoo.") return false end if (os.time() - getPlayerStorageValue(cid, storagecool)) >= configuration.cooldown then if getPlayerStorageValue(cid, configuration.storage) <= 0 then timeleft = (os.time() + configuration.cooldown) doPlayerSetStorageValue(cid, storagecool, timeleft) local target = getPlayerGUID(variantToNumber(var)) doPlayerSetStorageValue(cid, configuration.storage, target) doSendMagicEffect(getPlayerPosition(cid), configuration.effect1) doSendMagicEffect(getThingPos(variantToNumber(var)), configuration.effect1) addEvent(function()   if isCreature(cid) then doSendMagicEffect(getPlayerPosition(cid), configuration.effect2) doPlayerSendTextMessage(cid, 22, "Your victim is not receiving your hits anymore.") doPlayerSetStorageValue(cid, configuration.storage, 0) end  end, 100+1000*configuration.tempo) elseif getPlayerStorageValue (cid, configuration.storage) > 0 then doPlayerSendCancel(cid, "You've already set a target.") end else doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(configuration.cooldown - (os.time() - getPlayerStorageValue(cid, storagecool))).." seconds.") end return true end ]]></instant> ------------------------------------------------------------------------------------ <event type="statschange" name="voodoo" event="script"><![CDATA[ function onStatsChange(cid, attacker, type, combat, value) domodlib('feitisso') if isPlayer(cid) and (not (attacker == cid)) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) and getPlayerStorageValue(cid, configuration.storage) >= 1 then local name = getPlayerNameByGUID(getPlayerStorageValue(cid, configuration.storage)) local victim = getCreatureByName(name) if isCreature(victim) and not (getTilePzInfo(getPlayerPosition(victim)))  then dano = math.ceil(value) doSendMagicEffect(getPlayerPosition(cid), configuration.effect2) if attacker == victim then doTargetCombatHealth(cid, victim, combat, -dano, -dano, configuration.effect2) else doTargetCombatHealth(attacker, victim, combat, -dano, -dano, configuration.effect2) end return false end end return true end ]]></event> ------------------------------------------------------------------------------------ </mod> aqui você edita os storages da magia e do cooldown, além do tempo que ela dura, o tempo de cooldown (um uso e outro) e os efeitos que vão sair.
      -------------------------------------------------------------------------------------------------------------
       
      aqui você edita o nome da spell, as palavras pra ela sair, level, custo de mana, se é preciso ser premium pra usar, o range dela, e as vocações que podem usá-la.

      OBS: se vc quiser que essa spell seja ganha em uma quest (por se tratar de algo bastante apelativo), é só colocar needlearn = "1" e fazer uma quest pra ganhar a spell (tem no meu Darkness Pact Quest uma quest de ganhar Spell, é só ir lá no meu perfil e procurar o tópico).

      Essa spell não serve somente pra ATS, use a criatividade pra criar uma história e fazer ela se encaixar... foque nos elementos de RPG e tcharam, está feito!.

      Façam bom uso e espero que não saiam postando em outros lugares sem os devidos créditos. Abraços do lobinho pra vcs

      PS: a foto ficou meio bosta mas vou postar mesmo assim 

       
      Eu (sorc) ataquei a zuera e tomei o dano de volta e ainda saiu esse efeitinho bonito. 

      Espero que tenham gostado e usem essa spell como base pra fazer outras coisas maravilhosas pra esse fórum   
      E não esqueça de clicar em "gostei" caso tenha curtido a idéia.

      Ahhh, e antes que eu me esqueça dos agradecimentos:
      @ViitinG por me ajudar a testar
      @CreatServer por me dar a idéia
      @MaXwEllDeN por me orientar a trocar a table pelo storage possibilitando que o script fosse possível.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo