Postado Setembro 24, 2018 6 anos Tenho Erro no [8.60] Sistema de Recompensa TFS 0.4 Scripts > Sistema de Recompensa do @Luanluciano93 Esse e Erro aki Scripts -- Sistema de recompensa criado por luanluciano93 dofile('data/sistemas/rewardchest.lua') local function addRewardLoot(uid, bossName, tabela_reward) local money = math.random(10, 40) local msg = "The following items are available in your reward chest:" local chest = doCreateItemEx(REWARDCHEST.rewardBagId) doItemSetAttribute(chest, "description", "Reward System has kill the boss ".. bossName ..".") if table.maxn(tabela_reward) > 0 then for x = 1, table.maxn(tabela_reward) do local rand = math.random(100) if rand <= tabela_reward[x][3] then local count = math.random(1, tabela_reward[x][2]) doAddContainerItem(chest, tabela_reward[x][1], count) msg = msg .. " ".. (tabela_reward[x][2] > 1 and tabela_reward[x][2] > 1 or "") ..." "..getItemNameById(tabela_reward[x][1]).."," end end doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " and ".. money .." platinum coins.") else doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " ".. money .." platinum coins.") end doAddContainerItem(chest, 2152, money) doPlayerSendMailByName(getPlayerName(uid), chest, REWARDCHEST.town_id) local boss = REWARDCHEST.bosses[bossName] setPlayerStorageValue(uid, boss.storage, 0) doSendMagicEffect(getPlayerPosition(uid), CONST_ME_MAGIC_BLUE) end local function addLoot(tabela_loot, tabela_reward, all_loot) if table.maxn(tabela_loot) > 0 then if all_loot then for x = 1, table.maxn(tabela_loot) do table.insert(tabela_reward, tabela_loot[x]) end else table.insert(tabela_reward, tabela_loot[math.random(table.maxn(tabela_loot))]) end end return tabela_reward end local function rewardChestSystem(bossName) local players = {} local boss = REWARDCHEST.bosses[bossName] for _, uid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(uid, boss.storage) > 0 then table.insert(players, uid) end end table.sort(players, function(a, b) return getPlayerStorageValue(a, boss.storage) > getPlayerStorageValue(b, boss.storage) end) local porcentagem = math.ceil(getPlayerStorageValue(players[1], boss.storage)) for i = 1, table.maxn(players) do local tabela_reward = {} local pontos = getPlayerStorageValue(players[i], boss.storage) if i == 1 then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.sempre, tabela_reward, true) elseif i >= 2 and pontos >= math.ceil((porcentagem * 0.8)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.muito_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.8)) and pontos >= math.ceil((porcentagem * 0.6)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.6)) and pontos >= math.ceil((porcentagem * 0.4)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.4)) and pontos >= math.ceil((porcentagem * 0.1)) then addLoot(boss.comum, tabela_reward, false) end addRewardLoot(players[i], bossName, tabela_reward) end end function onDeath(cid, corpse, killer) local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss then addEvent(rewardChestSystem, 1000, getCreatureName(cid):lower()) end return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(cid) and type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss and attacker then setPlayerStorageValue(attacker, boss.storage, getPlayerStorageValue(attacker, boss.storage) + math.ceil((value / REWARDCHEST.formula.hit))) end end return true end Editado Setembro 25, 2018 6 anos por Soaresdk (veja o histórico de edições)
Postado Setembro 24, 2018 6 anos msg = msg .. " ".. (tabela_reward[x][2] > 1 and tabela_reward[x][2] > 1 or "") .." "..getItemNameById(tabela_reward[x][1])..","
Postado Setembro 25, 2018 6 anos Solução Spoiler -- Sistema de recompensa criado por luanluciano93 dofile('data/sistemas/rewardchest.lua') local function addRewardLoot(uid, bossName, tabela_reward) local money = math.random(10, 40) local msg = "The following items are available in your reward chest:" local chest = doCreateItemEx(REWARDCHEST.rewardBagId) doItemSetAttribute(chest, "description", "Reward System has kill the boss ".. bossName ..".") if table.maxn(tabela_reward) > 0 then for x = 1, table.maxn(tabela_reward) do local rand = math.random(100) if rand <= tabela_reward[x][3] then local count = math.random(1, tabela_reward[x][2]) doAddContainerItem(chest, tabela_reward[x][1], count) msg = msg .. " " .. (tabela_reward[x][2] > 1 and tabela_reward[x][2] > 1 or "") .." " .. getItemNameById(tabela_reward[x][1]) .. "," end end doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " and ".. money .." platinum coins.") else doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " ".. money .." platinum coins.") end doAddContainerItem(chest, 2152, money) doPlayerSendMailByName(getPlayerName(uid), chest, REWARDCHEST.town_id) local boss = REWARDCHEST.bosses[bossName] setPlayerStorageValue(uid, boss.storage, 0) doSendMagicEffect(getPlayerPosition(uid), CONST_ME_MAGIC_BLUE) end local function addLoot(tabela_loot, tabela_reward, all_loot) if table.maxn(tabela_loot) > 0 then if all_loot then for x = 1, table.maxn(tabela_loot) do table.insert(tabela_reward, tabela_loot[x]) end else table.insert(tabela_reward, tabela_loot[math.random(table.maxn(tabela_loot))]) end end return tabela_reward end local function rewardChestSystem(bossName) local players = {} local boss = REWARDCHEST.bosses[bossName] for _, uid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(uid, boss.storage) > 0 then table.insert(players, uid) end end table.sort(players, function(a, b) return getPlayerStorageValue(a, boss.storage) > getPlayerStorageValue(b, boss.storage) end) local porcentagem = math.ceil(getPlayerStorageValue(players[1], boss.storage)) for i = 1, table.maxn(players) do local tabela_reward = {} local pontos = getPlayerStorageValue(players[i], boss.storage) if i == 1 then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.sempre, tabela_reward, true) elseif i >= 2 and pontos >= math.ceil((porcentagem * 0.8)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.muito_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.8)) and pontos >= math.ceil((porcentagem * 0.6)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.6)) and pontos >= math.ceil((porcentagem * 0.4)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.4)) and pontos >= math.ceil((porcentagem * 0.1)) then addLoot(boss.comum, tabela_reward, false) end addRewardLoot(players[i], bossName, tabela_reward) end end function onDeath(cid, corpse, killer) local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss then addEvent(rewardChestSystem, 1000, getCreatureName(cid):lower()) end return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(cid) and type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss and attacker then setPlayerStorageValue(attacker, boss.storage, getPlayerStorageValue(attacker, boss.storage) + math.ceil((value / REWARDCHEST.formula.hit))) end end return true end
Postado Setembro 25, 2018 6 anos Autor @DboExplorer Obrigado deu certo nenhum erro agora vou testa qual quer coisa edito. quando matei boss Ghazbaran deu esse erro coloquei no xml do Ghazbaran. Citar <script> <event name="RewardChestDeath"/> <event name="RewardChestMonster"/> </script> xml do Ghazbaran. Citar <?xml version="1.0" encoding="UTF-8"?> <monster name="Ghazbaran" nameDescription="Ghazbaran" race="undead" experience="15000" speed="400" manacost="0"> <health now="60000" max="60000"/> <look type="12" head="0" body="123" legs="97" feet="94" corpse="6068"/> <targetchange interval="10000" chance="20"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="0"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="1"/> <flag canpushcreatures="1"/> <flag staticattack="98"/> <flag targetdistance="1"/> <flag runonhealth="3500"/> </flags> <attacks> <attack name="melee" interval="2000" min="-500" max="-2191"/> <attack name="melee" interval="2000" chance="40" range="7" radius="6" target="0" min="-250" max="-500"> <attribute key="areaEffect" value="blackspark"/> </attack> <attack name="melee" interval="3000" chance="34" range="7" radius="1" target="1" min="-120" max="-500"> <attribute key="shootEffect" value="whirlwindsword"/> <attribute key="areaEffect" value="redspark"/> </attack> <attack name="energy" interval="4000" chance="30" length="8" spread="0" min="-100" max="-800"> <attribute key="areaEffect" value="mortarea"/> </attack> <attack name="physical" interval="3000" chance="20" range="14" radius="5" target="0" min="-200" max="-480"> <attribute key="areaEffect" value="poff"/> </attack> <attack name="physical" interval="4000" chance="15" range="7" radius="13" target="0" min="-100" max="-650"> <attribute key="areaEffect" value="yellowspark"/> </attack> <attack name="physical" interval="4000" chance="18" radius="14" target="0" min="-200" max="-600"> <attribute key="areaEffect" value="bluebubble"/> </attack> <attack name="melee" interval="3000" chance="15" range="7" radius="4" target="0" min="-200" max="-750"> <attribute key="areaEffect" value="energyarea"/> </attack> </attacks> <defenses armor="55" defense="65"> <defense name="healing" interval="3000" chance="35" min="300" max="800"> <attribute key="areaEffect" value="blueshimmer"/> </defense> <defense name="speed" interval="4000" chance="80" speedchange="440" duration="6000"> <attribute key="areaEffect" value="redshimmer"/> </defense> </defenses> <immunities> <immunity physical="0"/> <immunity energy="1"/> <immunity fire="1"/> <immunity poison="1"/> <immunity lifedrain="1"/> <immunity paralyze="1"/> <immunity outfit="1"/> <immunity drunk="1"/> <immunity invisible="1"/> </immunities> <summons maxSummons="3"> <summon name="Deathslicer" interval="4000" chance="20"/> </summons> <voices interval="5000" chance="30"> <voice sentence="COME HERE AND DIE!"/> <voice sentence="COME AND GIVE ME SOME AMUSEMENT!" yell="1"/> <voice sentence="IS THAT THE BEST YOU HAVE TO OFFER, TIBIANS?" yell="1"/> <voice sentence="I AM GHAZBARAN OF THE TRIANGLE... AND I AM HERE TO CHALLENGE YOU ALL!" yell="1"/> <voice sentence="FLAWLESS VICTORY!"/> </voices> <loot> <item id="2160" countmax="12" chance="100000"/><!-- crystal coin --> <item id="2514" chance="18000"/><!-- mastermind shield --> <item id="6300" chance="12000"/><!-- death ring --> <item id="5943" chance="7000"/><!-- Morgaroth's heart --> <item id="2003" chance="100000"><!-- grey backpack --> <inside> <item id="7431" chance="6000"/><!-- demonbone --> <item id="2393" chance="60000"/><!-- giant sword --> <item id="2195" chance="14033"/><!-- boots of haste --> </inside> </item> </loot> <script> <event name="RewardChestDeath"/> <event name="RewardChestMonster"/> </script> </monster> Editado Setembro 25, 2018 6 anos por Soaresdk (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.