Any experienced Lua programmer, can help me to modific a thing in my task system? I'm using forgotten server 1.2
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
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.
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()
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.