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

TalkAction [TFS 1.3] Place monster command with count of summons.

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
924
Solutions
30
Reaction score
342
I know it is not the best way to write it but this how it ended.
the old place monster command was
/m monstername
the new place monster command by adding this code is :
/m monstername,monstercount
in data/talkactions/scripts/place_monster.lua change your old script with this one:
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
        return false
    end
    local t = string.split(param, ",")
    if not t[1] then
            player:sendCancelMessage("Not valid monster name." )
     end
    local mobscount = tonumber(t[2])
    if mobscount == nil then
        mobscount = 1
    end
    local found = nil
    for i = 0,mobscount do
        if mobscount == i then
               break
        end
        local position = player:getPosition()
        local randX, randY, randZ
           local rangeFrom = player:getPosition()
        local rangeTo = player:getPosition()
           rangeTo.x = rangeFrom.x+2
           rangeTo.y=rangeFrom.y+2
           rangeFrom.x = rangeFrom.x - 2
           rangeFrom.y = rangeFrom.y - 2
        randX = math.random(rangeFrom.x, rangeTo.x)
        randY = math.random(rangeFrom.y, rangeTo.y)
           randZ = math.random(rangeFrom.z, rangeTo.z)
        local summonplace = Position(randX, randY, randZ)
        local monster = Game.createMonster(t[1], summonplace)
    end
        if monster ~= nil then
        local position = player:getPosition()
            summonplace:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            position:sendMagicEffect(CONST_ME_MAGIC_RED)
        else
            player:sendCancelMessage("There is not enough room.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        end
    return false
end
 
Last edited:
Top