• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

How work this script?

jackl90

Member
Joined
Jul 25, 2017
Messages
249
Reaction score
12
someone can say for me how this work?
i have this creaturescript "task" on my datapack

LUA:
local config = {
   
    ["dwarf"] = {count = 500, storage = 2002, start = 0, plural = "dwarves"},
    ["dwarf soldier"] = {count = 500, storage = 1002, start = 0, plural = "dwarves"},
   
    ["ghoul"] = {count = 500, storage = 2003, start = 0, plural = "ghouls"},
    ["goblin"] = {count = 400, storage = 2004, start = 0, plural = "goblins"},
    ["larva"] = {count = 400, storage = 2005, start = 0, plural = "larva"},
   
    ["minotaur"] = {count = 700, storage = 2006, start = 0, plural = "minotaurs all kind"},
    ["minotaur guard"] = {count = 700, storage = 2006, start = 0, plural = "minotaurs all kind"},
    ["minotaur mage"] = {count = 700, storage = 2006, start = 0, plural = "minotaurs all kind"},
    ["minotaur archer"] = {count = 700, storage = 2006, start = 0, plural = "minotaurs all kind"},
    ["rotworm"] = {count = 350, storage = 2007, start = 0, plural = "rotworms"},
   
    ["orc"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc spearman"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc shaman"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc rider"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc warlord"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc leader"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
    ["orc berserker"] = {count = 800, storage = 2008, start = 0, plural = "orcs all kind"},
   
    ["scarab"] = {count = 500, storage = 2010, start = 0, plural = "scarabs"},
    ["troll"] = {count = 200, storage = 2012, start = 0, plural = "trolls"},
    ["ancient scarab"] = {count = 600, storage = 2013, start = 0, plural = "ancient scarabs"},

    ["black knight"] = {count = 500, storage = 2015, start = 0, plural = "black knight"},
    ["cyclops"] = {count = 450, storage = 2016, start = 0, plural = "cyclopses"},
    ["demon skeleton"] = {count = 300, storage = 2017, start = 0, plural = "demon skeleton"},
    ["dragon"] = {count = 1000, storage = 2018, start = 0, plural = "dragons"},
    ["dwarf guard"] = {count = 700, storage = 2019, start = 0, plural = "dwarf guards"},
    ["fire elemental"] = {count = 250, storage = 2020, start = 0, plural = "fire elementals"},
    ["giant spider"] = {count = 600, storage = 2021, start = 0, plural = "giant spiders"},
    ["hero"] = {count = 500, storage = 2022, start = 0, plural = "heroes"},
       
    ["necromancer"] = {count = 600, storage = 2024, start = 0, plural = "necromancers"},
    ["vampire"] = {count = 500, storage = 2026, start = 0, plural = "vampires"},
    ["behemoth"] = {count = 1000, storage = 2027, start = 0, plural = "behemoth"},
    ["dragon lord"] = {count = 1000, storage = 2028, start = 0, plural = "dragon lords"},
    ["demon"] = {count = 1666, storage = 2029, start = 0, plural = "demons"},
    ["warlock"] = {count = 1000, storage = 2032, start = 0, plural = "warlocks"},
}

function onKill(player, target)
    local monster = config[target:getName():lower()]
    if not monster or target:getMaster() then
        return true
    end
   
    local storageValue = player:getStorageValue(monster.storage)
    --if storageValue >= monster.start then
        if storageValue == monster.count then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have already killed " .. monster.count .. " " .. monster.plural .. ". Report back to The Hunter in Thais.")
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed [" .. storageValue .. "/" .. monster.count .. "] " .. monster.plural .. ".")
        end
        if storageValue < monster.count then
            player:setStorageValue(monster.storage, storageValue + 1)
        end
    --end
    return true
end


i don't understand this part too
if storageValue < monster.count then
player:setStorageValue(monster.storage, storageValue + 1)
end
 
i don't understand this part too
if storageValue < monster.count then
player:setStorageValue(monster.storage, storageValue + 1)
end

If player didnt kill defined monster count (this in table) then it will add killed monster to the killed count.
 
Back
Top