• 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 how new function on task system

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
Any experienced Lua programmer, can help me to modific a thing in my task system? I'm using forgotten server 1.2

LUA:
local config = {
     ['rat'] = {amount = 100, storage = 40000, startstorage = 5016, startvalue = 1},
    
}

function onKill(player, target)
    local player = type(player) == "userdata" and player or Player(player)
    local target = type(target) == "userdata" and target or Creature(target)
    if target and target:isMonster() then
        local monster = config[target:getName():lower()]
        if target:isPlayer() or not monster or target:getMaster() then
            return true
        end
        local stor = player:getStorageValue(monster.storage)+1
        if stor < monster.amount and player:getStorageValue(monster.startstorage) >= monster.startvalue then
           player:setStorageValue(monster.storage, stor)
           player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'You killed '..(stor +0)..' '..target:getName()..'s out of '..monster.amount..' required.')
          end
        if (stor +0) == monster.amount then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, 'Congratulations! '..target:getName()..'s with total amount of '..monster.amount..' kills.')
            player:setStorageValue(monster.storage, stor +0)
        end
    end
    return true
end

this script is currently working as I would like.
basically if a player get the storage 5016,1 the monster [rat] in case ative, So if the player kill a ['monster inside the config'] will be added storage = 40000 and the value will be amount killed.

I would like to add this function to the script
LUA:
getDamageMap()
why?

I wish 2 player in same task monster could win amount killed from the same monster if the player takes at least 40% of the monster's total health.
 
Back
Top