
granoob
Membro
-
Registro em
-
Última visita
Histórico de Curtidas
-
granoob deu reputação a Dwarfer em [ DESENVOLVIMENTO ] - SISTEMA DE PVP POR DEMANDAPrimeiramente, tente sempre deixar claro qual a versão da sua distro nos seus tópicos. Espero que a versão que chutei ser a do seu servidor seja a correta.
Não estava em casa, então não tive como testar exatamente nada, qualquer problema é só falar.
Em data/lib crie um arquivo.lua e cole isto dentro:
Os campos que têm tempo você pode configurá-los como quiser. Os valores possíveis seguem os exemplos abaixo:
Ex.: {40, "sec"}, {10, "min"}, {2, "hour"}, {1, "day"}
Em data/talkactions/scripts crie um arquivo.lua e cole isto dentro:
No talkactions.xml, adicione a tag:
<talkaction words="!pvp" event="script" value="NOMEDOSEUARQUIVO.lua"/>
Em data/creaturescripts/scripts crie um arquivo.lua e cole isto dentro:
No creaturescripts.xml, adicione as linhas:
<event type="target" name="PvpSysTarget" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="combat" name="PvpSysCombat" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="login" name="PvpSysLogin" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="look" name="PvpSysLook" event="script" value="NOMEDOSEUARQUIVO.lua"/> <event type="kill" name="PvpSysKill" event="script" value="NOMEDOSEUARQUIVO.lua"/>
Deixe o servidor como pvp no config.lua.
Os comandos para ativar e desativar o pvp são, respectivamente, !pvp on e !pvp off
-
granoob recebeu reputação de amoxicilina em [ DESENVOLVIMENTO ] - SISTEMA DE PVP POR DEMANDAOlá galera da TK, trago uma ideia para os veteranos de plantão caso eu esteja postando em tópico errado, ja peço desculpas e pode mover esse tópico
inicialmente sou programador, mais não tenho conhecimento em todas função e código que o otserver pode suporta por isso peço ajuda
a ideia inicial é criar um sistema no qual pode evitar vários ots caírem em falência devido os pelegos que nele envolve. Como assim?
Hoje em dia os OTs server são visto como um fonte de diversão no os jogadores tem em mente que vai logar, forma o seu time e depois dominar o mundo , são bonitos motivos
porem muito outros jogadores querem tornar o seu Ots um servidor serio um local para eles se diverti e sempre esta presente fazendo amizades e sempre esta na emoção de Quest cada vez mais difíceis, neste caso vem aquele time de pelego e começa a matar os jogadores que nem estão neste clima, derrotando todo o trabalho de meses ajeitando o seu OT que tinha um ideal transformando ele numa plataforma de pvp sem limites, contudo vários players abandonando o seu OT ate chegar o dia de resetar ou ate mesmo encerrar.
principio basico da ideia é criar um mundo onde inicial é não pvp ao mesmo tempo pvp veja abaixo a ideologia que tive quero ajudar a montar esse sistema pois sei que os veteranos que conhece cada função que o OT possuir e saberá como ajudar vamos lá.
1° Inicialmente o mundo seria um mundo não-pvp
aquele jogadores que queria pelegar, fazer o famoso mata-mata precisaria de uma permissão ou items que permita ele mata outro players que esteja com a mesma função ativa, neste modo aqueles q não querem ser envolvido nos pelegos não teria nenhum problema de continua sua vida em jogo
2° Iniciando a troca dos Modos
a forma de transforma um modo de jogo pode ser através de comandos ou items, o jogador que queria ser pvp ele precisaria ativar o comando ou items a parti dai ele se torna um jogador pvp
exemplo um jogador chegou um certo level e quer sai ao seu pelego de boa com outro time basta ativa a função, ao ativa ele terá um tempo nesse modo, onde o tempo sera configurado ao administrador do ot para cada kill que o jogador do pelego faça ele aumenta esse tempo de forma também que seja configurado o aumento do tempo por kill, assim tornando mais justo para ambos caso o jogador esteja com skulls seja ela qual for, o tempo neste caso não mudaria ate que todas as skull fosse removidas, a parti dai o tempo para volta ao não-pvp voltaria a desce para sabe se o jogador tem a funcao pvp ativada em seu look, teria que ter uma tag por exemplo: (modo pvp on), assim todos vai sabe que aquele jogador é PVP caso o jogador cansou de ser caçado ou queria continua a jogar sem pelego ele precisaria desativa a função de forma que seja configurada, por um valor e tempo determinado pelo administrador e o que seria pra desativar os jogadores PVP não teria como matar outros players que não tive com o mesmo modo ativo, a não ser por traps
a ideia seria basicamente esse de forma os OTs servers seria algo muito melhor e um ambiente para todos.
aguardo comunicações sobre tal sistema e vou esta periodicamente acompanhando o tópico para esse desenvolvimento e anexando o inicio do trabalho
vlw galera do TK
Tambem quero compartilhar algo com vocês para o seu OT logicamente ideia de melhorias podem ser aplicada
esse é uma TAG de top level do servidor, que ja tem ai na TK, porem foi feita para ser TFS1.2
Crie um arquivo no seu creaturescripts com o nome: topeffect.lua
local function getHighestPlayer() local resultId = db.storeQuery("SELECT `name` FROM `players` ORDER BY `level` DESC, `experience` DESC LIMIT 5") if not resultId then return false end return result.getDataString(resultId, "name") end local config = { interval = 5, effect = CONST_ME_POFF } local function sendEffectTopPlayer(cid) local player = Player(cid) if not player then return true end if config.effect then -- player:getPosition():sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)) player:say('[TOP]', TALKTYPE_MONSTER_SAY) --player:getPosition():sendMagicEffect(config.effect) addEvent(sendEffectTopPlayer, config.interval * 1000, cid) return true end end function onLogin(player) if player:getName() ~= getHighestPlayer() then return true end sendEffectTopPlayer(player:getId()) return true end function onAdvance(player) if player:getName() ~= getHighestPlayer() then return true end sendEffectTopPlayer(player:getId()) return true end depois adicione isso em seu creaturescripts.xml
<event type="login" name="TopEffect" script="topeffect.lua"/> <event type="advance" name="CheckTop" script="topeffect.lua"/> esse scripts ta básico aceito ideias de melhorias, mais ta muito legal e espero que gostem
-
granoob recebeu reputação de Koring4 em (Resolvido)Função no item.xml não funcionaentão no seu moviments ta assim script="imbuement.lua
se remove o item passa a se lido corretamente pela function="onEquipItem"
entendeu ?
<movevent event="Equip" itemid="2472" slot="armor" function="onEquipItem">
<vocation name="Knight" /> <vocation name="Elite Knight" showInDescription="0" />
<vocation name="Paladin" /> <vocation name="Royal Paladin" showInDescription="0" />
</movevent>
<movevent event="DeEquip" itemid="2472" slot="armor" function="onDeEquipItem" /> -- DESSA FORMA O ITEM É LIDO NORMALMENTE
-- dessa forma o item não ler os atributos deles
<movevent event="Equip" itemid="2472" slot="armor" function="onEquipItem" script="imbuement.lua">
<vocation name="Knight" /> <vocation name="Elite Knight" showInDescription="0" />
<vocation name="Paladin" /> <vocation name="Royal Paladin" showInDescription="0" />
</movevent>
<movevent event="DeEquip" itemid="2472" slot="armor" function="onDeEquipItem" script="imbuement.lua" />
-
granoob deu reputação a
PedroSTTem Anel de SummonScript -- Coloque em moveMents
local summon = "Paradox" -- Nome do monstro que irá ser summonado. local ef = 21 -- Efeito que mandará quando equipar o ring local eff = 2 -- efeito que mandará quando desequipar o ring function onEquip(cid, item, slot) local pos = getCreaturePosition(cid) if getCreatureSummons(cid) == -1 then doSummonMonster(summon, pos) doSendMagicEffect(ef, pos) else doPlayerSendTextMessage(cid, MessageClasses, "voce ja tem um summon vivo") end end function onDeEquip(cid, item, slot) local pos = getCreaturePosition(cid) local pet = getCreatureSummons(cid) if getCreatureSummons(cid) == 1 then for _, k in ipairs(pet)do doRemoveCreature(k) doSendMagicEffect(eff, pos) return true end end end XML
<movevent type="Equip" itemid="2202" slot="ring" event="script" value="ring.lua"/> <movevent type="DeEquip" itemid="2202" slot="ring" event="script" value="ring.lua"/>
-
granoob deu reputação a ViitinG em (Resolvido)TSF 1.0 NPC BANK {BUG}Tente trocar seu script por este :
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local Topic, count, transfer = {}, {}, {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local function getCount(s) local b, e = s:find('%d+') return b and e and math.min(4294967295, tonumber(s:sub(b, e))) or -1 end local function findPlayer(name) local q = db.getResult('SELECT name FROM players WHERE name=' .. db.escapeString(name) .. ' LIMIT 1'), nil if q:getID() == -1 then return end local r = q:getDataString('name') q:free() return r end function greet(cid) Topic[cid], count[cid], transfer[cid] = nil, nil, nil return true end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false elseif msgcontains(msg, 'balance') then npcHandler:say('Your account balance is ' .. getPlayerBalance(cid) .. ' gold.', cid) Topic[cid] = nil elseif msgcontains(msg, 'deposit') and msgcontains(msg, 'all') then if getPlayerMoney(cid) == 0 then npcHandler:say('You don\'t have any gold with you.', cid) Topic[cid] = nil else count[cid] = getPlayerMoney(cid) npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) Topic[cid] = 2 end elseif msgcontains(msg, 'deposit') then if getCount(msg) == 0 then npcHandler:say('You are joking, aren\'t you??', cid) Topic[cid] = nil elseif getCount(msg) ~= -1 then if getPlayerMoney(cid) >= getCount(msg) then count[cid] = getCount(msg) npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) Topic[cid] = 2 else npcHandler:say('You do not have enough gold.', cid) Topic[cid] = nil end elseif getPlayerMoney(cid) == 0 then npcHandler:say('You don\'t have any gold with you.', cid) Topic[cid] = nil else npcHandler:say('Please tell me how much gold it is you would like to deposit.', cid) Topic[cid] = 1 end elseif Topic[cid] == 1 then if getCount(msg) == -1 then npcHandler:say('Please tell me how much gold it is you would like to deposit.', cid) Topic[cid] = 1 elseif getPlayerMoney(cid) >= getCount(msg) then count[cid] = getCount(msg) npcHandler:say('Would you really like to deposit ' .. count[cid] .. ' gold?', cid) Topic[cid] = 2 else npcHandler:say('You do not have enough gold.', cid) Topic[cid] = nil end elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then if doPlayerRemoveMoney(cid, count[cid]) then doPlayerSetBalance(cid, getPlayerBalance(cid) + count[cid]) npcHandler:say('Alright, we have added the amount of ' .. count[cid] .. ' gold to your balance. You can withdraw your money anytime you want to.', cid) else npcHandler:say('I am inconsolable, but it seems you have lost your gold. I hope you get it back.', cid) end Topic[cid] = nil elseif msgcontains(msg, 'no') and Topic[cid] == 2 then npcHandler:say('As you wish. Is there something else I can do for you?', cid) Topic[cid] = nil elseif msgcontains(msg, 'withdraw') then if getCount(msg) == 0 then npcHandler:say('Sure, you want nothing you get nothing!', cid) Topic[cid] = nil elseif getCount(msg) ~= -1 then if getPlayerBalance(cid) >= getCount(msg) then count[cid] = getCount(msg) npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) Topic[cid] = 4 else npcHandler:say('There is not enough gold on your account.', cid) Topic[cid] = nil end elseif getPlayerBalance(cid) == 0 then npcHandler:say('You don\'t have any money on your bank account.', cid) Topic[cid] = nil else npcHandler:say('Please tell me how much gold you would like to withdraw.', cid) Topic[cid] = 3 end elseif Topic[cid] == 3 then if getCount(msg) == -1 then npcHandler:say('Please tell me how much gold you would like to withdraw.', cid) Topic[cid] = 3 elseif getPlayerBalance(cid) >= getCount(msg) then count[cid] = getCount(msg) npcHandler:say('Are you sure you wish to withdraw ' .. count[cid] .. ' gold from your bank account?', cid) Topic[cid] = 4 else npcHandler:say('There is not enough gold on your account.', cid) Topic[cid] = nil end elseif msgcontains(msg, 'yes') and Topic[cid] == 4 then if getPlayerBalance(cid) >= count[cid] then doPlayerAddMoney(cid, count[cid]) doPlayerSetBalance(cid, getPlayerBalance(cid) - count[cid]) npcHandler:say('Here you are, ' .. count[cid] .. ' gold. Please let me know if there is something else I can do for you.', cid) else npcHandler:say('There is not enough gold on your account.', cid) end Topic[cid] = nil elseif msgcontains(msg, 'no') and Topic[cid] == 4 then npcHandler:say('The customer is king! Come back anytime you want to if you wish to withdraw your money.', cid) Topic[cid] = nil elseif msgcontains(msg, 'transfer') then if getCount(msg) == 0 then npcHandler:say('Please think about it. Okay?', cid) Topic[cid] = nil elseif getCount(msg) ~= -1 then count[cid] = getCount(msg) if getPlayerBalance(cid) >= count[cid] then npcHandler:say('Who would you like to transfer ' .. count[cid] .. ' gold to?', cid) Topic[cid] = 6 else npcHandler:say('There is not enough gold on your account.', cid) Topic[cid] = nil end else npcHandler:say('Please tell me the amount of gold you would like to transfer.', cid) Topic[cid] = 5 end elseif Topic[cid] == 5 then if getCount(msg) == -1 then npcHandler:say('Please tell me the amount of gold you would like to transfer.', cid) Topic[cid] = 5 else count[cid] = getCount(msg) if getPlayerBalance(cid) >= count[cid] then npcHandler:say('Who would you like to transfer ' .. count[cid] .. ' gold to?', cid) Topic[cid] = 6 else npcHandler:say('There is not enough gold on your account.', cid) Topic[cid] = nil end end elseif Topic[cid] == 6 then local v = getPlayerByName(msg) if getPlayerBalance(cid) >= count[cid] then if v then transfer[cid] = msg npcHandler:say('Would you really like to transfer ' .. count[cid] .. ' gold to ' .. getPlayerName(v) .. '?', cid) Topic[cid] = 7 elseif findPlayer(msg):lower() == msg:lower() then transfer[cid] = msg npcHandler:say('Would you really like to transfer ' .. count[cid] .. ' gold to ' .. findPlayer(msg) .. '?', cid) Topic[cid] = 7 else npcHandler:say('This player does not exist.', cid) Topic[cid] = nil end else npcHandler:say('There is not enough gold on your account.', cid) Topic[cid] = nil end elseif Topic[cid] == 7 and msgcontains(msg, 'yes') then if getPlayerBalance(cid) >= count[cid] then local v = getPlayerByName(transfer[cid]) if v then doPlayerSetBalance(cid, getPlayerBalance(cid) - count[cid]) doPlayerSetBalance(v, getPlayerBalance(v) + count[cid]) npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. getPlayerName(v) .. '.', cid) elseif findPlayer(transfer[cid]):lower() == transfer[cid]:lower() then doPlayerSetBalance(cid, getPlayerBalance(cid) - count[cid]) db.executeQuery('UPDATE players SET balance=balance+' .. count[cid] .. ' WHERE name=' .. db.escapeString(transfer[cid]) .. ' LIMIT 1') npcHandler:say('Very well. You have transferred ' .. count[cid] .. ' gold to ' .. findPlayer(transfer[cid]) .. '.', cid) else npcHandler:say('This player does not exist.', cid) end else npcHandler:say('There is not enough gold on your account.', cid) end Topic[cid] = nil elseif Topic[cid] == 7 and msgcontains(msg, 'no') then npcHandler:say('Alright, is there something else I can do for you?', cid) Topic[cid] = nil elseif msgcontains(msg, 'change gold') then npcHandler:say('How many platinum coins would you like to get?', cid) Topic[cid] = 8 elseif Topic[cid] == 8 then if getCount(msg) < 1 then npcHandler:say('Hmm, can I help you with something else?', cid) Topic[cid] = nil else count[cid] = math.min(500, getCount(msg)) npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your gold coins into ' .. count[cid] .. ' platinum coins?', cid) Topic[cid] = 9 end elseif Topic[cid] == 9 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2148, count[cid] * 100) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 2152, count[cid]) else npcHandler:say('Sorry, you do not have enough gold coins.', cid) end else npcHandler:say('Well, can I help you with something else?', cid) end Topic[cid] = nil elseif msgcontains(msg, 'change platinum') then npcHandler:say('Would you like to change your platinum coins into gold or crystal?', cid) Topic[cid] = 10 elseif Topic[cid] == 10 then if msgcontains(msg, 'gold') then npcHandler:say('How many platinum coins would you like to change into gold?', cid) Topic[cid] = 11 elseif msgcontains(msg, 'crystal') then npcHandler:say('How many crystal coins would you like to get?', cid) Topic[cid] = 13 else npcHandler:say('Well, can I help you with something else?', cid) Topic[cid] = nil end elseif Topic[cid] == 11 then if getCount(msg) < 1 then npcHandler:say('Hmm, can I help you with something else?', cid) Topic[cid] = nil else count[cid] = math.min(500, getCount(msg)) npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your platinum coins into ' .. count[cid] * 100 .. ' gold coins for you?', cid) Topic[cid] = 12 end elseif Topic[cid] == 12 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, count[cid]) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 2148, count[cid] * 100) else npcHandler:say('Sorry, you do not have enough platinum coins.', cid) end else npcHandler:say('Well, can I help you with something else?', cid) end Topic[cid] = nil elseif Topic[cid] == 13 then if getCount(msg) < 1 then npcHandler:say('Hmm, can I help you with something else?', cid) Topic[cid] = nil else count[cid] = math.min(500, getCount(msg)) npcHandler:say('So you would like me to change ' .. count[cid] * 100 .. ' of your platinum coins into ' .. count[cid] .. ' crystal coins for you?', cid) Topic[cid] = 14 end elseif Topic[cid] == 14 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2152, count[cid] * 100) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 2160, count[cid]) else npcHandler:say('Sorry, you do not have enough platinum coins.', cid) end else npcHandler:say('Well, can I help you with something else?', cid) end Topic[cid] = nil elseif msgcontains(msg, 'change crystal') then npcHandler:say('How many crystal coins would you like to change into platinum?', cid) Topic[cid] = 15 elseif Topic[cid] == 15 then if getCount(msg) == -1 or getCount(msg) == 0 then npcHandler:say('Hmm, can I help you with something else?', cid) Topic[cid] = nil else count[cid] = math.min(500, getCount(msg)) npcHandler:say('So you would like me to change ' .. count[cid] .. ' of your crystal coins into ' .. count[cid] * 100 .. ' platinum coins for you?', cid) Topic[cid] = 16 end elseif Topic[cid] == 16 then if msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 2160, count[cid]) then npcHandler:say('Here you are.', cid) doPlayerAddItem(cid, 2152, count[cid] * 100) else npcHandler:say('Sorry, you do not have enough crystal coins.', cid) end else npcHandler:say('Well, can I help you with something else?', cid) end Topic[cid] = nil elseif msgcontains(msg, 'change') then npcHandler:say('There are three different coin types in Tibia: 100 gold coins equal 1 platinum coin, 100 platinum coins equal 1 crystal coin. So if you\'d like to change 100 gold into 1 platinum, simply say \'{change gold}\' and then \'1 platinum\'.', cid) Topic[cid] = nil elseif msgcontains(msg, 'bank') then npcHandler:say('We can change money for you. You can also access your bank account.', cid) Topic[cid] = nil end return true end npcHandler:setCallback(CALLBACK_GREET, greet) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())