potinho
Intermediate OT User
Hi guys,
Im trying to use the system from this topic:
But i got error sometimes when a monster of day is killed:
2022-09-23 13:39:26 - [Error - CreatureScript Interface]
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.luanDeath
2022-09-23 13:39:26 - Description:
2022-09-23 13:39:26 - (luaGetPlayerRates) Player not found
2022-09-23 13:39:26 -
2022-09-23 13:39:26 - [Error - CreatureScript Interface]
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.luanDeath
2022-09-23 13:39:26 - Description:
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.lua:18: attempt to index a boolean value
2022-09-23 13:39:26 - stack traceback:
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.lua:18: in function <data/creaturescripts/scripts/daily_monster_bonus.lua:5>
I dont know if is a bug, but when i open table "global_storage" on database, nothing is there, but exp bonus its working. I removed loot from script, follow my actual
globalevent.lua
daily_monster_bonus.lua
daily_monster.lua
I already put
on each monster of boosted system and put
on login.lua
Im trying to use the system from this topic:
TFS 0.X - Monster of the day 0.4
How to when opens the server random("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"...
otland.net
But i got error sometimes when a monster of day is killed:
2022-09-23 13:39:26 - [Error - CreatureScript Interface]
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.luanDeath
2022-09-23 13:39:26 - Description:
2022-09-23 13:39:26 - (luaGetPlayerRates) Player not found
2022-09-23 13:39:26 -
2022-09-23 13:39:26 - [Error - CreatureScript Interface]
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.luanDeath
2022-09-23 13:39:26 - Description:
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.lua:18: attempt to index a boolean value
2022-09-23 13:39:26 - stack traceback:
2022-09-23 13:39:26 - data/creaturescripts/scripts/daily_monster_bonus.lua:18: in function <data/creaturescripts/scripts/daily_monster_bonus.lua:5>
I dont know if is a bug, but when i open table "global_storage" on database, nothing is there, but exp bonus its working. I removed loot from script, follow my actual
globalevent.lua
Lua:
function onStartup()
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"giant spider", "hydra", "warlock", "demon"}
local randomMonster = math.random(#boostedMonstersList)
setGlobalStorageValue(BOOSTED_MONSTER, randomMonster)
local spawn = {x = 155, y = 50, z = 7} -- monster spawn position
doCreateMonster(boostedMonstersList[randomMonster], spawn)
print("Today's boosted monster is: " .. boostedMonstersList[randomMonster])
end
daily_monster_bonus.lua
Lua:
BOOSTED_MONSTER = 56404
local boostedMonstersList = {"giant spider", "hydra", "warlock", "demon"}
experienceBonus = 50
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/100
doPlayerAddExperience(deathList[i], bonusExperience)
doSendAnimatedText(getPlayerPosition(deathList[i]), bonusExperience, 215)
end
end
return true
end
daily_monster.lua
Lua:
function onStartup()
local BOOSTED_MONSTER = 56404
local boostedMonstersList = {"giant spider", "hydra", "warlock", "demon"}
local randomMonster = math.random(#boostedMonstersList)
setGlobalStorageValue(BOOSTED_MONSTER, randomMonster)
local spawn = {x = 155, y = 50, z = 7} -- monster spawn position
doCreateMonster(boostedMonstersList[randomMonster], spawn)
print("Today's boosted monster is: " .. boostedMonstersList[randomMonster])
end
I already put
Lua:
<script> <event name="daily_monster_bonus"/></script>
Lua:
registerCreatureEvent(cid, "daily_monster")