• 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!

Solved [TFS 1.0] Summon Rune Troubleshoot

Jaed Le Raep

★Gaeming★
Joined
Sep 3, 2007
Messages
1,296
Reaction score
441
Hey guys, I've had this script but it's a bit wonky. Basically, it summons monsters as a convince, so that it bypasses the game's summons system. However, I'd like some changes to be implemented into it that I haven't gotten to work. Please note that this is a spell script for a rune.

Whenever a player has 1 summon already, if they use the rune again, then the summon will be unsummoned, rather than that "No more than 1 summon" message appearing.

Whenever a player is level 5, 10, and 15, a different summon will be summoned based on that level.

Code:
local function f(c)
    if isMonster(c) then
        doRemoveCreature(c)
    end
end

function onCastSpell(cid, var)
    local p = getThingPos(cid)
    if getTileInfo(p).protection then
        doCreatureSay(cid, 'You cannot summon in a Protection Zone!', TALKTYPE_ORANGE_1, false, cid, p)
        doSendMagicEffect(p, CONST_ME_POFF)
    elseif #getCreatureSummons(cid) ~= 0 then
        doPlayerSendCancel(cid, 'You can\'t summon more than one.')
        doSendMagicEffect(p, CONST_ME_POFF)
    else
        local r = doSummonCreature('Furi', getPlayerPosition(cid))
        if r ~= false then
            Monster(r):setMaster(cid)
            doSendMagicEffect(p, CONST_ME_MAGIC_BLUE)
            addEvent (doCreatureSay, 2, cid, "I weave between the realms and call forth a Furi worthy of my calling! Come to your deity at once!", TALKTYPE_YELL)
            return true
        else
            doPlayerSendDefaultCancel(cid, r)
        end
    end
    return false
end

Also, with this re-write, please make it more understandable. For me, it's not very much in lamans terms, so I have a hard time reading the script (hence why I can't edit it myself, considering how easy the edits I'm requesting are).

@Ninja @Limos
 
Last edited:
Code:
local config = {
    [{1, 5}] = {"Rat"},
    [{6, 10}] = {"Sheep"},
    [{11, 999}] = {"Black Sheep"}
}

function onCastSpell(creature, var)
    local position = creature:getPosition()
    local summons = creature:getSummons()
    if #summons > 0 then
        summons[1]:getPosition():sendMagicEffect(CONST_ME_POFF)
        summons[1]:remove()
        return false
    end
 
    if Tile(position):hasFlag(TILESTATE_PROTECTIONZONE) then
        creature:sendCancelMessage("You cannot summon in a Protection Zone!")
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end
 
    for level, name in pairs(config) do
        if creature:getLevel() >= level[1] and creature:getLevel() <= level[2] then
            local summonMonster = Game.createMonster(name[1], position)
            if summonMonster then
                summonMonster:setMaster(creature)
                position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                addEvent(function () creature:say(string.format("I weave between the realms and call forth a %s worthy of my calling! Come to your deity at once!", name[1]), TALKTYPE_YELL) end, 2000)
                return true
            end
        end
    end
    return false
end
 
7H0v7.png


@Ninja Not to be an ubger goober, I actually tried to fix it by switching the local position with the creature, on line 8, but that didn't work.
 
Last edited:
Works fine here but try with onCastSpell(cid, var) and add local creature = Creature(cid) below onCastSpell(cid, var).
 
Works fine here but try with onCastSpell(cid, var) and add local creature = Creature(cid) below onCastSpell(cid, var).

You know, I was trying to fix it myself and was very, very close to fixing it. I had changed the (creature, var) to (cid, var), but instead of local = Creature(cid) I did local creature = isPlayer(cid) and it totes didn't work =/ But lol, thanks, your suggestion worked and now it works pretty well :)
 
Back
Top