-Muitas pessoas devem querer as insignias no Ot Client, eu estava procurando na net e achei esse sistema, fui logo colocar no meu Ot Client, porém deu erro e fui caçar o erro...está 100% funcional, bora começar?
1º Edições no server:
Vá em: talkactions/scripts...crie um arquivo lua com o nome: talkGym.lua: e coloque isso dentro do arquivo:
function onSay(cid, words, param)
if gymbadges[param] then
doPlayerSendCancel(cid, "#getBadges# "..param.." "..getPlayerItemCount(cid, gymbadges[param]))
end
return true
end
Em Xml:
<talkaction words="#getGym#" event="script" value="talkGym.lua"/>
PARA QUEM QUISER QUE ATUALIZE NA HORA QUE GANHAR O GYM
npc/scripts/todos os npcs de gym:
doPlayerSendCancel(cid, "#getBadges# "..getCreatureName(this).." "..getPlayerItemCount(cid, gymbadges[getCreatureName(this)]))
Embaixo dessa linha
if b.uid > 0 then doTransformItem(b.uid, b.itemid - 8) end
Ficando assim:
local function doWinDuel(cid, npc)
if not isCreature(cid) then return true end
local this = npc
local a = gymbadges[getCreatureName(this)] + 8
doCreatureSay(npc, "You won the duel! Congratulations, take this "..getItemNameById(a - 8).." as a prize.", 1)
local b = getPlayerItemById(cid, true, a)
if b.uid > 0 then doTransformItem(b.uid, b.itemid - 8) end
doPlayerSendCancel(cid, "#getBadges# "..getCreatureName(this).." "..getPlayerItemCount(cid, gymbadges[getCreatureName(this)]))
end
No server é apenas isso, agora vamos em: Otclient>modules>game_skills:
Skills Otui:
Em baixo de tudo la em ultimo coloque
SkillButton
id: pokeGym
size: 143 69
margin-top: 8
UIButton
id: gymBrock
size: 32 32
anchors.top: parent.top
anchors.right: parent.right
margin-right: 120
UIButton
id: gymMisty
anchors.top: gymBrock.top
anchors.left: gymBrock.right
margin-left: 3
UIButton
id: gymSurge
anchors.top: gymBrock.top
anchors.left: gymMisty.right
margin-left: 3
UIButton
id: gymErika
anchors.top: gymBrock.top
anchors.left: gymSurge.right
margin-left: 3
UIButton
id: gymSabrina
anchors.top: gymBrock.bottom
anchors.left: gymBrock.left
margin-top: 6
UIButton
id: gymKoga
anchors.top: parent.top
anchors.top: gymBrock.bottom
anchors.left: gymMisty.left
margin-top: 6
UIButton
id: gymBlaine
anchors.top: parent.top
anchors.top: gymBrock.bottom
anchors.left: gymSurge.left
margin-top: 6
UIButton
id: gymKira
anchors.top: parent.top
anchors.top: gymBrock.bottom
anchors.left: gymErika.left
margin-top: 6
Skills.Lua:
Inicio do Script:
local gyms = {
["Brock0"] = "/images/game/pokemon/clan/brock", ---- terminados em 0 apagado, terminados em 1 aceso
["Brock1"] = "/images/game/pokemon/clan/brock",
["Misty0"] = "/images/game/pokemon/clan/misty",
["Misty1"] = "/images/game/pokemon/clan/misty",
["Surge0"] = "/images/game/pokemon/clan/surge",
["Surge1"] = "/images/game/pokemon/clan/surge",
["Erika0"] = "/images/game/pokemon/clan/erika",
["Erika1"] = "/images/game/pokemon/clan/erika",
["Sabrina0"] = "/images/game/pokemon/clan/sabrina",
["Sabrina1"] = "/images/game/pokemon/clan/sabrina",
["Koga0"] = "/images/game/pokemon/clan/koga",
["Koga1"] = "/images/game/pokemon/clan/koga",
["Blaine0"] = "/images/game/pokemon/clan/blaine",
["Blaine1"] = "/images/game/pokemon/clan/blaine",
["Kira0"] = "/images/game/pokemon/clan/kira",
["Kira1"] = "/images/game/pokemon/clan/kira",
}
Em baixo de:
connect(g_game, {
onGameStart = refresh,
onGameEnd = offline
})
Coloque:
connect(g_game, 'onTextMessage', getGym)
Ficando:
connect(g_game, {
onGameStart = refresh,
onGameEnd = offline
})
connect(g_game, 'onTextMessage', getGym)
Em baixo de:
g_keyboard.unbindKeyDown('Ctrl+S')
skillsWindow:destroy()
skillsButton:destroy()
end
Coloque:
function autoUpdateTalks()
local player = g_game.getLocalPlayer()
if not player then return end
----------
g_game.talk("#getGym# Brock")
g_game.talk("#getGym# Misty")
g_game.talk("#getGym# Surge")
g_game.talk("#getGym# Erika")
g_game.talk("#getGym# Sabrina")
g_game.talk("#getGym# Koga")
g_game.talk("#getGym# Blaine")
g_game.talk("#getGym# Kira")
----------
end
function getGym(mode, text)
local t = string.explode(text, " ")
local badges = skillsWindow:recursiveGetChildById("gym"..t[2])
if not g_game.isOnline() then return end
if mode == MessageModes.Failure then
if text:find("#getBadges#") then
badges:setImageSource(gyms[t[2]..""..tonumber(t[3])])
end
end
end
Ficando:
g_keyboard.unbindKeyDown('Ctrl+S')
skillsWindow:destroy()
skillsButton:destroy()
end
function autoUpdateTalks()
local player = g_game.getLocalPlayer()
if not player then return end
----------
g_game.talk("#getGym# Brock")
g_game.talk("#getGym# Misty")
g_game.talk("#getGym# Surge")
g_game.talk("#getGym# Erika")
g_game.talk("#getGym# Sabrina")
g_game.talk("#getGym# Koga")
g_game.talk("#getGym# Blaine")
g_game.talk("#getGym# Kira")
----------
end
function getGym(mode, text)
local t = string.explode(text, " ")
local badges = skillsWindow:recursiveGetChildById("gym"..t[2])
if not g_game.isOnline() then return end
if mode == MessageModes.Failure then
if text:find("#getBadges#") then
badges:setImageSource(gyms[t[2]..""..tonumber(t[3])])
end
end
end
Em baixo de:
function refresh()
local player = g_game.getLocalPlayer()
if not player then return end
Coloque:
autoUpdateTalks()
Ficando:
function refresh()
local player = g_game.getLocalPlayer()
if not player then return end
autoUpdateTalks()
Espero que gostem.
PS: O erro que dava no meu era que não aparecia a opção skills no OTC.
Créditos:
Noninhouh