• Congratulations to the OTLand January Mapping Competition Winner! The grand prize of Otland Premium goes to Andréew.
  • Sign up for February Mapping Competition! The prize includes Otland Premium time.
  • 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!

TFS 0.X Monster of the day 0.4

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,365
Best answers
34
Reaction score
866
Location
Arica - Chile

buchaLL

Bez spiny, luźno
Joined
Apr 16, 2017
Messages
88
Best answers
17
Reaction score
56
Location
Poland
Added loot to corpse & exp bonus based on monster deathlist (deathlist / i)

Lua:
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"rat", "spider", "troll", "orc", "minotaur", "dwarf", "elf", "skeleton", "amazon", "valkirie", "dark apprentice", "ghoul", "cyclops", "dwarf guard", "necromancer", "vampire", "werewolf", "dragon", "dragon lord", "wyrm", "giant spider", "hydra", "warlock", "demon"}
local experienceBonus = 0.5

function onDeath(cid, corpse, deathList)

local master = getCreatureMaster(cid)
  if (master and master ~= cid) then
    return true
  end

  local boostedMonster = boostedMonstersList[getGlobalStorageValue(BOOSTED_MONSTER)]
    if getCreatureName(cid):lower() == boostedMonster then
    
for i = 1, #deathList do
    
-- exp bonus
    local bonusExperience = getMonsterInfo(getCreatureName(cid)).experience/i * getPlayerRates(deathList[i])[SKILL__LEVEL] * experienceBonus
    doPlayerAddExperience(deathList[i], bonusExperience)
    doSendAnimatedText(getPlayerPosition(deathList[i]), bonusExperience, 215)
    
-- loot bonus
    local lootList = getMonsterLootList(getCreatureName(cid))
    for i, _ in pairs(lootList) do
        if lootList[i].count > 1 then
            local numb = math.random(1, lootList[i].count)
            doAddContainerItem(corpse.uid, lootList[i].id, numb)
        elseif math.random(1,100000) <= lootList[i].chance then
            doAddContainerItem(corpse.uid, lootList[i].id, 1)
        end
    end
    
end
    
    end
    return true
end
 
OP
newby

newby

Banned User
Joined
Jun 11, 2016
Messages
164
Best answers
0
Reaction score
38
Added loot to corpse & exp bonus based on monster deathlist (deathlist / i)

Lua:
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"rat", "spider", "troll", "orc", "minotaur", "dwarf", "elf", "skeleton", "amazon", "valkirie", "dark apprentice", "ghoul", "cyclops", "dwarf guard", "necromancer", "vampire", "werewolf", "dragon", "dragon lord", "wyrm", "giant spider", "hydra", "warlock", "demon"}
local experienceBonus = 0.5

function onDeath(cid, corpse, deathList)

local master = getCreatureMaster(cid)
  if (master and master ~= cid) then
    return true
  end

  local boostedMonster = boostedMonstersList[getGlobalStorageValue(BOOSTED_MONSTER)]
    if getCreatureName(cid):lower() == boostedMonster then
    
for i = 1, #deathList do
    
-- exp bonus
    local bonusExperience = getMonsterInfo(getCreatureName(cid)).experience/i * getPlayerRates(deathList[i])[SKILL__LEVEL] * experienceBonus
    doPlayerAddExperience(deathList[i], bonusExperience)
    doSendAnimatedText(getPlayerPosition(deathList[i]), bonusExperience, 215)
    
-- loot bonus
    local lootList = getMonsterLootList(getCreatureName(cid))
    for i, _ in pairs(lootList) do
        if lootList[i].count > 1 then
            local numb = math.random(1, lootList[i].count)
            doAddContainerItem(corpse.uid, lootList[i].id, numb)
        elseif math.random(1,100000) <= lootList[i].chance then
            doAddContainerItem(corpse.uid, lootList[i].id, 1)
        end
    end
    
end
    
    end
    return true
end
OnPlayer die?
Code:
[12:58:52.896] [Error - CreatureScript Interface] 
[12:58:52.896] data/creaturescripts/scripts/monsteroftheday_onkill.lua:onDeath
[12:58:52.896] Description: 
[12:58:52.896] ...a/creaturescripts/scripts/monsteroftheday_onkill.lua:8: attempt to index global 'boostedMonstersList' (a nil value)
[12:58:52.896] stack traceback:
[12:58:52.896]     ...a/creaturescripts/scripts/monsteroftheday_onkill.lua:8: in function <...a/creaturescripts/scripts/monsteroftheday_onkill.lua:1>
[12:58:52.002] Dark Inside has logged out.
[12:58:54.780] Dark Inside has logged in.
OnPlayer kill the monster?
Code:
[12:59:23.163] [Error - CreatureScript Interface] 
[12:59:23.163] data/creaturescripts/scripts/monsteroftheday_onkill.lua:onDeath
[12:59:23.163] Description: 
[12:59:23.163] ...a/creaturescripts/scripts/monsteroftheday_onkill.lua:8: attempt to index global 'boostedMonstersList' (a nil value)
[12:59:23.163] stack traceback:
[12:59:23.163]     ...a/creaturescripts/scripts/monsteroftheday_onkill.lua:8: in function <...a/creaturescripts/scripts/monsteroftheday_onkill.lua:1>
 

buchaLL

Bez spiny, luźno
Joined
Apr 16, 2017
Messages
88
Best answers
17
Reaction score
56
Location
Poland
Paste whole script to file with:
Lua:
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"rat", "spider", "troll", "orc", "minotaur", "dwarf", "elf", "skeleton", "amazon", "valkirie", "dark apprentice", "ghoul", "cyclops", "dwarf guard", "necromancer", "vampire", "werewolf", "dragon", "dragon lord", "wyrm", "giant spider", "hydra", "warlock", "demon"}
local experienceBonus = 0.5
 
OP
newby

newby

Banned User
Joined
Jun 11, 2016
Messages
164
Best answers
0
Reaction score
38
Dont print the print('boost')

Code:
<event type="death" name="monsteroftheday_onkill" event="script" value="monsteroftheday_onkill.lua"/>
Code:
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"rat", "spider", "troll", "orc", "minotaur", "dwarf", "elf", "skeleton", "amazon", "valkirie", "dark apprentice", "ghoul", "cyclops", "dwarf guard", "necromancer", "vampire", "werewolf", "dragon", "dragon lord", "wyrm", "giant spider", "hydra", "warlock", "demon"}
local experienceBonus = 0.5

function onDeath(cid, corpse, deathList)

local master = getCreatureMaster(cid)
  if (master and master ~= cid) then
    return true
  end

  local boostedMonster = boostedMonstersList[getGlobalStorageValue(BOOSTED_MONSTER)]
    if getCreatureName(cid):lower() == boostedMonster then
    
for i = 1, #deathList do
    
-- exp bonus
    local bonusExperience = getMonsterInfo(getCreatureName(cid)).experience/i * getPlayerRates(deathList[i])[SKILL__LEVEL] * experienceBonus
    doPlayerAddExperience(deathList[i], bonusExperience)
    doSendAnimatedText(getPlayerPosition(deathList[i]), bonusExperience, 215)
    print('boost')
    
-- loot bonus
    local lootList = getMonsterLootList(getCreatureName(cid))
    for i, _ in pairs(lootList) do
        if lootList[i].count > 1 then
            local numb = math.random(1, lootList[i].count)
            doAddContainerItem(corpse.uid, lootList[i].id, numb)
        elseif math.random(1,100000) <= lootList[i].chance then
            doAddContainerItem(corpse.uid, lootList[i].id, 1)
        end
    end
    
end
    
    end
    return true
end
 

buchaLL

Bez spiny, luźno
Joined
Apr 16, 2017
Messages
88
Best answers
17
Reaction score
56
Location
Poland
Add to boosted monster:
Lua:
<script>
        <event name="monsteroftheday_onkill"/>
</script>
Because it works for me.
 
Top