• 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!

some scripting errors.. rainevent

wafuboe

Active Member
Joined
Dec 24, 2010
Messages
884
Solutions
2
Reaction score
26
1.
[5/1/2014 23:28:7] >>> Loading talkactions... [Error - LuaInterface::loadFile] data/talkactions/scripts/rain.lua:5: ')' expected near '}'
[5/1/2014 23:28:7] [Error - Event::checkScript] Cannot load script (data/talkactions/scripts/rain.lua)

heres the script
Code:
- Rain item Events created by Maniucza (c) --

local fromPos = {x=994, y=996, z=7}
local toPos = {x=1003, y=1006, z=7}
local items = {{9020,10}, {2160,30}, {8299,1}, {8301,3}, {2798,10}, {6500,25}, {2472,1}, {7958,math.random(1,10), {7957,math.random(1,10}, {11117,math.random(1,10}, {2138,math.random(1,10}, {8310,math.random(1,10}}
local maxItems = 10

function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return true
end
end
end
return true
end

function checkPositions(n)
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
if isWalkable(pos, true, false, true) then
return pos
end
return (n < 50 and checkPositions(n+1) or false)
end

function onSay(cid, words, param)
doBroadcastMessage("Rain item event will start in 1 minutes. Go to temple.", MESSAGE_EVENT_ADVANCE)
return addEvent(spawnItem, 60000, 1)
end

function spawnItem(created)
if created >= maxItems then
return doBroadcastMessage("Rain Item Event just finished!", MESSAGE_EVENT_ADVANCE)
end
local itemPos, itemInf = checkPositions(1), math.random(#items)
doCreateItem(items[itemInf][1], items[itemInf][2], itemPos)
doSendMagicEffect(itemPos, CONST_ME_LOSEENERGY)
return addEvent(spawnItem, 5000, created+1)
end


thanks
 
Here you go
Code:
-- Rain item Events created by Maniucza (c) --

local fromPos = {x=994, y=996, z=7}
local toPos = {x=1003, y=1006, z=7}
local maxItems = 10

function isWalkable(pos, creature, proj, pz)
  local items = {{9020,10}, {2160,30}, {8299,1}, {8301,3}, {2798,10}, {6500,25}, {2472,1}, {7958,math.random(1,10)}, {7957, math.random(1,10)}, {11117,math.random(1,10)}, {2138,math.random(1,10)}, {8310,math.random(1,10)}}

if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return true
end
end
end
return true
end

function checkPositions(n)
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
if isWalkable(pos, true, false, true) then
return pos
end
return (n < 50 and checkPositions(n+1) or false)
end

function onSay(cid, words, param)
doBroadcastMessage("Rain item event will start in 1 minutes. Go to temple.", MESSAGE_EVENT_ADVANCE)
return addEvent(spawnItem, 60000, 1)
end

function spawnItem(created)
if created >= maxItems then
return doBroadcastMessage("Rain Item Event just finished!", MESSAGE_EVENT_ADVANCE)
end
local itemPos, itemInf = checkPositions(1), math.random(#items)
doCreateItem(items[itemInf][1], items[itemInf][2], itemPos)
doSendMagicEffect(itemPos, CONST_ME_LOSEENERGY)
return addEvent(spawnItem, 5000, created+1)
end
 
Back
Top