Postado Julho 25, 2014 10 anos Galera, estou fazendo um OT de War de 2 times. Eu consegui colocar uma punição coso o cara mate o player do próprio time(mesmo lugar que nasce) . O problema é que mesmo com a punição o player ainda ganha um Frag e a Recompensa que todos ganha por matar. Meu pedido é que, se o player mate alguém do mesmo time(lugar que nasce(Town)), então eles não ganhe nem o Frag e nem a recompensa. Eu, poderia procurar tirar o PVP de pessoas do mesmo time, mas eu quero que fique mais real e menos No-PVP. Mas se ninguém souber como fazer essa primeira proposta, então me ajuda a tirar o PVP do mesmo time. Vou colocar o código do "deathBroadcast" pra vocês analisarem. local config = { affected = 10, -- quantos jogadores (deathAssits) da tabela Deathlist este script deve ser executado para? killStorageValue = 3943, deathStorageValue = 3944, -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME rewardItem = { use = true, itemid = 2160, minLevel = false, -- false if you don't want any level req minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed). }, killMessage = { use = true, text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!", messageClass = MESSAGE_STATUS_CONSOLE_BLUE }, broadcastMessage = { use = false, minLevel = false, -- false if you don't want any level req minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed). text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!", messageClass = MESSAGE_STATUS_WARNING }, killerAnimation = { use = true, text = "Frag!", -- Only 9 letters! No "commands" here. color = 144 }, targetAnimation = { use = true, text = "OWNED!!", -- Only 9 letters! No "commands" here. color = 180 } } function onDeath(cid, corpse, deathList) for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do local killer = deathList[i] if((isPlayer(killer) == TRUE) ) then local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1 local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1 local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1 local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1 setPlayerStorageValue(killer, config.killStorageValue, targetKills) setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths) local killerLevel = getPlayerLevel(killer) local targetLevel = getPlayerLevel(cid) local levelDiff = targetLevel - killerLevel local values = { ["KILLERKILLS"] = killerKills, ["KILLERDEATHS"] = killerDeaths, ["KILLERNAME"] = getCreatureName(killer), ["KILLERLEVEL"] = killerLevel, ["TARGETKILLS"] = targetKills, ["TARGETDEATHS"] = targetDeaths, ["TARGETNAME"] = getCreatureName(cid), ["TARGETLEVEL"] = targetLevel } function formateString(str) return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end))) end if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1) end if(config.killMessage.use) then doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text)) end if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass) end if(config.killerAnimation.use) then doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color) end if(config.targetAnimation.use) then doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color) end end end return true end Na linha 10, tem o ID do itens da recompensa que é um Crystal coin, e na linha 77 diz quando crystals coins vou ganhar se killar alguém que nesse caso é 1. Eu quero é mudar isso, para se os player forem do mesmo time, eles não ganharão nada (nem frag, nem itens). Eu consegui punir as pessoas que matam o mesmo time com dano no life, na mana e na experiência. no arquivo onkill.lua o código ficou assim: function onKill(cid, target, lastHit) if cid ~= target and isPlayer(target) then if getPlayerTown(cid) == getPlayerTown(target) then doCreatureAddHealth(cid, -200) doCreatureAddMana(cid, -200) doPlayerAddExperience(cid, -500000) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Punido por ter matado player do mesmo time!!') else doSendAnimatedText(getPlayerPosition(cid), "Orgasmic~", 198) end end return true end Se de alguma mandei, eu pudesse, desse arquivo, diminuir a quantidade de kill e recompensa,do jogador que matou o mesmo time, seria legal. tipo assim doCreatureAddFrag(cid, -1) . Dai, o que ele fosse ganhar do outro script, ele já teria perdido nesse. Obrigado desde já, espero que possam me ajudar!
Postado Julho 26, 2014 10 anos O tópico foi movido para a área correta, preste mais atenção da próxima vez! Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680 Este tópico foi movido: De: "OTServ → Scripting → CreatureScripts, GlobalEvents e MoveMents" Para: "OTServ → Suporte OTServ → Suporte de Scripts" STYLLER OT 2022
Postado Julho 26, 2014 10 anos substitui o primeiro script por esse aqui.. eu adicionei uma checagem de ver se são dos mesmos times antes de dar o storage local config = { affected = 10, -- quantos jogadores (deathAssits) da tabela Deathlist este script deve ser executado para? killStorageValue = 3943, deathStorageValue = 3944, -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME rewardItem = { use = true, itemid = 2160, minLevel = false, -- false if you don't want any level req minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed). }, killMessage = { use = true, text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!", messageClass = MESSAGE_STATUS_CONSOLE_BLUE }, broadcastMessage = { use = false, minLevel = false, -- false if you don't want any level req minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed). text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!", messageClass = MESSAGE_STATUS_WARNING }, killerAnimation = { use = true, text = "Frag!", -- Only 9 letters! No "commands" here. color = 144 }, targetAnimation = { use = true, text = "OWNED!!", -- Only 9 letters! No "commands" here. color = 180 } } function onDeath(cid, corpse, deathList) for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do local killer = deathList[i] if((isPlayer(killer) == TRUE) and (getPlayerTown(cid) ~= getPlayerTown(killer))) then local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1 local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1 local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1 local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1 setPlayerStorageValue(killer, config.killStorageValue, targetKills) setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths) local killerLevel = getPlayerLevel(killer) local targetLevel = getPlayerLevel(cid) local levelDiff = targetLevel - killerLevel local values = { ["KILLERKILLS"] = killerKills, ["KILLERDEATHS"] = killerDeaths, ["KILLERNAME"] = getCreatureName(killer), ["KILLERLEVEL"] = killerLevel, ["TARGETKILLS"] = targetKills, ["TARGETDEATHS"] = targetDeaths, ["TARGETNAME"] = getCreatureName(cid), ["TARGETLEVEL"] = targetLevel } function formateString(str) return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end))) end if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 1) end if(config.killMessage.use) then doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text)) end if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass) end if(config.killerAnimation.use) then doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color) end if(config.targetAnimation.use) then doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color) end end end return true end Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
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.