Hiho Everyone,
I was bored this morning and just scripted something for fun.
Desc: Its simple to install. Well there is other rain systems which is more advanced than mine. But well its in beta phase and i need bit help. This rain system should not cause any laggs i think! Since it only rains around your player and not over the whole map! Where you go, the rain will follow you!
You can configure: When should i start rain, From drops to rain storm!
And also when it hits water tiles it make splashes on the water!
Also it will only rain on ground and floor up. Not under 7!
Missing:
If player is under a itemid, it should hit over that itemid. Such as roof, inside a building, under a big tree and etc..
Well, that is the only problem, its raining inside the buildings!
Tested on 0.3.6 & 0.4
At globalevents/globalevents.xml
For 0.4:
For 0.4:
At globalevents/scripts create new lua and name it "rain.lua" and paste the code below:
At globalevents/scripts create new lua and name it "raintime.lua" and paste the code below:
Enjoy!
I was bored this morning and just scripted something for fun.
Desc: Its simple to install. Well there is other rain systems which is more advanced than mine. But well its in beta phase and i need bit help. This rain system should not cause any laggs i think! Since it only rains around your player and not over the whole map! Where you go, the rain will follow you!
You can configure: When should i start rain, From drops to rain storm!
And also when it hits water tiles it make splashes on the water!
Also it will only rain on ground and floor up. Not under 7!
Missing:
If player is under a itemid, it should hit over that itemid. Such as roof, inside a building, under a big tree and etc..
Well, that is the only problem, its raining inside the buildings!
Tested on 0.3.6 & 0.4
At globalevents/globalevents.xml
XML:
<globalevent name="Rain" interval="1" event="script" value="rain.lua"/>
XML:
<globalevent name="Rain" interval="1000" event="script" value="rain.lua"/>
XML:
<globalevent name="RainTime" interval="36000" event="script" value="raintime.lua"/>
XML:
<globalevent name="RainTime" interval="3600000" event="script" value="raintime.lua"/>
At globalevents/scripts create new lua and name it "rain.lua" and paste the code below:
Lua:
local Cyko = {
interval = 1000, --1000Recommended. But here you decide until it starts raining as hell!
waterid = {4608, 4609, 4610, 4611, 4612}
}
function Rain(cid)
if getStorage(3000) == 1 then
for _, cid in ipairs(getPlayersOnline()) do
if isCreature(cid) then
if getThingPos(cid).z <= 7 then
local pos = getThingPos(cid)
local frompos = getThingPos(cid)
pos.x = pos.x + math.random(-9,9)
pos.y = pos.y + math.random(-9,9)
frompos.x = pos.x - 9
frompos.y = pos.y - 9
for i = 1,#Cyko.waterid do
if getTileItemById(pos, Cyko.waterid[i]).uid > 0 then
doSendMagicEffect(pos,CONST_ME_WATERSPLASH)
else
doSendDistanceShoot(frompos, pos, CONST_ANI_ICE)
doSendMagicEffect(pos,CONST_ME_LOSEENERGY)
end
end
end
end
end
end
end
function isUnderRoof(cid)
--We need to figure this out!
end
function onThink(interval, lastExecution)
if getStorage(3000) == 1 then
for _, cid in ipairs(getPlayersOnline()) do
if getThingPos(cid).z <= 7 then
for i = 1, 5 do
addEvent(Rain, i*Cyko.interval, cid)
end
end
end
end
return true
end
At globalevents/scripts create new lua and name it "raintime.lua" and paste the code below:
Lua:
function onThink(interval, lastExecution)
if getStorage(3000) == -1 then
doSetStorage(3000, 1)
else
doSetStorage(3000, -1)
end
return true
end
Enjoy!
Last edited: