I need help with a script Capture fish monster - Summon catch, I explain my script if it captures the monster and it works fine but I have the summon catch which does not work these are the lines of my help script please
local t = {
percent = 100,
monsters = {
['triton.'] = 100,
['jaws.'] = 100,
['aegaeus.'] = 100,
['nessi.'] = 100,
['aekre.'] = 100,
['kraken.'] = 100,
['blastoise.'] = 100,
['lady Adshara.'] = 100,
['leviathan.'] = 100,
['fyria.'] = 100,
['krakatoa.'] = 100,
['sobek.'] = 100,
['pyria.'] = 100,
['lavos.'] = 100,
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if isMonster(itemEx.uid) then
if t.monsters[getCreatureName(itemEx.uid):lower()] then
if getCreatureHealth(itemEx.uid) <= getCreatureMaxHealth(itemEx.uid) * t.percent / 100 then
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if string.find(desc:lower(), 'catched monster:') == nil then
if math.random(1, 100) < t.monsters[getCreatureName(itemEx.uid):lower()] then
doSendMagicEffect(toPosition, CONST_ME_YALAHARIGHOST)
local newItem = doPlayerAddItem(cid, 5929, 1)
doItemSetAttribute(newItem, 'description', desc .. ' Catched monster: ' .. getCreatureName(itemEx.uid):lower() .. '. ' .. getCreatureName(cid) .. ' has catched this monster.')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You successfuly catched ' .. getCreatureName(itemEx.uid):lower() .. ' into the fish bowl.')
doRemoveCreature(itemEx.uid)
else
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You failed at capturing monster.')
doRemoveCreature(itemEx.uid)
end
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can\'t catch two monsters into same bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Creature do not have require low health.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on specific monsters.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on monsters.')
end
return true
end
and the next line is from the summon catch
local storage = 56487
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if not isCreature(itemEx.uid) then
if getCreatureStorage(cid, storageLol) < os.time() then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonCreature(string.sub(desc, a + 2, b - 1), getThingPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
elseif x ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonCreature(string.sub(desc, a + 2, b - 1), getThingPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendCancel(cid, 'You need to wait before summoning it again.')
end
elseif itemEx.uid == cid then
if #getCreatureSummons(cid) > 0 then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, a + 2, b - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
elseif x ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, x + 2, y - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t summon anything.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can summon a catched monster if you use it on a tile or on ur self if you want to summon it back to the bottle.')
end
return true
end
local t = {
percent = 100,
monsters = {
['triton.'] = 100,
['jaws.'] = 100,
['aegaeus.'] = 100,
['nessi.'] = 100,
['aekre.'] = 100,
['kraken.'] = 100,
['blastoise.'] = 100,
['lady Adshara.'] = 100,
['leviathan.'] = 100,
['fyria.'] = 100,
['krakatoa.'] = 100,
['sobek.'] = 100,
['pyria.'] = 100,
['lavos.'] = 100,
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if isMonster(itemEx.uid) then
if t.monsters[getCreatureName(itemEx.uid):lower()] then
if getCreatureHealth(itemEx.uid) <= getCreatureMaxHealth(itemEx.uid) * t.percent / 100 then
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if string.find(desc:lower(), 'catched monster:') == nil then
if math.random(1, 100) < t.monsters[getCreatureName(itemEx.uid):lower()] then
doSendMagicEffect(toPosition, CONST_ME_YALAHARIGHOST)
local newItem = doPlayerAddItem(cid, 5929, 1)
doItemSetAttribute(newItem, 'description', desc .. ' Catched monster: ' .. getCreatureName(itemEx.uid):lower() .. '. ' .. getCreatureName(cid) .. ' has catched this monster.')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You successfuly catched ' .. getCreatureName(itemEx.uid):lower() .. ' into the fish bowl.')
doRemoveCreature(itemEx.uid)
else
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You failed at capturing monster.')
doRemoveCreature(itemEx.uid)
end
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can\'t catch two monsters into same bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Creature do not have require low health.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on specific monsters.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on monsters.')
end
return true
end
and the next line is from the summon catch
local storage = 56487
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if not isCreature(itemEx.uid) then
if getCreatureStorage(cid, storageLol) < os.time() then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonCreature(string.sub(desc, a + 2, b - 1), getThingPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
elseif x ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonCreature(string.sub(desc, a + 2, b - 1), getThingPos(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendCancel(cid, 'You need to wait before summoning it again.')
end
elseif itemEx.uid == cid then
if #getCreatureSummons(cid) > 0 then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, a + 2, b - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
elseif x ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, x + 2, y - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t summon anything.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can summon a catched monster if you use it on a tile or on ur self if you want to summon it back to the bottle.')
end
return true
end