Jump to content

[HELP] Radar black edge on map


opnaiC

Recommended Posts

addEventHandler('onClientResourceStart', resourceRoot,
	function()
		if (texture) then -- should be the texture name of the map
			dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section
		end
	end
)

 

Edited by Dzsozi
Link to comment
1 hour ago, Dzsozi said:

addEventHandler('onClientResourceStart', resourceRoot,	function()		if (texture) then -- should be the texture name of the map			dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section		end	end)

 

So when I use dxCreateImage can I use this ? Cause I tried it and it isnt working .. Can you explain what do you mean with the argument texture ?

This is what I tried:

img = dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))
dxSetTextureEdge(img, "border", tocolor(255, 0, 0, 255))

 

Edited by opnaiC
Link to comment

Try this:

addEventHandler('onClientResourceStart', resourceRoot,
	function()
    	local texture = dxCreateTexture("img/radar_map.jpg")
		if (texture) then
			dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section
		end
	end
)

...

dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))

 

Link to comment
23 minutes ago, Dzsozi said:

Try this:


addEventHandler('onClientResourceStart', resourceRoot,	function()    	local texture = dxCreateTexture("img/radar_map.jpg")		if (texture) then			dxSetTextureEdge(texture, 'border', tocolor(WaterColor[1], WaterColor[2], WaterColor[3], 255)) -- replace WaterColor[1] (and so on) with the water color of the map, use paint or photoshop and pipette tool to get the rgb numbers of the section		end	end)...
dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))

 

 

I fixed what you post and its working now like that:

YOjjHDk.png

Only the first pixel line is green but not the rest.

Script:

addEventHandler('onClientResourceStart', resourceRoot,
	function()
    	texture = dxCreateTexture("img/radar_map.jpg")
		if (texture) then
			dxSetTextureEdge(texture, "border", tocolor(0, 255, 0))
		end	
	end
)

...

 

Link to comment

I'm not an expert, but maybe it does not have effect because you are setting the edge of the texture of the map: the size of the texture and the size of the image are the same.

The edge type may only apply to the part of a texture which is empty. Try applying that to the texture you draw the map texture (in you example was called "texture") on (probably a renderTarget?).

I'm not expert, but if you have time you can try... it's better to do nothing and be bored xD

Link to comment
28 minutes ago, LoPollo said:

I'm not an expert, but maybe it does not have effect because you are setting the edge of the texture of the map: the size of the texture and the size of the image are the same.

The edge type may only apply to the part of a texture which is empty. Try applying that to the texture you draw the map texture (in you example was called "texture") on (probably a renderTarget?).

I'm not expert, but if you have time you can try... it's better to do nothing and be bored xD

I think I need some help to get this working because its to hard for me.

Link to comment
if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then
			    dxSetRenderTarget(rt, true)
			local x, y = getElementPosition(localPlayer)
			local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH))
			local camX,camY,camZ = getElementRotation(getCamera())
				dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))
			    dxSetRenderTarget()
		end

local rt = dxCreateRenderTarget(290, 175)

This is how it is now

Link to comment
9 minutes ago, LoPollo said:

Why aren't you drawing the texture you loaded instead of "img/radar_map.jpg"?

dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, "img/radar_map.jpg", camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))

Note: i'm doing test & fail

addEventHandler('onClientResourceStart', resourceRoot,
	function()
    	texture = dxCreateTexture("img/radar_map.jpg")
		if (texture) then
			dxSetTextureEdge(rt, "border", tocolor(0, 255, 0))
		end	
	end
) 

...

if (not isPlayerMapVisible()) then
		    local mW, mH = dxGetMaterialSize(rt)
		    if ( alwaysRenderMap or getElementInterior(localPlayer) == 0 ) then
			    dxSetRenderTarget(rt, true)
			local x, y = getElementPosition(localPlayer)
			local X, Y = mW/2 -(x/(6000/worldW)), mH/2 +(y/(6000/worldH))
			local camX,camY,camZ = getElementRotation(getCamera())
				dxDrawImage(X - worldW/2, mH/5 + (Y - worldH/2), worldW, worldH, texture, camZ, (x/(6000/worldW)), -(y/(6000/worldH)), tocolor(255, 255, 255, 255))
			    dxSetRenderTarget()

kbZISON.png

Something is wrong, because only the left border is green ..

Link to comment

I'm not able to use the texture edge on a texture with dxDrawImage on a bigger texture. Wiki uses dxDrawImageSection... and it's the only way i get the edge working :/

local useImageInsteadOfScreen = false

local imageTexture = useImageInsteadOfScreen and dxCreateRenderTarget ( 300, 300, true ) or dxCreateScreenSource(300, 300)
local theRenderTarget = dxCreateRenderTarget( 300, 300, true )

local sx, sy = guiGetScreenSize()
sx, sy = sx / 1366, sy / 768

function init()
	if useImageInsteadOfScreen then
		dxSetRenderTarget( imageTexture )
		--draw what you want on the image
		dxDrawRectangle( 0, 0, 300, 300 )
		dxSetRenderTarget()
	end
	dxSetTextureEdge(imageTexture, "clamp")
end
addEventHandler( "onClientResourceStart", resourceRoot, init )
addEventHandler( "onClientRestore", root, init )

function init2()
	if not useImageInsteadOfScreen then
		dxUpdateScreenSource( imageTexture )
	end
	dxSetRenderTarget( theRenderTarget, true )
	dxDrawImageSection( 0, 0, 300, 300, -30, -30, 300+60, 300+60, imageTexture )
	dxSetRenderTarget()
end
addEventHandler( "onClientResourceStart", resourceRoot, init2 )
addEventHandler( "onClientRestore", root, init2 )

function render()
	dxSetRenderTarget()
	dxDrawImage( 20*sx, 200*sy, 300*sx, 300*sy, theRenderTarget )
end
addEventHandler( "onClientRender", root, render)

 

Edited by LoPollo
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...