Postado Julho 28, 2024 Jul 28 .Qual servidor ou website você utiliza como base? Estou utilizando a versão mais recente do Canary (3.1.2) https://github.com/opentibiabr/canary Qual o motivo deste tópico? Estou tentando criar novas vocações porem não estou conseguindo. Só estou tendo um erro que esta descrito abaixo. O resto do meu vocations.xml está padrão e funcionando perfeitamente então só compartilhei a parte do código referente ao exemplo de uma das novas classe que estou tentando adicionar. Edit: Consegui progredir um pouco fazendo algumas alterações na src. Testei criar IDs próprios para a nova vocação mas isso resultava no client crashando então tentei usar os IDs das vocações já existentes e consegui "criar" a nova vocação sem problemas. Ainda não cheguei na parte das magias pois agora consigo logar com a nova vocação mas estou tendo um erro porque o script "send_first_items.lua" aparentemente não reconhece e nova vocação. Adicionei a nova novação logo abaixo do Knight que é a ultima vocação do script. Os trechos de códigos abaixo são apenas as partes alteradas e aparentemente relevantes ao problema. Está surgindo algum erro? Se sim coloque-o aqui. Citar Interface: Scripts Interface Script ID: C:\canary\data/scripts\creaturescripts\player\send_first_items.lua Error Description: ...data/scripts\creaturescripts\player\send_first_items.lua:103: table index is nil stack traceback: [C]: in function '__newindex' ...data/scripts\creaturescripts\player\send_first_items.lua:103: in main chunk Você tem o código disponível? Se tiver publique-o aqui: C:\canary\src\creatures\creatures_definitions.hpp enum Vocation_t : uint16_t { VOCATION_NONE = 0, VOCATION_SORCERER = 1, VOCATION_DRUID = 2, VOCATION_PALADIN = 3, VOCATION_KNIGHT = 4, VOCATION_MASTER_SORCERER = 5, VOCATION_ELDER_DRUID = 6, VOCATION_ROYAL_PALADIN = 7, VOCATION_ELITE_KNIGHT = 8, VOCATION_WARRIOR = 9, VOCATION_LAST = VOCATION_WARRIOR, // Cip tibia client ids VOCATION_KNIGHT_CIP = 1, VOCATION_PALADIN_CIP = 2, VOCATION_SORCERER_CIP = 3, VOCATION_DRUID_CIP = 4, VOCATION_WARRIOR_CIP = 1, }; C:\canary\src\creatures\players\player.cpp uint16_t Player::getPlayerVocationEnum() const { int cipTibiaId = getVocation()->getClientId(); if (cipTibiaId == 1 || cipTibiaId == 11) { return Vocation_t::VOCATION_KNIGHT_CIP; // Knight } else if (cipTibiaId == 2 || cipTibiaId == 12) { return Vocation_t::VOCATION_PALADIN_CIP; // Paladin } else if (cipTibiaId == 3 || cipTibiaId == 13) { return Vocation_t::VOCATION_SORCERER_CIP; // Sorcerer } else if (cipTibiaId == 4 || cipTibiaId == 14) { return Vocation_t::VOCATION_DRUID_CIP; // Druid } else if (cipTibiaId == 1 || cipTibiaId == 11) { return Vocation_t::VOCATION_WARRIOR_CIP; // Warrior } return Vocation_t::VOCATION_NONE; } C:\canary\data\XML\vocations.xml <vocation id="9" clientid="1" baseid="1" name="Warrior" description="a warrior" magicshield="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="6000" gainhpamount="1" gainmanaticks="6000" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" basespeed="110" soulmax="100" gainsoulticks="120000" fromvoc="9" avatarlooktype="1593"> <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" /> <mitigation multiplier="1.3" primaryShield="2.05" secondaryShield="1.25" /> <pvp damageReceivedMultiplier="1.0" damageDealtMultiplier ="1.0"/> <skill id="0" multiplier="1.1" /> <skill id="1" multiplier="1.1" /> <skill id="2" multiplier="1.1" /> <skill id="3" multiplier="1.1" /> <skill id="4" multiplier="1.4" /> <skill id="5" multiplier="1.1" /> <skill id="6" multiplier="1.1" /> </vocation> C:\canary\data\scripts\creaturescripts\player\send_first_items.lua [VOCATION.ID.WARRIOR] = { items = { { 3425, 1 }, -- dwarven shield { 7773, 1 }, -- steel axe { 3359, 1 }, -- brass armor { 3354, 1 }, -- brass helmet { 3372, 1 }, -- brass legs { 3552, 1 }, -- leather boots { 3572, 1 }, -- scarf }, container = { { 7774, 1 }, -- jagged sword { 3327, 1 }, -- daramanian mace { 3003, 1 }, -- rope { 5710, 1 }, -- light shovel { 266, 10 }, -- health potion }, }, Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
Postado Setembro 29, 2024 Set 29 data/libs/functions/player.lua function Player.isSorcerer(self) return table.contains({VOCATION.ID.SORCERER, VOCATION.ID.MASTER_SORCERER}, self:getVocation():getId()) end function Player.isDruid(self) return table.contains({VOCATION.ID.DRUID, VOCATION.ID.ELDER_DRUID}, self:getVocation():getId()) end function Player.isKnight(self) return table.contains({VOCATION.ID.KNIGHT, VOCATION.ID.ELITE_KNIGHT}, self:getVocation():getId()) end function Player.isPaladin(self) return table.contains({VOCATION.ID.PALADIN, VOCATION.ID.ROYAL_PALADIN}, self:getVocation():getId()) end function Player.isMage(self) return table.contains({VOCATION.ID.SORCERER, VOCATION.ID.MASTER_SORCERER, VOCATION.ID.DRUID, VOCATION.ID.ELDER_DRUID}, self:getVocation():getId()) end function Player.isWarrior(self) return table.contains({VOCATION.ID.WARRIOR }, self:getVocation():getId()) end Isso não era para existir: return Vocation_t::VOCATION_WARRIOR_CIP; // Warrior } Isso acho que é para estar assim: enum Vocation_t : uint16_t { VOCATION_NONE = 0, VOCATION_SORCERER = 1, VOCATION_DRUID = 2, VOCATION_PALADIN = 3, VOCATION_KNIGHT = 4, VOCATION_MASTER_SORCERER = 5, VOCATION_ELDER_DRUID = 6, VOCATION_ROYAL_PALADIN = 7, VOCATION_ELITE_KNIGHT = 8, VOCATION_WARRIOR = 9, VOCATION_LAST = VOCATION_WARRIOR, // Cip tibia client ids VOCATION_KNIGHT_CIP = 1, VOCATION_PALADIN_CIP = 2, VOCATION_SORCERER_CIP = 3, VOCATION_DRUID_CIP = 4, VOCATION_WARRIOR_CIP = 0 }; Editado Setembro 29, 2024 Set 29 por vasconcellos (veja o histórico de edições)
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.