Postado Setembro 22, 2015 9 anos Estou precisando de um item que multiplique a exp ganhe pelo player ao Usar/Equipar um item, pode ser uma potion, um ring... Eu ja testei todas as possibilidades que postaram aqui, mas todas falham, a maioria da erro de Method onGainExperience.... Me ajudem Plx. -- Att,Lucas Soledade Desenvolvedor de Servidores Inovação -> Colossus Server <-
Postado Setembro 24, 2015 9 anos Autor Solução TFS 1.0. Seguinte, eu consegui usar um Script que funcionou, porem estou com um probleminha. O Anel não desequipa. Item.xml <item id="7697" article="a" name="experience ring"> <attribute key="weight" value="80" /> <attribute key="slotType" value="ring" /> <attribute key="absorbPercentAll" value="5" /> <attribute key="skillShield" value="5" /> <attribute key="speed" value="25" /> <attribute key="healthGain" value="150" /> <attribute key="healthTicks" value="1000" /> <attribute key="manaGain" value="100" /> <attribute key="manaTicks" value="1000" /> <attribute key="armor" value="2" /> <attribute key="magiclevelpoints" value="2" /> <attribute key="transformEquipTo" value="7708" /> <attribute key="stopduration" value="1" /> <attribute key="showduration" value="1" /> </item> <item id="7708" article="a" name="experience ring"> <attribute key="weight" value="80" /> <attribute key="description" value="This ring increases the extra experience." /> <attribute key="slotType" value="ring" /> <attribute key="decayTo" value="0" /> <attribute key="transformDeEquipTo" value="7697" /> <attribute key="duration" value="64800" /> <attribute key="absorbPercentAll" value="5" /> <attribute key="skillShield" value="5" /> <attribute key="speed" value="25" /> <attribute key="healthGain" value="150" /> <attribute key="healthTicks" value="1000" /> <attribute key="manaGain" value="100" /> <attribute key="manaTicks" value="1000" /> <attribute key="armor" value="2" /> <attribute key="magiclevelpoints" value="2" /> <attribute key="showduration" value="1" /> </item> Movements.xml <movevent event="Equip" itemid="7708" slot="ring" script="expring.lua"/> <movevent event="DeEquip" itemid="7708" slot="ring" script="expring.lua"/> <movevent event="Equip" itemid="7697" slot="ring" function="onEquipItem"/> <movevent event="DeEquip" itemid="7697" slot="ring" function="onDeEquipItem"/> expring.lua function onEquip(cid, item, slot) local player = Player(cid) player:sendTextMessage(19, '[Exp-Ring] Voce Agora Recebera uma Experiencia extra ao matar monstros. Aproveite!') player:setStorageValue(45454, 1) return true end function onDeEquip(cid, item, slot) local player = Player(cid) player:sendTextMessage(19, '[Exp-Ring] Experiencia extra cancelada.') player:setStorageValue(45454, -1) return true end creaturescripts.xml [Foi Adicionada no arquivo login.lua] <event type="kill" name="Exp_Extra" script="exptest.lua"/> exptest.lua local rate = 100 --- porcentagem que irá ganhar a mais. function onKill(cid, target, lastHit) --if isPremium(cid) then if (getPlayerStorageValue(cid, 45454) >= 1) then local monster = Monster(target) if not monster then return true end for id, damage in pairs(monster:getDamageMap()) do local player = Player(id) if player then local experience = damage.total / monster:getType():getHealth() * monster:getType():getExperience() local expFormula = (((experience * Game.getExperienceStage(player:getLevel())) / 100) * rate) player:addExperience(math.floor(expFormula), true) end end end return true end Por favor me ajudem. Estou há 3 dias nesta labuta. Onde cheguei mais perto foi com estes scripts ai que fui reformulando até obter resultados. Não da erro nenhum no Log, mas o ring não esta desequipando e com isso o ring continua a contagem. Problema Resolvido. em movements expring.lua function onEquip(cid, item, slot) local player = Player(cid) player:sendTextMessage(19, '[Exp-Ring] Voce Agora Recebera uma Experiencia extra ao matar monstros. Aproveite!') player:setStorageValue(45454, 1) return true end function onDeEquip(cid, item, slot) local player = Player(cid) player:sendTextMessage(19, '[Exp-Ring] Experiencia extra cancelada.') player:setStorageValue(45454, -1) doTransformItem(item.uid, item.itemid - 11) doDecayItem(item.uid) return true end O paia é que no Item.xml o ring ao ser desequipado e equipado varias vezes, vai só incrementando os atributos, com isso temos que tirar. Se alguem entender o porque, podia me ajudar ai... Editado Setembro 24, 2015 9 anos por overseer (veja o histórico de edições) -- Att,Lucas Soledade Desenvolvedor de Servidores Inovação -> Colossus Server <-
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.