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

TalkAction Rain Items Event

Maniucza

~Lua~ Noob
Joined
Aug 2, 2009
Messages
86
Reaction score
6
Location
Poland / Rzeszów
This event is run from the command, Just change items and corresponding effects on us. You can set the event will be started at the time.

Lua:
-- Rain item Events created by Maniucza (c) --

local fromPos = {x=998, y=993, z=7}
local toPos = {x=1008, y=1001, z=7}
local items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}}
local maxItems = 14

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

15bqcl.png


Have fun! ;)
 
Last edited:
I was about to ask you on another forum for permission to reupload it here, but I see you did it already.
+3 Rep for you here and 14 on another forum.
 
if you could add a ramdon be great.
to touch some items more or less ..
 
works good , but no effetcts than item reach ground :(
 
This event is run from the command, Just change items and corresponding effects on us. You can set the event will be started at the time.

Lua:
-- Rain item Events created by Maniucza (c) --

local fromPos = {x=998, y=993, z=7}
local toPos = {x=1008, y=1001, z=7}
local items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}}
local maxItems = 14

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

15bqcl.png


Have fun! ;)

This is not this the effect
 
Back
Top