Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.
                  'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA.
                                   Testado em OTX Server 8.60 & TFS 0.4 dev 3884.
                                                                       post-91471-0-40427600-1424547170.gif
 
Antes de começar, quero avisar às pessoas que estão sem tempo ou com preguiça de ler o tópico inteiro, que eu upei um zip do sistema inteiro. então é só baixar e instalar ai.
 
 
Continuando Tópico..
 
Cada ponto de Dodge equivale a x% de chance de desviar de um ataque, e ao mesmo tempo,
enviar um elemento compatível com o nível de dodge do jogador. Sobre o desvio, quase todo mundo já
conhece, mas e esse tal elemento?
 
Ao desviar do ataque, automaticamente o amuleto contra-ataca com um ataque de distância;
sua fonte de energia é o fist fighting, quanto mais alto for o skill, mais alto será o dano;
Cada amuleto possui seu próprio elemento e ele será a chave para o funcionamento do dodge,
ou seja, sem AMULET, sem Dodge.
 
1º - Procure a pasta Lib na sua datapack, crie um arquivo 151-dodgesystem.lua e dentro adicione isso :

--[[
   'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA by Ladyazaleia.
WhatsApp : (83) 9629-6394
Facebook : https://www.facebook.com/wustehs
  ]]  


DODGE_PERCENT   = 0.2 
DODGE_MAX      = 75
DODGE_PRICE    = 8000000
DODGE_ITEMID   = 12411
DODGE_COMMAND_REMOVE = true
DODGE_ONLY_PREMIUM   = false
DODGE_TEXT  = "DODGE"
DODGE_TEXTCOLOR  = 48


DODGE_FISTMULTIPLIER = true


DODGE_ELEMENTS = {
[COMBAT_EARTHDAMAGE]  = {type = COMBAT_EARTHDAMAGE,  multiplier = {min = 6, max =  8}, mana = 110, shoot  = 29},
[COMBAT_ICEDAMAGE]    = {type = COMBAT_ICEDAMAGE,    multiplier = {min = 5, max =  9}, mana = 100, shoot  = 36},
[COMBAT_ENERGYDAMAGE] = {type = COMBAT_ENERGYDAMAGE, multiplier = {min = 6, max =  8}, mana =  95, shoot  = 35},
[COMBAT_FIREDAMAGE]   = {type = COMBAT_FIREDAMAGE,   multiplier = {min = 4, max = 10}, mana = 125, shoot  =  3}
}




-------------------------------------------------------------------------------------------------------------------
function setDodgeElement(cid, value) return setPlayerStorageValue(cid, 74998, value) end
function getDodgeElement(cid) return getPlayerStorageValue(cid, 74998) end
function setDodgeAmuletStats(cid, value) return setPlayerStorageValue(cid, 74999, value) end
function getDodgeAmuletStats(cid) return getPlayerStorageValue(cid, 74999) end
function setDodgePoint(cid, value) return setPlayerStorageValue(cid, 75000, value) end
function getDodgePoint(cid) return getPlayerStorageValue(cid, 75000) end
function getDodgePercent(cid) return DODGE_PERCENT * getDodgePoint(cid) end


function getPercent(value)
if(not tonumber(value)) then
return error("(LuaInterface::luaGetPercent) Value not found")
end
return value >= math.random(DODGE_PERCENT, 100)
end


AMULET_USE_OFF   = 0
AMULET_USE_ON    = 1

 
2º- abra o arquivo actions.xml e adicione isso :
<action itemid="12411" event="script" value="dodge.lua"/>
3º- entre na pasta scripts em actions, crie um arquivo .lua chamado dodge e adicione isso :

--[[
   'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA by Ladyazaleia.
WhatsApp : (83) 9629-6394
Facebook : https://www.facebook.com/wustehs
  ]]  


function onUse(cid, item)


if(getDodgePoint(cid) < 0) then setDodgePoint(cid, 0) end
if(getDodgePoint(cid) >= DODGE_MAX) then return true end
if(not doPlayerRemoveItem(cid, DODGE_ITEMID, 1)) then return true end


setDodgePoint(cid, getDodgePoint(cid)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Dodge System : +1 ["..getDodgePoint(cid).."/"..DODGE_MAX.."]")
return true
end

 
4º- abra o arquivo creaturescripts.xml e adicione isso :
<event type="statschange" name="DodgeSystem" event="script" value="dodge.lua"/>
5º- entre na pasta scripts em creaturescripts, crie um arquivo .lua chamado dodge e adicione isso :

--[[
   'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA by Ladyazaleia.
WhatsApp : (83) 9629-6394
Facebook : https://www.facebook.com/wustehs
  ]]


function onStatsChange(cid, attacker, type, combat)


if(getDodgeAmuletStats(cid) ~= AMULET_USE_ON) then return true end
if(getDodgePercent(cid) < DODGE_PERCENT) then return true end
if(combat == COMBAT_HEALING) then return true end
if(not isCreature(attacker)) then return true end
if(DODGE_ONLY_PREMIUM and not isPremium(cid)) then return true end


local element = DODGE_ELEMENTS[getDodgeElement(cid)]
if(not element) then return true end


if(DODGE_FISTMULTIPLIER) then
multiplier = getPlayerSkillLevel(cid, SKILL_FIST)
else
multiplier = 1
end
if(getPercent(getDodgePercent(cid))) then
doSendAnimatedText(getThingPos(cid), DODGE_TEXT, DODGE_TEXTCOLOR)
if(getCreatureMana(cid) >= element.mana) then
doCreatureAddMana(cid, -element.mana)
doTargetCombatHealth(cid, attacker, element.type, -element.multiplier.min * multiplier, -element.multiplier.max * multiplier, nil)
doSendDistanceShoot(getThingPos(cid), getThingPos(attacker), element.shoot)
end
return false
end
return true
end

 
6º- ainda em creaturescripts, abra o arquivo login.lua e adicione isso la no final antes do return true :
registerCreatureEvent(cid, "DodgeSystem")
 
7º- abra o arquivo movements.xml, substitua isso :
OTX :

<movevent type="Equip" fromid="7887" toid="7890" level="60" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" fromid="7887" toid="7890" level="60" slot="necklace" event="function" value="onDeEquipItem"/>

 
TFS :

<movevent type="Equip" itemid="7887" slot="necklace" event="function" value="onEquipItem">
<vocation id="1"/>
<vocation id="5" showInDescription="0"/>
<vocation id="2"/>
<vocation id="6" showInDescription="0"/>
</movevent>
<movevent type="DeEquip" itemid="7887" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="7888" slot="necklace" event="function" value="onEquipItem">
<vocation id="1"/>
<vocation id="5" showInDescription="0"/>
<vocation id="2"/>
<vocation id="6" showInDescription="0"/>
</movevent>
<movevent type="DeEquip" itemid="7888" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="7889" slot="necklace" event="function" value="onEquipItem">
<vocation id="1"/>
<vocation id="5" showInDescription="0"/>
<vocation id="2"/>
<vocation id="6" showInDescription="0"/>
</movevent>
<movevent type="DeEquip" itemid="7889" slot="necklace" event="function" value="onDeEquipItem"/>
<movevent type="Equip" itemid="7890" slot="necklace" event="function" value="onEquipItem">
<vocation id="1"/>
<vocation id="5" showInDescription="0"/>
<vocation id="2"/>
<vocation id="6" showInDescription="0"/>
</movevent>
<movevent type="DeEquip" itemid="7890" slot="necklace" event="function" value="onDeEquipItem"/>

 
por isso :

<movevent type="Equip" itemid="7887-7890" slot="necklace" event="script" value="dodgeamulet.lua"/>
<movevent type="DeEquip" itemid="7887-7890" slot="necklace" event="script" value="dodgeamulet.lua"/>

 
8º - entre na pasta scripts em movements, crie um arquivo .lua chamado dodgeamulet e adicione isso :

--[[
   'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA by Ladyazaleia.
WhatsApp : (83) 9629-6394
Facebook : https://www.facebook.com/wustehs
  ]]  


local ITEM_ELEMENT = {
[7887] = {type =  COMBAT_EARTHDAMAGE},
[7888] = {type =  COMBAT_ICEDAMAGE},
[7889] = {type = COMBAT_ENERGYDAMAGE},
[7890] = {type =   COMBAT_FIREDAMAGE}
}


function onEquip(cid, item)


local element = ITEM_ELEMENT[item.itemid]
if(not element) then return true end


setDodgeElement(cid, element.type)
setDodgeAmuletStats(cid, AMULET_USE_ON)
return true
end


function onDeEquip(cid, item)
setDodgeAmuletStats(cid, AMULET_USE_OFF)
return true
end

 
 
9º- abra o arquivo talkactions.xml e adicione isso :
<talkaction log="yes" words="!dodge;/dodge" event="script" value="dodge.lua"/>
10º- entre na pasta scripts em talkactions, crie um arquivo .lua chamado dodge e adicione isso :

--[[
   'Dodge System 2015' versão com AMULETO & ELEMENTOS DE DEFESA by Ladyazaleia.
WhatsApp : (83) 9629-6394
Facebook : https://www.facebook.com/wustehs
  ]]  
  
local function getDodgeElementName(cid)


if(getDodgeAmuletStats(cid) ~= AMULET_USE_ON) then
name = "None"
return name
end


if(getDodgeElement(cid) == COMBAT_EARTHDAMAGE) then
name = "Earth"
elseif(getDodgeElement(cid) == COMBAT_ICEDAMAGE) then
name = "Ice"
elseif(getDodgeElement(cid) == COMBAT_ENERGYDAMAGE) then
name = "Energy"
elseif(getDodgeElement(cid) == COMBAT_FIREDAMAGE) then
name = "Fire"
end
return name
end


function onSay(cid, words, param)
if(getDodgePoint(cid) < 0) then
setDodgePoint(cid, 0)
end


if(param == "") then
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Dodge System 2015 :\n\nPoint(s) : ["..getDodgePoint(cid).."/"..DODGE_MAX.."] - "..getDodgePercent(cid).."%\nElement : "..getDodgeElementName(cid)..".")
end


if(string.lower(param) == "buy") then
if(doPlayerRemoveMoney(cid, DODGE_PRICE)) then
if(getPlayerStorageValue(cid, 75497) == -1) then
local FIRST_AMULET = 7887
doPlayerAddItem(cid, FIRST_AMULET, 1)
doPlayerSendTextMessage(cid, 22, "You gained your first "..getItemNameById(FIRST_AMULET)..".")
setPlayerStorageValue(cid, 75497, 1)
end
doPlayerAddItem(cid, DODGE_ITEMID, 1)
doSendMagicEffect(getThingPos(cid), 66)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have bought a "..getItemNameById(DODGE_ITEMID)..".")
else
doPlayerSendCancel(cid, "Sorry, you need of "..DODGE_PRICE - getPlayerMoney(cid).." gold coin(s).")
end
return true
end


if(DODGE_COMMAND_REMOVE) then
if(string.lower(param) == "remove") then
if(getDodgePoint(cid) > 0) then
setDodgePoint(cid, getDodgePoint(cid)-1)
doPlayerAddMoney(cid, DODGE_PRICE / 4 * 3)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Dodge System : -1 ["..getDodgePoint(cid).."/"..DODGE_MAX.."]")
else
doPlayerSendCancel(cid, "Sorry, you have 0 dodge point(s).")
end
return true
end
end
return true
end

 
 
no arquivo lib..
DODGE_PERCENT é os porcentos que o jogador ganhará por cada ponto adquirido;
DODGE_MAX é o máximo de dodge;
DODGE_PRICE é o preço de cada pedra;
DODGE_ITEMID é o ID da pedra de dodge;
DODGE_COMMAND_REMOVE é um comando para remover 1 ponto de dodge e receber 75% do dinheiro que você pagou pela pedra. true = comando disponível, false = comando inexistente;
DODGE_ONLY_PREMIUM é para jogadores com premium, true = o dodge só funcionará com premium, false = qualquer um poderá usar;
DODGE_TEXT é o texto que aparecerá quando o player desviar de um ataque;
DODGE_TEXTCOLOR é a cor do texto;
 
DODGE_FISTMULTIPLIER é para multiplicar o fist fighting do jogador pelo multiplier configurado. true = multiplica, false = os multipliers serão sempre os mesmos valores;
 
type é o tipo de elemento;
min é o hit mínimo;
max é o hit máximo;
mana é a quantidade de mana que precisa para contra-atacar com o elemento. se não tiver mana, só vai desviar;
shoot é o efeito de distância.
 
ID dos amulets : 
terra amulet      : 7887
glacier amulet    : 7888
lightning pendant : 7889
magma amulet      : 7890
 
comandos : !dodge; !dodge buy; !dodge remove.
 
caso você queira que o amulet mude de elemento ao dar use(estilo exp alta), abra o items.xml e substitua isso :

<item id="7887" article="a" name="terra amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="charges" value="200"/>
<attribute key="showcharges" value="1"/>
<attribute key="absorbPercentEarth" value="20"/>
<attribute key="absorbPercentFire" value="-10"/>
<attribute key="showattributes" value="1"/>
</item>
<item id="7888" article="a" name="glacier amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="charges" value="200"/>
<attribute key="showcharges" value="1"/>
<attribute key="absorbPercentIce" value="20"/>
<attribute key="absorbPercentEnergy" value="-10"/>
<attribute key="showattributes" value="1"/>
</item>
<item id="7889" article="a" name="lightning pendant">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="charges" value="200"/>
<attribute key="showcharges" value="1"/>
<attribute key="absorbPercentEnergy" value="20"/>
<attribute key="absorbPercentEarth" value="-10"/>
<attribute key="showattributes" value="1"/>
</item>
<item id="7890" article="a" name="magma amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="charges" value="200"/>
<attribute key="showcharges" value="1"/>
<attribute key="absorbPercentFire" value="20"/>
<attribute key="absorbPercentIce" value="-10"/>
<attribute key="showattributes" value="1"/>
</item>

 
por isso :

<item id="7887" article="a" name="terra amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="transformUseTo" value="7888"/>
</item>
<item id="7888" article="a" name="glacier amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="transformUseTo" value="7889"/>
</item>
<item id="7889" article="a" name="lightning pendant">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="transformUseTo" value="7890"/>
</item>
<item id="7890" article="a" name="magma amulet">
<attribute key="weight" value="500"/>
<attribute key="slotType" value="necklace"/>
<attribute key="transformUseTo" value="7887"/>
</item>

 
um exemplo do DODGE_FISTMULTIPLIER :
se estiver true, o jogador estiver com o 'magma amulet' e tiver 100 fist fighting, ele terá a chance de acertar um hit entre 400-1000 de dano;
se estiver false, ele só vai hitar entre 4-9 de dano, ai você vai ter que editar pra deixar mais alto, só que será o padrão; 
 
algumas imagens : 
 
Então pessoal, espero que tenham gostado da minha versão. Eu fiz ela do zero, peguei só a ideia
do Dodge System que vi em alguns Ots e mandei bala acrescentando esses elementos com amuleto.
 
créditos : Halls Santos & o criador do Dodge System, infelizmente não sei o nome dele. comentem ai que eu edito depois.

Editado por HallsSantos (veja o histórico de edições)

  • Respostas 7
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Obrigado danihcv por aprovar, irei postar mais conteúdos em breve.. Lyon, nos avise mesmo se ocorrer algum erro, eu retirei o máximo de bugs possíveis e testei duas vezes em cada servidor citado n

  • Excelente sistema!   Seu tutorial foi aprovado. você recebeu um ponto de reputação e o tópico será movido para a área correta.   Esperamos mais conteúdos como este.

  • Obrigado leonardo

Posted Images

Postado

Excelente sistema!

 

Seu tutorial foi aprovado. você recebeu um ponto de reputação e o tópico será movido para a área correta. :accept:

 

Esperamos mais conteúdos como este. ^^

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado

Cara não testei ainda,mas ja reputei,huehue 

Depois vou testar,muito show o sistema,qualquer erro posto aqui depois,grato por compartilhar com a comunidade do TK.

Postado
  • Autor

Obrigado danihcv por aprovar, irei postar mais conteúdos em breve..

Lyon, nos avise mesmo se ocorrer algum erro, eu retirei o máximo de bugs possíveis e testei duas vezes em cada servidor citado no começo do tópico rs. :)

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo