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

TFS 1.X+ TFS 1.3 remove summon on use problem

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,751
Solutions
80
Reaction score
1,889
Location
Germany
Hey
Im new in lua and tried to remove the summon on use again but no success
can someone explain me how the system works?
TFS 1.3

Code:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)

   local function removeMonster(cid)
    local monster = Monster(cid)
    if monster then
        monster:remove()
        end
    end

    local max = 1
    local position = player:getPosition()
  
    if #player:getSummons() >= max then
    player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can not spawn more than 1 pet.")
    position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local position = player:getPosition()
    local pos = Position()
    local monster = Game.createMonster("Barbarian Bloodwalker", position)

    if monster then
        player:addSummon(monster)
        position:sendMagicEffect(CONST_ME_MAGIC_RED)
        monster:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
    else
        player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can not spawn a pet in protection zone.")
        position:sendMagicEffect(CONST_ME_POFF)
    end
    return false
end

I tried stuffs like

remove:creature(monster)
monster:remove()

and so on

tried many things but im kinda lost

Thanks for any kind of help

-angelOt
 
Solution
remove:Monster()monster:getid()

Like this?

Sorry
I do not have any good experience :x
This script will summon monsters until maxSummons, if the count reach maxSummons it will remove them all.
Simply edit it to your needs.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local monsterr = player:getSummons()
local maxSummons = 1
local position = player:getPosition()
    if #monsterr >= maxSummons then
            for i=1, #monsterr do
                monsterr[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
                doRemoveCreature(monsterr[i]:getId())
            end
    else
        local monster = Game.createMonster("Barbarian Bloodwalker", position)
        player:addSummon(monster)...
Everything u need is there
 
Everything u need is there

I have to use addEvent to remove the summon? :eek:
 
remove:Monster()monster:getid()

Like this?

Sorry
I do not have any good experience :x
This script will summon monsters until maxSummons, if the count reach maxSummons it will remove them all.
Simply edit it to your needs.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local monsterr = player:getSummons()
local maxSummons = 1
local position = player:getPosition()
    if #monsterr >= maxSummons then
            for i=1, #monsterr do
                monsterr[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
                doRemoveCreature(monsterr[i]:getId())
            end
    else
        local monster = Game.createMonster("Barbarian Bloodwalker", position)
        player:addSummon(monster)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
    return true
end
 
Solution
Uhh
Nice to know thats also how it works like
thanks you for your help
This script will summon monsters until maxSummons, if the count reach maxSummons it will remove them all.
Simply edit it to your needs.
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local monsterr = player:getSummons()
local maxSummons = 1
local position = player:getPosition()
    if #monsterr >= maxSummons then
            for i=1, #monsterr do
                monsterr[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
                doRemoveCreature(monsterr[i]:getId())
            end
    else
        local monster = Game.createMonster("Barbarian Bloodwalker", position)
        player:addSummon(monster)
        position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    end
    return true
end
 
Back
Top