Eawe meu povo,Estou precisando de um script q ao usar um certo iten por 5 horas este iten se desgasta e volta ao normal(ou seja voltando a outro iten)
queria q este iten aumentasse 800 de hp a cada 5 segundos.
agradeço desde ja a sua cooperaçao
help plis :S
Acho que isso deve resolver, altere os ids dos itens conforme suas necessidades...
OBS: Veja que dentro dos CODES, possui uns comentários entre <!-- --> para que você entenda melhor.
Neste caso, você deverá alterar os itens abaixo para que não dê duplicidade de id, então vá para OT\data\items.xml e altere o código da leather boots, patched boots e sandals conforme abaixo:
Item inicial (leather boots):
<item id="2346" article="a" name="pair of leather boots"> <!-- id do item e nome do item (neste caso a leather boots) --> <attribute key="weight" value="800" /> <!-- peso do item 8 oz. --> <attribute key="slotType" value="feet" /> <!-- slot onde o item será equipado, neste caso nos pés --> <attribute key="transformEquipTo" value="2641" /> <!-- id do item que se transformará após equipa-lo --> <attribute key="stopduration" value="1" /> <!-- sei lá, acho que é pra verificar se vai acabar a duração (PLEONASMO PLS)... deixa assim --> <attribute key="showduration" value="1" /> <!-- mostrar duração do item sim=1, não=0 --> </item>
Item após equipar (patched boots):
<item id="2641" article="a" name="pair of patched boots"> <!-- id do item que se transformará após ser equipado (neste caso a patched boots) --> <attribute key="weight" value="800" /> <!-- peso do item 8 oz. --> <attribute key="slotType" value="feet" /> <!-- slot onde o item será equipado, neste caso nos pés --> <attribute key="decayTo" value="2642" /> <!-- item que se transformará após acabar a duração (neste caso a sandals) --> <attribute key="transformDeEquipTo" value="2346" /> <!-- item que se transformará após retirar dos pés, ou seja, volta para o item antes de equipar (neste caso a leather boots novamente) --> <attribute key="duration" value="18000" /> <!-- duração de 5 horas --> <attribute key="healthGain" value="800" /> <!-- ganha 800 de hp --> <attribute key="healthTicks" value="5000" /> <!-- a cada 5 segundos --> <attribute key="showduration" value="1" /> <!-- mostrar duração do item? sim=1, não=0 --> </item>
Item após a duração acabar (sandals):
<item id="2642" article="a" name="pair of sandals"> <!-- id do item que se transformará após acabar a duração (neste caso a sandals) --> <attribute key="description" value="Someone specialised in shoes might be able to repair them for you." /> <!-- descrição do item (mensagem que aparecerá quando o player der look no item) --> <attribute key="weight" value="800" /> <!-- peso do item 8 oz. --> </item>
Agora vá em OT\data\movements.xml e adicione as linhas abaixo:
<movevent type="Equip" itemid="2346" slot="feet" event="function" value="onEquipItem"/> <movevent type="DeEquip" itemid="2346" slot="feet" event="function" value="onDeEquipItem"/> <movevent type="Equip" itemid="2641" slot="feet" event="function" value="onEquipItem"/> <movevent type="DeEquip" itemid="2641" slot="feet" event="function" value="onDeEquipItem"/> <movevent type="Equip" itemid="2642" slot="feet" event="function" value="onEquipItem"/> <movevent type="DeEquip" itemid="2642" slot="feet" event="function" value="onDeEquipItem"/>
Você também precisará de um NPC para recarregar a bota, segue um script de NPC:
Em OT\data\npc copie e cole qualquer arquivo e renomeie para botas.xml e cole o script abaixo:
<npc name="Especialista em botas" script="data/npc/scripts/bota.lua" access="5" lookdir="1">
<health now="1000" max="1000"/>
<look type="133" head="95" body="86" legs="86" feet="38" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|.I've been working hard these days in this project, I can now repair your dear friend {boots}." />
</parameters>
</npc>
Agora em OT\data\npc\scripts copie e cole qualquer arquivo e renomeie para botas.lua e cole o script abaixo:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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() endfunction creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cidif(msgcontains(msg, 'patched') or msgcontains(msg, 'boots')) then
selfSay('Do you want to repair your worn patched boots for 20000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 2642) >= 1) then -- id da sandals
if(doPlayerRemoveMoney(cid, 20000) == TRUE) then
doPlayerRemoveItem(cid, 2642, 1) -- id da sandals
doPlayerAddItem(cid, 2643) -- id da leather boots
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
endnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
E a propósito... você escreveu simix lá no titulo do tópico, mas o correto é SmiX (meu herói). ![]()


info
Grupo: Campones
Registrado: 04/12/12
Posts: 44
Reputação: 0
Eawe meu povo,Estou precisando de um script q ao usar um certo iten por 5 horas este iten se desgasta e volta ao normal(ou seja voltando a outro iten)
queria q este iten aumentasse 800 de hp a cada 5 segundos.
agradeço desde ja a sua cooperaçao
help plis :S