Jump to content

help with a hidden marker


maksam07

Recommended Posts

Posted (edited)

I create a marker and try twice to ask him the alpha

local marker = createMarker ( ax, ay, 0, "checkpoint", aradius, r or 255, g or 255, b or 255, 0 )
setElementAlpha(marker, 0)

For the marker type cylinder it works, but for the checkpoint alpha type it does not work and the marker is visible

Used:

setElementVisibleTo( marker, getRootElement(), false ) 

But then the marker is hidden on the map (I have markers getElementsByType ("marker"))

Still tried it, but it does not work:

for i, pl in ipairs ( getElementsByType("player") ) do
	setElementVisibleTo ( marker, pl, false )
end

 

Found this problem on the bugtracker

https://bugs.mtasa.com/view.php?id=7292

The bug was discovered back in 2013 but still the problem remained. How can I solve the problem? I need the marker to be without the Z position

Edited by maksam07
Posted

Why use a checkpoint when you can use colshapes, they are already invisible and come in plenty shapes; a tube, a cubid a sphere...

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted

+1 @SuperCroz , using colshapes easier.

check this topic 

you will find a resource to make col shapes and you will find all the instructions you need.

560x95_FFFFFF_FF9900_000000_000000.png

Posted
On 10.08.2017 at 16:02, SuperCroz said:

Why use a checkpoint when you can use colshapes, they are already invisible and come in plenty shapes; a tube, a cubid a sphere...

I've considered this option before, but the problem is that collision can not change the size, as it can be done with the marker - SetMarkerSize. Or I'm wrong?

Posted
29 minutes ago, NeXuS™ said:

You can create a function which would do it for ya.

Function that will change the size? Is this possible without the removal of collisions and creating a new one with a smaller size? I do not see other options

Posted
14 minutes ago, NeXuS™ said:

No, it's not possible without removing and then recreating it.

In this and the problem, I would not want to delete. I still have an idea of how to do this with a different type of marker. Only you can not use the input and output events to it. I guess I later unsubscribe about results

Posted

Changing a colshape's size is pretty easy. You will just need to set the shape size at the creation as 'x' which should be globally defined as a number at first, and then create a function that modify x's value which will lead to change the colshapes' size.

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted
4 minutes ago, SuperCroz said:

Changing a colshape's size is pretty easy. You will just need to set the shape size at the creation as 'x' which should be globally defined as a number at first, and then create a function that modify x's value which will lead to change the colshapes' size.

But the size does not change unless you create a collision again

Posted
local radius = 1
local MySphere = createColSphere(x,y,z,radius)
-- make sure to replace x,y & z with numbers.

function changeMySphereSize(size)
  radius = size
end
-- it is dump to create a whole function for that, but it can be useful if you want to fill in more arguments.
-- other than that you can simply change 'radius' value.
8 minutes ago, maksam07 said:

But the size does not change unless you create a collision again

What do you mean? Why not?

 

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted
6 hours ago, NeXuS™ said:

@SuperCroz, changing a variable won't change the element's size at all.

Why not، this var determines the size doesn't. Gonna test it later anyway. Idk maybe u r right.

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted (edited)
13 hours ago, SuperCroz said:

What do you mean? Why not?

But it does not work.

local radius = 520
local MySphere = createColSphere(0, 0, 3, radius)
function changeMySphereSize( size )
	radius = size
	if ( radius > 10 ) then 
		setTimer ( changeMySphereSize, 1000, 1, radius-1 )
	end
end
setTimer ( changeMySphereSize, 1000, 1, radius-1 )

 

error:

9 hours ago, shay103 said:

tocolor( r or 255, g or 255, b or 255, a or 0 )

 

Edited by maksam07
Posted

@maksam07, the tocolor thing won't work, as the syntax is not what he wrote. About changing the size of a colshape, you can't do it with just changing a variable. This is not a reference variable. After the colshape has been created the variable could be reassigned anything, and it would not effect the size of the colshape at all.

6C73yFv.png

Did I help you?

Mmpe7Jm.gif


NeXuS™#0001

Posted
28 minutes ago, NeXuS™ said:

@maksam07, the tocolor thing won't work, as the syntax is not what he wrote. About changing the size of a colshape, you can't do it with just changing a variable. This is not a reference variable. After the colshape has been created the variable could be reassigned anything, and it would not effect the size of the colshape at all.

I know all this. Just decided to prove to them that it will not work by example. Now I will test my sketches.
By the way, do you understand me well? I use a translator

Posted (edited)

first option:

function inArea( pos1, pos2, size )
	x1, y1, _ = getElementPosition ( pos1 )
	x2, y2, _ = getElementPosition ( pos2 )
	local dis = getDistanceBetweenPoints2D( x1, y1, x2, y2 )
	return size > dis
end

for i, pl in ipairs ( getElementsByType ( "player" ) ) do
	if inArea( pl, marker, getMarkerSize ( marker ) ) then 
		--
	end
end

Then it will be possible to use a marker of any type, but the input / output events from the marker may not work correctly ( It does not seem important to me )

Let me remind you that a bug with transparency only on the marker of the type "checkpoint"

Edited by maksam07

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...