Postado Junho 2, 2015 10 anos Segui esse tutorial de OPCodes 8.54 "http://www.tibiaking.com/forum/topic/33159-c-opcode-vers%C3%A3o-854/", mas agora nao faço ideia do que eu preciso fazer por exemplo, na imagem abaixo mostra minha barra de atributos, nos botões esta tudo OK!, eu clico e aumenta pontos, mas ao invés de eu ter que clicar em points avaiable eu queria que isso ja fica-se ali em "My Points" que por exemplo seria os pontos que ainda restam para distribuir e também na frente de cada atributos mostra-se a quantidades de pontos que eu ja distribui... eu sei que precisa dos OPCodes eu consegui implantar no servidor e agora? o que eu coloco no cliente para aparecer essas informações? Café é bom :3
Postado Junho 4, 2015 10 anos Autor Qual código ? -------------------------------------------------------------- [EDIT]Vou passar os códigos mais importantes... Primeiro a Barra de Atributos no OTC: barra.lua: AtributosWindow = nil AtributosPanel = nil AtributosButton = nil function init() AtributosButton = modules.client_topmenu.addRightGameToggleButton('AtributosButton', tr('Atributos'), 'atributos.png', toggle) AtributosButton:setOn(false) AtributosWindow = g_ui.displayUI('battle.otui') connect(g_game, { onGameStart = online, onGameEnd = offline}) g_keyboard.bindKeyDown('Ctrl+D', toggle) AtributosPanel = AtributosWindow:getChildById('contentsPanel') if not g_game.isOnline() then AtributosWindow:hide() end if AtributosButton:isOn() then AtributosWindow:hide() AtributosButton:setOn(false) else AtributosWindow:hide() AtributosButton:setOn(false) end end function terminate() disconnect(g_game, { onGameStart = online, onGameEnd = offline}) AtributosPanel:destroy() AtributosButton:destroy() AtributosWindow:destroy() end function toggle() if AtributosButton:isOn() then AtributosWindow:hide() AtributosButton:setOn(false) else AtributosWindow:show() AtributosButton:setOn(true) end end barra.otui: MainWindow id: AtributosWindow !text: tr('Status') size: 180 260 &save: true Label id: Label0 !text: tr ('My Points 0') anchors.top: parent.top anchors.left: parent.left margin-top: 5 margin-left: 5 Label id: Label1 !text: tr ('STR 10') anchors.top: Label0.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddSword !text: tr ('+') size: 30 20 anchors.top: Label1.top anchors.right: parent.right @onClick: g_game.talk('!points add, sword, 1') Label id: Label2 !text: tr ('DEF 10') anchors.top: Label1.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddShielding !text: tr ('+') anchors.top: Label2.top anchors.right: parent.right size: 30 20 @onClick: g_game.talk('!points add, shielding, 1') Label id: Label3 !text: tr ('DEX 10') anchors.top: Label2.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddDodge !text: tr ('+') anchors.top: Label3.top anchors.right: parent.right size: 30 20 @onClick: g_game.talk('!points add, dodge, 1') Label id: Label4 !text: tr ('AGI 10') anchors.top: Label3.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddSpeed !text: tr ('+') anchors.top: Label4.top anchors.right: parent.right size: 30 20 @onClick: g_game.talk('!points add, speed, 1') Label id: Label5 !text: tr ('VIT 10') anchors.top: Label4.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddVitality !text: tr ('+') anchors.top: Label5.top anchors.right: parent.right size: 30 20 @onClick: g_game.talk('!points add, vitalidade, 1') Label id: Label6 !text: tr ('ML 10') anchors.top: Label5.top anchors.left: parent.left margin-top: 25 margin-left: 5 Button id: AddMagic !text: tr ('+') anchors.top: Label6.top anchors.right: parent.right size: 30 20 @onClick: g_game.talk('!points add, magic, 1') Button id: ResetBuild !text: tr ('Points Avaiable') anchors.top: Label6.top anchors.left: parent.left size: 150 40 @onClick: g_game.talk('!points check') margin-top: 25 Agora na parte do servidor: na Lib: -- ####################################### -- ####### Developed by MaXwEllDeN ####### -- ####### Level Points System ####### -- ####### Version: 1.0 ####### -- ####################################### L_LvlPoints = { vocPoints = { -- [skill] = Pontos que ganha, [1] = 3, [2] = 3, [3] = 3, [4] = 5, [5] = 5, [6] = 5, [7] = 5, [8] = 8, }, attributes = { ["vitalidade"] = {np = 1, vl = 5, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp ["energy"] = {np = 1, vl = 2, nm = "Mana Points"}, ["magic"] = {np = 1, vl = 1, nm = "Magic Level"}, ["shielding"] = {np = 40, vl = 1, nm = "Shielding Skill"}, ["sword"] = {np = 1, vl = 1, nm = "Sword Skill"}, ["dodge"] = {np = 1, vl = 1, nm = "Axe Skill"}, ["club"] = {np = 1, vl = 1, nm = "Club Skill"}, ["speed"] = {np = 1, vl = 1, nm = "Distance Skill"}, } } no creaturescripts: -- ####################################### -- ####### Developed by MaXwEllDeN ####### -- ####### Level Points System ####### -- ####### Version: 1.0 ####### -- ####################################### local VocPoints = L_LvlPoints.vocPoints function onAdvance(cid, skill, oldlevel, newlevel) if not (VocPoints[getPlayerVocation(cid)]) then return true end if skill == 8 and getPlayerStorageValue(cid, 14573) < newlevel then if (getPlayerStorageValue(cid, 14574) < 0) then setPlayerStorageValue(cid, 14574, 0) setPlayerStorageValue(cid, 14573, 0) end setPlayerStorageValue(cid, 14573, newlevel) setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) + (newlevel - oldlevel) * (VocPoints[getPlayerVocation(cid)])) doSendAnimatedText(getThingPos(cid), "+" .. (newlevel - oldlevel) * (VocPoints[getPlayerVocation(cid)]), 18) end return true end e no talkactions: -- ####################################### -- ####### Developed by MaXwEllDeN ####### -- ####### Level Points System ####### -- ####### Version: 1.0 ####### -- ####################################### function onSay(cid, words, param) if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then return false end local param = param:lower() local p2 = string.explode(param, ",") if (getPlayerStorageValue(cid, 14574) < 0) then setPlayerStorageValue(cid, 14574, 0) end local skillids = { ["shielding"] = 5, ["sword"] = 2, ["axe"] = 3, ["club"] = 1, ["distance"] = 4 } if (param == "check") then doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)]) elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!") return doSendMagicEffect(getThingPos(cid), 2) end if (p2[2] == "vitalidade") then setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) elseif (p2[2] == "energy") then setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3])) elseif(skillids[p2[2]]) then for a = 1, tonumber(p2[3]) do doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false) end end doSendMagicEffect(getThingPos(cid), 29) doSendMagicEffect(getThingPos(cid), 30) doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180) setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) else local msgx = "" for i, v in pairs(L_LvlPoints.attributes) do local add = (v.np > 1) and "s" or "" msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n" end doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574)) end return true end Acredito que passei o necessário. Editado Junho 4, 2015 10 anos por MateusDomingues (veja o histórico de edições) Café é bom :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.