Ir para conteúdo

Featured Replies

Postado

Fala galera do TK !

 

estou utilizando um servidor Frozen-Hell, estou testando todas as actions, quests e etc.. e encontrei um bug. se o player chega ao skills 200 de fishing toda e qualquer fishing rod para de funcionar imediatamente, segue o erro :

 

 

[05/06/2014 12:33:50] [Error - Action Interface] 

[05/06/2014 12:33:51] data/actions/scripts/tools/fishing.lua:onUse
[05/06/2014 12:33:51] Description: 
[05/06/2014 12:33:51] data/actions/scripts/tools/fishing.lua:20: bad argument #2 to 'random' (interval is empty)
[05/06/2014 12:33:51] stack traceback:
[05/06/2014 12:33:51] [C]: in function 'random'
[05/06/2014 12:33:51] data/actions/scripts/tools/fishing.lua:20: in function <data/actions/scripts/tools/fishing.lua:15>

 e em seguida meu script :

 

 

local config = {

waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
}
 
local ctfArena = {
frompos = {x=659, y=483, z=7},
topos = {x=769, y=569, z=7},
}
 
local warArena = {
frompos = {x=638, y=711, z=7},
topos = {x=751, y=780, z=7},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)
local fishSkill = getPlayerSkill(cid, SKILL_FISHING)
local maxChance2 = 400 - fishSkill
local maxChance = 200 - fishSkill
local minChance = 1
local chance = math.random(minChance,maxChance)
 
 
if isInArea(getPlayerPosition(cid), ctfArena.frompos, ctfArena.topos) or isInArea(getPlayerPosition(cid), warArena.frompos, warArena.topos) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you cannot fish in the arena.")
return true
end
 
if isInArray(config.waterIds, itemEx.itemid) then
if getTilePzInfo(pos) == false then
if getPlayerItemCount(cid, ITEM_WORM) > 0 or item.itemid == 10223 then
if math.random(1, (100 + fishSkill / 10)) < fishSkill then
 
if (item.itemid ~= 10223) then
doPlayerRemoveItem(cid, ITEM_WORM, 1)
end
 
doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
--summon smallboss--
if getPlayerLevel(cid) >= 500 and chance == 1 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Hydromancer", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Hydromancer!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Hydromancer!")
end
if getPlayerLevel(cid) >= 500 and chance == 2 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Constrictor", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Constrictor!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Constrictor!")
end
--summon mediumboss--
if getPlayerLevel(cid) >= 1500 and chance == 3 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Mantassin", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Mantassin!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Mantassin!")
end
if getPlayerLevel(cid) >= 1500 and chance == 4 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Pincher", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Pincher!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Pincher!")
end
--summon mediumboss--
if getPlayerLevel(cid) >= 3000 and chance == 5 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Predator", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Predator!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Predator!")
end
if getPlayerLevel(cid) >= 3000 and chance == 6 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Serpent Spawn", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Serpent Spawn!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Serpent Spawn!")
end
--summon hardboss--
if getPlayerLevel(cid) >= 5000 and chance == 7 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Wyrm", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Wyrm!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Undead Mob Raell's!")
end
if getPlayerLevel(cid) >= 5000 and chance == 8 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Sea Serpent", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Sea Serpent!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Undead Water Raell's Element!")
end
if getPlayerLevel(cid) >= 5000 and fishSkill > 100 and math.random(1,maxChance2) == 80 then
doSendMagicEffect(toPosition, 52)
doCreateMonster("Oceanus", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Oceanus!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Oceanus!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Water Oceanus!", 22)
end
if getPlayerLevel(cid) >= 10000 and fishSkill > 110 and math.random(1,maxChance2) == 80 then
doSendMagicEffect(toPosition, 61)
doCreateMonster("Azure Frog", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Azure Frog!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Azure Frog!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Frogs Azure Frog!", 22)
end
if getPlayerLevel(cid) >= 15000 and fishSkill > 120 and math.random(1,maxChance2) == 80 then
doSendMagicEffect(toPosition, 54)
doCreateMonster("Worm", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Hard Mob Worm!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Worm!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Sea Worm!", 22)
end
else
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end
else
doPlayerSendCancel(cid, "You do not have any worms.")
end
else
doPlayerSendCancel(cid, "You may not fish from a protection zone.")
end
else
doPlayerSendCancel(cid, "Cast into open water.")
end
return true
end

 

Acho que o erro está relacionado ao random.math e ao maxchance2, nao tenho certeza pois nao entendo muito deste assunto. aguardo ajuda, obrigado !

 

 

PS :  Se alguem tiver um event_shop para me ajudar, o que estou utilizando também está bugado, gostaria de saber como fazer um shop apenas clicando nos items e ao invés de utilizar dinheiro ele utilizara Event tokens, obrigado.

Segue a imagem do shop :

 

post-20226-0-97379800-1401983567_thumb.j

 

 

PS²: Sou novo no forum, se meu topico estiver irregular por favor me avisem !

 

Att. Pedro H Chaves

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 8
  • Visualizações 2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Teste ae amigo, acredito que funcione...  

  • local maxChance2 = 400 - fishSkill local maxChance = 200 - fishSkill a maxchance é 200 - o skill. Se o skill for 200 então dá 0 e vai bugar o math.random. Coloca uns numeros maiores tipo 300 e 500

  • Use de base esse sistema... Só configure a seu gosto...  

Posted Images

Postado

Teste ae amigo, acredito que funcione...

 


local config = {
waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
}

local ctfArena = {
frompos = {x=659, y=483, z=7},
topos = {x=769, y=569, z=7},
}

local warArena = {
frompos = {x=638, y=711, z=7},
topos = {x=751, y=780, z=7},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = getCreaturePosition(cid)
local fishSkill = getPlayerSkill(cid, SKILL_FISHING)
local maxChance2 = 400 - fishSkill
local maxChance = 200 - fishSkill
local minChance = 1
local chance = math.random(minChance,maxChance)
local chance1 = math.random(minChance,maxChance2)


if isInArea(getPlayerPosition(cid), ctfArena.frompos, ctfArena.topos) or isInArea(getPlayerPosition(cid), warArena.frompos, warArena.topos) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you cannot fish in the arena.")
return true
end

if isInArray(config.waterIds, itemEx.itemid) then
if getTilePzInfo(pos) == false then
if getPlayerItemCount(cid, ITEM_WORM) > 0 or item.itemid == 10223 then
if math.random(1, (100 + fishSkill / 10)) < fishSkill then

if (item.itemid ~= 10223) then
doPlayerRemoveItem(cid, ITEM_WORM, 1)
end

doPlayerAddSkillTry(cid, SKILL_FISHING, 1)
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
--summon smallboss--
if getPlayerLevel(cid) >= 500 and chance == 1 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Hydromancer", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Hydromancer!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Hydromancer!")
end
if getPlayerLevel(cid) >= 500 and chance == 2 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Constrictor", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Constrictor!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Constrictor!")
end
--summon mediumboss--
if getPlayerLevel(cid) >= 1500 and chance == 3 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Mantassin", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Mantassin!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Mantassin!")
end
if getPlayerLevel(cid) >= 1500 and chance == 4 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Pincher", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Pincher!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Pincher!")
end
--summon mediumboss--
if getPlayerLevel(cid) >= 3000 and chance == 5 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Quara Predator", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Predator!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Quara Predator!")
end
if getPlayerLevel(cid) >= 3000 and chance == 6 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Serpent Spawn", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Quara Serpent Spawn!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Serpent Spawn!")
end
--summon hardboss--
if getPlayerLevel(cid) >= 5000 and chance == 7 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Wyrm", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Wyrm!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Undead Mob Raell's!")
end
if getPlayerLevel(cid) >= 5000 and chance == 8 then
doSendMagicEffect(toPosition, 33)
doCreateMonster("Sea Serpent", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Sea Serpent!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Undead Water Raell's Element!")
end
if getPlayerLevel(cid) >= 5000 and fishSkill > 100 and fishSkill <= 110 and chance1 == 80 then
doSendMagicEffect(toPosition, 52)
doCreateMonster("Oceanus", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Oceanus!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Oceanus!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Water Oceanus!", 22)
end
if getPlayerLevel(cid) >= 10000 and fishSkill > 110 and fishSkill <= 120 and chance1 == 80 then
doSendMagicEffect(toPosition, 61)
doCreateMonster("Azure Frog", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Azure Frog!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Azure Frog!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Frogs Azure Frog!", 22)
end
if getPlayerLevel(cid) >= 15000 and fishSkill > 120 and chance1 == 80 then
doSendMagicEffect(toPosition, 54)
doCreateMonster("Worm", pos, false)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You caught a Hard Mob Worm!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You caught a Hard Mob Worm!")
doBroadcastMessage("The Player"..getCreatureName(cid).." has angered the Titan Goddess of Sea Worm!", 22)
end
else
doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
end
else
doPlayerSendCancel(cid, "You do not have any worms.")
end
else
doPlayerSendCancel(cid, "You may not fish from a protection zone.")
end
else
doPlayerSendCancel(cid, "Cast into open water.")
end
return true
end

Postado
  • Autor

o erro persiste amigo ! me ajudem :(

 

Erro que aparece no console :

 

 

[05/06/2014 22:56:31] [Error - Action Interface] 

[05/06/2014 22:56:31] data/actions/scripts/tools/fishing.lua:onUse
[05/06/2014 22:56:32] Description: 
[05/06/2014 22:56:32] data/actions/scripts/tools/fishing.lua:21: bad argument #2 to 'random' (interval is empty)
[05/06/2014 22:56:32] stack traceback:
[05/06/2014 22:56:32] [C]: in function 'random'
[05/06/2014 22:56:32] data/actions/scripts/tools/fishing.lua:21: in function <data/actions/scripts/tools/fishing.lua:15>

 

Editado por Lekstar (veja o histórico de edições)

Postado
  • Autor

 

[06/06/2014 02:54:26] TheForgottenServer, version 0.3.6 (Crying Damson)

[06/06/2014 02:54:26] Compiled with GNU C++ version 3.4.5 (mingw special) at Jul 16 2011, 12:10:57.
[06/06/2014 02:54:26] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo.
[06/06/2014 02:54:26] Visit our forum for updates, support and resources: http://otland.net.

tfs 0.3.6 cara, estou desesperado por estar perdendo dinheiro, estou pagando um dedicado em vão. por favor me ajudem !

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo