• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[LUA] Create Boss from fishbowl, summon error

ares413

New Member
Joined
Apr 1, 2010
Messages
130
Reaction score
3
i have a script, sorta like a capturing a pet system, but im trying to change into where you right click the fish bowl, and it creates a monster that attacks everyone, NOT a summoned creature. currently everything in the script works 100% except that part, heres my script:

Code:
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
                        doSummonMonster(cid, string.sub(desc, a + 2, b - 1))
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
                        doRemoveItem(item.uid, 1)
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
                    end
                elseif x ~= nil then
                    if #getCreatureSummons(cid) == 0 then
                        doSummonCreature(cid, string.sub(desc, x + 2, y - 1))
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
                        doRemoveItem(item.uid, 1)
                    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

please help rep++
 
SPELLWAND SCRIPT I USE FOR MY RL MAP
local outfits = {"rat", "green frog", "chicken"} --possible outfits
local duration = 45 --duration of the outfit in seconds
local breakchance = 1 --chance of losing the wand
function onUse(cid, item, fromPosition, itemEx, toPosition)
if math.random(100) <= breakchance then
doSummonCreature("Mad Sheep",toPosition)
doRemoveItem(item.uid,1)
return TRUE
end
if isPlayer(itemEx.uid) == TRUE then
doSetMonsterOutfit(itemEx.uid,outfits[math.random(#outfits)],duration*1000)
doSendMagicEffect(toPosition,CONST_ME_MAGIC_BLUE)
return TRUE
end
end

HERES THE MAD SHEEP PART OF THE SCRIPT ITS THE MONSTER XML
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Mad Sheep" nameDescription="a mad sheep" race="blood" experience="0" speed="116" manacost="0">
<health now="22" max="22"/>
<look type="14" corpse="2905"/>
<targetchange interval="5000" chance="8"/>
<strategy attack="0" defense="100"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag staticattack="50"/>
<flag lightlevel="0"/>
<flag lightcolor="0"/>
<flag targetdistance="1"/>
<flag runonhealth="14"/>
</flags>
<attacks/>
<defenses armor="15" defense="20">
<defense name="healing" interval="5000" chance="30" min="5" max="15">
<attribute key="areaEffect" value="hearts"/>
</defense>
<defense name="speed" interval="1000" chance="12" speedchange="141" duration="8000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
</defenses>
<immunities>
<immunity physical="0"/>
<immunity energy="0"/>
<immunity fire="0"/>
<immunity poison="0"/>
<immunity lifedrain="0"/>
<immunity paralyze="0"/>
<immunity outfit="0"/>
<immunity drunk="0"/>
<immunity invisible="0"/>
</immunities>
<voices interval="2000" chance="5">
<voice sentence="Maeh"/>
<voice sentence="Groar!"/>
<voice sentence="Fchhhh!"/>
</voices>
<loot>
</loot>
</monster>

i hope this helps , u can use any monster just change the stuff to corrispond together
 
Back
Top