Author:
Distro: TFS 0.3.x+/Matriz(svn)
Version: 3.0
Ruire: OTAL v1.2 http://otland.net/f163/otal-open-tibia-advanced-lib-v-1-2-a-56771/
This script you install it and let this script running around 5 days and execute talkaction it will show an graphic with most hunted places!
YES ITS TRUE LOOK AT PHOTO!
If you dont understando this photo has 10124x124 pixels, 1 pixel = 1 sqm in the map, every place where a monster dies the pixel will going to whiteblue! and changing colors look at scale on > \/ of the photo.
Well you can use .luai files to install script or in old method ^^ lest start by old method
First go to creaturescripts.xml and add this tag
Code:
<event type="kill" name="kill" event="script" value="graficos.lua"/>
-- This stept you need do using and not using otal.
Lua:
registerCreatureEvent(cid, "kill")
Lua:
function onKill(cid, target)
if isMonster(cid) == TRUE then
local pa = getCreaturePosition(cid)
local file = io.open('posi.txt', "a+")
if file then
file:write(pa.x..","..pa.y..">")
file:close()
end
end
return TRUE
end
Add this tag:
PHP:
<talkaction log="yes" words="!grafico" access="5" event="script" value="grafico.lua"/>
Lua:
function onSay(cid, words, param)
local q = os.clock()
doPlayerSendTextMessage(cid, 25, 'Started in: '..(os.clock()-q)..'.')
-- Multipiler, 10 to small server 5~2 to big server
local multipliler = 10
local mapx = 1024 -- Map size (x)
local mapy = 1024 -- Map size (y)
---Creating photo
local im = assert(gd.createTrueColor(mapx, mapy),'could not create photo!')
if multipliler > 10 then multipliler = 10 end
local imgn = math.floor(0xff/multipliler)
local colors = {
[0] = im:colorAllocate(0,multipliler,multipliler),
}
-- Set all colors
for e=1,imgn do
if e ~= imgn then
colors[im:colorAllocate(0,multipliler*e,multipliler*e)] = im:colorAllocate(0,multipliler*e+multipliler,multipliler*e+multipliler)
else
colors[im:colorAllocate(0,multipliler*e,multipliler*e)] = im:colorAllocate(0xff,0,0)
for kd=0,imgn do
if kd ~= imgn then
colors[im:colorAllocate(0xff,kd*multipliler,0)] = im:colorAllocate(0xff,multipliler*kd+multipliler,0)
else
colors[im:colorAllocate(0xff,kd*multipliler,0)] = im:colorAllocate(0xff,0xff,0)
for kk=0,imgn do
colors[im:colorAllocate(0xff,0xff,kk*multipliler)] = im:colorAllocate(0xff,0xff,multipliler*kk+multipliler)
end
end
end
end
end
doPlayerSendTextMessage(cid, 25, 'Colors loaded in: '..(os.clock()-q)..'.')
--- Load file with pos
local file = io.open('posi.txt', "r")
local str = file:read(-1)
doPlayerSendTextMessage(cid, 25, 'File loaded: '..(os.clock()-q)..'.')
local nw = string.explode(str,">")
for w=1,#nw do
local str2 = string.explode(nw[w],',')
if str2 ~= nil and str2[1] ~= nil and str2[2] ~= nil then
local n1 = tonumber(str2[1])
local n2 = tonumber(str2[2])
if n1 ~= nil and n2 ~= nil then
c = im:getPixel(n1, n2)
if colors[c] ~= nil then
im:setPixel(n1, n2,colors[c])
end
end
end
end
doPlayerSendTextMessage(cid, 25, 'Colors set in: '..(os.clock()-q)..'.')
-- Get colos table n
na = -1
for i,b in pairs(colors) do
na = na+1
end
--- Scale
for e=0,na do
for x=(mapx-5),mapx do
for y=(mapy-(na-e)),mapy do
c = im:getPixel(x, y)
if colors[c] ~= nil then
im:setPixel(x, y,colors[c])
end
end
end
end
--- Set photo
im:png("oute.png")
doPlayerSendTextMessage(cid, 25, 'Finished in: '..(os.clock()-q)..' seconds. Open file oute.png')
return TRUE
end
together of attachment has an .posi.txt file, if you want put on your server folder and execute !graficos so see it working ;D
Last edited: