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

RevScripts TalkAction

alcapone

Member
Joined
Jan 13, 2021
Messages
247
Reaction score
19
I'm wanting a talk for when it runs all the monsters on the screen receive hitkill, why use a talk and not using it as a spell because when using it it wouldn't appear on the screen
 
Solution
Lua:
local talk = TalkAction("/killall", "!killall")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    local spectators = Game.getSpectators(player:getPosition(), false, false, 8, 8, 6, 6) -- should be slightly larger then the full screen.
    if spectators and #spectators > 0 then
        for i = 1, #spectators do
            local monster = Monster(spectators[i])
            if monster then
                monster:addHealth((creature:getHealth() * -1))   
            end
        end
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "All monsters on screen have been killed.")
    return false
end

talk:separator(" ")
talk:register()
Lua:
local talk = TalkAction("/killall", "!killall")

function talk.onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    local spectators = Game.getSpectators(player:getPosition(), false, false, 8, 8, 6, 6) -- should be slightly larger then the full screen.
    if spectators and #spectators > 0 then
        for i = 1, #spectators do
            local monster = Monster(spectators[i])
            if monster then
                monster:addHealth((creature:getHealth() * -1))   
            end
        end
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "All monsters on screen have been killed.")
    return false
end

talk:separator(" ")
talk:register()
 
Solution
Back
Top