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

Always visible missile

kermaxpl

Pora na Nonsens Scripter
Joined
Aug 21, 2012
Messages
121
Reaction score
7
Location
Poland
Hi, I'm trrying to do "Rain System" but 1 thing annoys me all time.
I want to make that a all missiles are visible all time on every , but now i have this.
Bez tytułu.jpg
 
Last edited:
buy better pc, that's all

After corectly checked your picture I think you are staying near building and those effects are on that floor where exactly you are.
So, you have to add rain effects on the highest possible floor or buy better pc.
 
It may also be a Tibia client limitation. Try viewing the same thing using OTClient.

Red
 
Globalevent lib
Lua:
-- Features:
    -- chance = OBJECT.chance = INT
    -- createItem = OBJECT.createItem = {chance = INT, item = {itemid = INT, type = INT}}
 
 
Rain = {ignoreIds = {4526}}
 
function Rain:new()
    local obj = {}
    setmetatable(obj, self)
    self.__index = self
    return obj
end
function Rain:getPositionInArea(fromPos, toPos)
    self.positions = {}
    for Y = fromPos.y, toPos.y do
        for X = fromPos.x, toPos.x do
            if (getTileThingByPos({x=X, y=Y, z=7, stackpos=0}).itemid ~= 0) then
                if not (string.match(string.lower(getItemNameById(getTileThingByPos({x=X, y=Y, z=7, stackpos=0}).itemid)), "water")) then
                    table.insert(self.positions, {x=X, y=Y, z=Z})
                end
            end
        end
    end
    return true
end
 
function Rain:doRain(position, disteffect, effect)
    if (self.duraction ~= self.executed) then
        local chance = self.chance or 100
        if (math.random(0, 1000) <= chance) then
            for Z = 0, 7 do
                if (getTileThingByPos(({x = position.x, y = position.y, z = Z})).itemid ~= 0) then
                    doSendDistanceShoot({x = position.x - 7, y = position.y - 5, z = Z}, {x = position.x, y = position.y, z = Z}, disteffect)
                    doSendMagicEffect({x = position.x, y = position.y, z = Z}, effect)
                    if (self.createItem) then
                        if (math.random(0, 1000) <= self.createItem.chance) then
                            if (isInArray(self.ignoreIds, getTileThingByPos({x=X, y=Y, z=Z, stackpos=0}).itemid) == FALSE) then
                                local item = doCreateItem(self.createItem.item.itemid, self.createItem.item.type, {x=position.x, y=position.y, z=0})
                                doDecayItem(item)
                            end
                        end
                    end
                    break
                end
            end
        end
        return true
    else
        return false
    end
end
 
function Rain:start(positions, effects, duraction, delay, var)
    self:getPositionInArea(positions.fromPos, positions.toPos)
    if not (self.positions[1]) then
        return false
    end
    self.delay = delay
    self.var = var or self
    self.effects = effects
    self.duraction = duraction
    self.executed = 0
    addEvent(doCallback, self.delay, {var=self.var})
    return true
end
 
function doCallback(p)
    for _, v in pairs(p.var.positions) do
        if not (p.var:doRain(v, p.var.effects.disteffect, p.var.effects.effect)) then
            return true
        end
    end
    addEvent(doCallback, p.var.delay, {var=p.var})
    p.var.executed = p.var.executed+1
end
Globalevent lua
Lua:
local rain = Rain:new()

function deszcz()
    local minX = 990
    local minY = 993
    local maxX = 1008
    local maxY = 1006
 
    local frompos = {x=990, y=993, z=0}
    local topos = {x=1008, y=1006, z=0}
 
    local effects = {
        snow = {
            disteffect = CONST_ANI_SNOWBALL,
            effect = CONST_ME_ENERGYAREA
        },
        rain = {
            disteffect = CONST_ANI_ICE,
            effect = CONST_ME_LOSEENERGY
 
        }
    }
	
	function deszczSec()
		if getGlobalStorageValue(4000) == 2 then
			rain.chance = math.random(40,100)
			rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}
			rain:start({fromPos = frompos, toPos = topos}, effects.rain, 1000, math.random(100,350))
			setGlobalStorageValue(4000, 3)
			print("deszcz2")
			addEvent(deszczTrd, 5000)
		end
	end
	function deszczTrd()
		if getGlobalStorageValue(4000) == 3 then
			rain.chance = math.random(40,100)
			rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}
			rain:start({fromPos = frompos, toPos = topos}, effects.rain, 1000, math.random(100,350))
			setGlobalStorageValue(4000, 4)
			addEvent(deszczFoth, 5000)
			print("deszcz3")
		end
	end
	function deszczFoth()
		if getGlobalStorageValue(4000) == 4 then
			rain.chance = math.random(40,100)
			rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}
			rain:start({fromPos = frompos, toPos = topos}, effects.rain, 1000, math.random(100,350))
			print("deszcz4")
		end
	end
	
	if getGlobalStorageValue(4000) == 0 then
		rain.chance = math.random(40,100)
        rain.createItem = {chance = math.random(0,10), item = {itemid = 2016, type = 1}}
        rain:start({fromPos = frompos, toPos = topos}, effects.rain, 1000, math.random(100,350))
		setGlobalStorageValue(4000, 2)
		addEvent(deszczSec, 5000)
		print("deszcz1")
	end		
end
function onThink(interval, lastExecution)
if getGlobalStorageValue(4000) == 0 then
random = math.random(1, 4)
   if random == 2 then
		addEvent(deszcz, 1)
		print("deszcz")
		addEvent(setGlobalStorageValue, math.random(18000000, 36000000), 4000, 0)
	end
end
    return TRUE
end
globalevents.xml
XML:
<globalevent name="rain" interval="5000" event="script" value="rain.lua"/>

I work on OTClient, but it works the same on Official Client and OTClient
 
The answer is: You cannot see anything on upper floors when you are on down floor, like walls and other things. You can see the effect on all floors only, when you will be on the highest floor. Like house windows/doors, when you don't stand in front of them you can see in some points all buildings, but when you stand in front of~ you will se only this floor where you are.

In this case if effect is spawned on all floors, on every single tile, you cannot see it.
 
Back
Top