Postado Junho 17, 2022 2 anos Boa tarde pessoal, tudo certo? Senhores, anteriormente eu tive um problema com meu script de EXP HIT pois ele não estava reconhecendo os trainers do meu server. Enfim, copiei o script de um monk, editei com mais vida e mudei alguns atributos, eai blz, funcionou! O problema é que, agora ele não esta reconhecendo os monstros do War Of Emperium, aqueles cristais azuis e vermelhos chamados "Emperium". Quando eu ataco eles, acusa o seguinte erro: Citar [14:8:58.241] [Error - CreatureScript Interface] [14:8:58.242] data/creaturescripts/scripts/exphit.lua:onStatsChange [14:8:58.243] Description: [14:8:58.244] (luaGetMonsterInfo) Monster not found [14:8:58.246] [Error - CreatureScript Interface] [14:8:58.247] data/creaturescripts/scripts/exphit.lua:onStatsChange [14:8:58.248] Description: [14:8:58.249] data/creaturescripts/scripts/exphit.lua:46: attempt to index a boolean value [14:8:58.251] stack traceback: [14:8:58.252] data/creaturescripts/scripts/exphit.lua:46: in function <data/creaturescripts/scripts/exphit.lua:43> E sendo assim, eu não consigo dar dano nesses monstros. Acredito que, todos os monstros que não são "padrões" do tibia, o script não reconhece. Sera que seria possível arrumar isso? Segue abaixo o script. Spoiler useStages = true premiumMultipliqueExp = 1 rateExp = 100 local stages = { ["1-50"] = 80, ["51-100"] = 60, ["101-150"] = 50, ["151-180"] = 40, ["181-200"] = 35, ["201-230"] = 30, ["231-250"] = 25, ["251-280"] = 20, ["281-300"] = 15, } ultimateExp = 10 partyPorcent = 50 levelBlockParty = 50 expShareRadiusX = 30 expShareRadiusY = 30 expShareRadiusZ = 1 local rings = { [3048] = 2, [3049] = 4, [3050] = 6, } function CalculeExp(monsterhp, exptotal, hit) hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0 return hit < 0 and 0 or hit end function isSummon(cid) return getCreatureMaster(cid) end function onStatsChange(cid, attacker, type, combat, value) if isPlayer(attacker) and isMonster(cid) then if getCreatureStorage(cid, 50001) ~= 1 then doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp) doCreatureSetStorage(cid, 50001, 1) end end if type == STATSCHANGE_HEALTHLOSS then if isMonster(cid) then if isCreature(attacker) then local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker if isPlayer(_cid) then if useStages then for strstage, experience in pairs(stages) do tabstage = string.explode(strstage, "-") if getPlayerLevel(_cid) >= tonumber(tabstage[1]) and getPlayerLevel(_cid) <= tonumber(tabstage[2]) then ultimateExp = experience end end experienceRate = ultimateExp else experienceRate = rateExp end local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value) if getCreatureStorage(cid, 50002) > 0 then if getCreatureStorage(cid, 50002) - expgain < 0 then expgain = getCreatureStorage(cid, 50002) end doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain) local ringexp = 1 for idring, expring in pairs(rings) do if getPlayerSlotItem(_cid, 9).itemid == idring then ringexp = expring break end end local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1 expgain = expgain * ringexp * premiumMultipliqueExp local party = false if isInParty(_cid) then local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent for indice, partyMember in pairs(partyMembers) do attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember) attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember) x = false if math.abs(attackerLevel - partyLevel) > levelBlockParty then x = true elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then x = true elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then x = true elseif attackerPos.z ~= partyPos.z then x = true elseif _cid == partyMember then x = true end if x then partyMembers[indice] = nil end end if #partyMembers ~= 0 then expParty = math.ceil(expgain / 100 * partyPorcent) expmember = math.ceil(expParty / #partyMembers) for _, member in pairs(partyMembers) do if member ~= _cid then doPlayerSendTextMessage(member, 12, "Você recebeu "..expmember.." de experiência da party.") doPlayerAddExp(member, expmember) end end doPlayerSendTextMessage(_cid, 12, "Você recebeu "..expgain.." de experiência. (" ..partyPorcent.."% foi enviado para a party.)") doPlayerAddExp(_cid, expgain - expParty) party = true else party = false end end if not party then doPlayerAddExp(_cid, expgain) doPlayerSendTextMessage(_cid, 12, "Você recebeu "..expgain.." de experiência.") end end end end end end return true end function onCombat(cid, target) if isMonster(target) and not isSummon(target) and not isPlayer(target) then registerCreatureEvent(target, "ExpGain") end return true end Agradeço muito caso consigam me ajudar. Uma boa tarde a todos!
Postado Junho 18, 2022 2 anos Autor Solução Alguém? EDITED 21/06/2022 Senhores, futuramente, caso alguém precise, deixo a solução abaixo: Para que os monstros fossem reconhecidos, é necessário que o nome dele esteja igual em todas as partes do script monster.xml. Por exemplo, os monstros do sistema de WOE, possuiam uma abreviação de "pre1", "pre2", "emp", e os nomes deles no jogo eram Emperium. Basicamente o que fiz, foi alterar o script do WOE e mudar o nome dos monstros. Vou deixar abaixo um exemplo, pois explicando pode parecer confuso. Script antigo de um monstro do WOE: Spoiler <?xml version="1.0" encoding="UTF-8"?> <monster name="Emperium" nameDescription="a emperiume" race="fire" experience="0" speed="0" manacost="0"> <health now="25000" max="25000"/> <look typeex="8635"/> <targetchange interval="5000" chance="8"/> <strategy attack="100" defense="0"/> <script> <event name="pre_empes"/> </script> <flags> <flag summonable="1"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="0"/> <flag canpushcreatures="0"/> <flag targetdistance="0"/> <flag staticattack="90"/> <flag runonhealth="10"/> </flags> <attacks> </attacks> <defenses armor="10" defense="10"/> <elements> <element icePercent="-100"/> <element firePercent="100"/> <element holyPercent="100"/> <element deathPercent="100"/> <element physicalPercent="-25"/> <element earthpercent="100"/> <element energyPercent="-50"/> </elements> <immunities> <immunity lifedrain="0"/> <immunity paralyze="0"/> <immunity outfit="0"/> <immunity drunk="0"/> <immunity invisible="0"/> </immunities> <voices interval="5000" chance="10"> </voices> <loot> </loot> </monster> Script novo: Spoiler <?xml version="1.0" encoding="UTF-8"?> <monster name="Blue Emperium" nameDescription="a blue emperium" race="fire" experience="0" speed="0" manacost="0"> <health now="25000" max="25000"/> <look typeex="8634"/> <targetchange interval="5000" chance="8"/> <strategy attack="100" defense="0"/> <script> <event name="pre_empes"/> </script> <flags> <flag summonable="1"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="0"/> <flag canpushcreatures="0"/> <flag targetdistance="0"/> <flag staticattack="90"/> <flag runonhealth="10"/> </flags> <attacks> </attacks> <defenses armor="10" defense="10"/> <elements> <element icePercent="100"/> <element firePercent="100"/> <element holyPercent="-100"/> <element deathPercent="-100"/> <element physicalPercent="-25"/> <element earthpercent="-100"/> <element energyPercent="100"/> </elements> <immunities> <immunity lifedrain="0"/> <immunity paralyze="0"/> <immunity outfit="0"/> <immunity drunk="0"/> <immunity invisible="0"/> </immunities> <voices interval="5000" chance="10"> </voices> <loot> </loot> </monster> Editado Junho 21, 2022 2 anos por carvaroth (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.