Vendeliko
Banned User
- Joined
- Dec 3, 2011
- Messages
- 3,087
- Reaction score
- 93
Hi,I was trying to add http://otland.net/f81/boss-bailout-149128/ to my server and everything works fine except that the boss doesn't get teleported out of the jail and I get this error:
bossbailout.lua
Can anyone please help me solve this?
Thanks in advance,
Vendeliko.
Code:
[19:51:45.149] [Error - MoveEvents Interface]
[19:51:45.149] data/movements/scripts/bossbailout.lua nAddItem
[19:51:45.149] Description:
[19:51:45.149] data/movements/scripts/bossbailout.lua:52: attempt to call global 'doSetItemSpecialDescription' (a nil value)
[19:51:45.149] stack traceback:
[19:51:45.149] data/movements/scripts/bossbailout.lua:52: in function <data/movements/scripts/bossbailout.lua
bossbailout.lua
Code:
-- BOSS BAILOUT
-- By: Evan @ otland.net
local goldCoins = {
[2148] = {worth = 1},
[2152] = {worth = 100},
[2160] = {worth = 10000}
}
-- This function was made to remove a creature from the jail (to make it look more realistic) --
function removeCreature()
for x = 16775, 16779 do -- location of the boss in jail (x = topLeft, topRight)
for y = 16485, 16479 do -- location of the boss in jail (y = bottomLeft, topLeft)
local a = getTopCreature({x=x, y=y, z=7}).uid -- Don't forget to change the z-coordinate if necessary
if a ~= 0 and isMonster(a) then
doRemoveCreature(a)
end
end
end
return true
end
-- This function is used when the amount of gold is reached --
function doSomething()
doCreateMonster(newBoss, newBossLocation)
doBroadcastMessage(releaseMessage, advance)
setGlobalStorageValue(goldStore, 0)
doSetItemSpecialDescription(object.uid, "There are 0 gold coins in here.\n"..(targetCount).." more gold coins is needed.")
removeCreature()
return true
end
-- Main function --
function onAddItem(moveitem, tileitem, position)
-- YOU CAN CHANGE ANYTHING HERE --
goldStore = 8890 -- The storage ID of where the amount of gold is stored
pos = {x = 16775, y = 16497, z = 7, stackpos = 1} -- Location of the sign
targetCount = 1000000 -- The amount of gold that is required to doSomething()
newBoss = 'Orshabaal' -- The boss that will be bailed out
newBossLocation = {x = 16777, y = 16490, z = 7} -- The location where the boss will be summoned
releaseMessage = "It was a hefty payment, but the boss has been bailed out!" -- The message sent when the boss is bailed out
-- DO NOT CHANGE ANYTHING HERE UNLESS YOU KNOW WHAT YOU'RE DOING --
goldCountStore = getGlobalStorageValue(goldStore)
object = getThingFromPos(pos)
goldWeight = getItemWeight(moveitem.uid) * 10
local v = goldCoins[moveitem.itemid]
if v then
doRemoveItem(moveitem.uid)
doSendMagicEffect(position, 3)
setGlobalStorageValue(goldStore, goldCountStore + (goldWeight * v.worth))
doSetItemSpecialDescription(object.uid, "There are " ..(goldCountStore + (goldWeight * v.worth)).. " gold coins in here.\n"..(targetCount - (goldCountStore + (goldWeight * v.worth))).." more gold coins is needed.")
if ((targetCount - (goldCountStore + (goldWeight * v.worth)))) <= 0 then
doSomething()
end
else
doRemoveItem(moveitem.uid)
doSendMagicEffect(position, CONST_ME_POFF)
end
return true
end
Can anyone please help me solve this?
Thanks in advance,
Vendeliko.