Hello everyone,
Started to play around and made a little script:
Getting an error like this:
[Warning - Event::checkScript] Can not load script: scripts/spidersack.lua
data/actions/scripts/spidersack.lua:44: 'end' expected (to close 'function' at line 18) near '<eof>'
All I've done is edited an already existing script which worked fine however, my edit doesn't work .
Could anybody explain to me where I messed up? Would be grateful!
Ty.
Started to play around and made a little script:
Lua:
local function revertSack(position, itemId, transformId)
local item = Tile(position):getItemById(itemId)
if item then
item:transform(transformId)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local rand = math.random(1, 100)
if item.itemid == 7537 then
if rand <= 20 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You search through the egg sack and manage to find some tarantula eggs.')
player:addItem(11198, 1)
item:transform(7536, 7537)
addEvent(revertSack, 120000, toPosition, 7536, 7537)
toPosition:sendMagicEffect(3)
else
if rand <= 40 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Something nips your hand as you attempt to search through the egg sack.')
item:transform(7536, 7537)
addEvent(revertSack, 120000, toPosition, 7536, 7537)
toPosition:sendMagicEffect(3)
doSummonCreature("Tarantula", toPosition)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'A spider crawls out of the egg sack as you reach inside.')
item:transform(7536, 7537)
addEvent(revertSack, 120000, toPosition, 7536, 7537)
toPosition:sendMagicEffect(3)
doSummonCreature("Spider", toPosition)
end
end
end
[Warning - Event::checkScript] Can not load script: scripts/spidersack.lua
data/actions/scripts/spidersack.lua:44: 'end' expected (to close 'function' at line 18) near '<eof>'
All I've done is edited an already existing script which worked fine however, my edit doesn't work .
Could anybody explain to me where I messed up? Would be grateful!
Ty.