maksam07 Posted August 10, 2017 Share Posted August 10, 2017 (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 August 10, 2017 by maksam07 Link to comment
Simi23 Posted August 10, 2017 Share Posted August 10, 2017 1 hour ago, maksam07 said: setElementVisibleTo( marker, getRootElement(), false ) I think you should use this one and create a lua table or something for the markers, and you can make the markers visible on the map using a loop instead of getElementsByType("marker") Link to comment
_DrXenon Posted August 10, 2017 Share Posted August 10, 2017 Why use a checkpoint when you can use colshapes, they are already invisible and come in plenty shapes; a tube, a cubid a sphere... Link to comment
DonOmar Posted August 10, 2017 Share Posted August 10, 2017 +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. Link to comment
maksam07 Posted August 11, 2017 Author Share Posted August 11, 2017 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? Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 You can create a function which would do it for ya. Link to comment
maksam07 Posted August 11, 2017 Author Share Posted August 11, 2017 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 Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 No, it's not possible without removing and then recreating it. Link to comment
maksam07 Posted August 11, 2017 Author Share Posted August 11, 2017 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 Link to comment
_DrXenon Posted August 11, 2017 Share Posted August 11, 2017 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. Link to comment
maksam07 Posted August 11, 2017 Author Share Posted August 11, 2017 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 Link to comment
_DrXenon Posted August 11, 2017 Share Posted August 11, 2017 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? Link to comment
NeXuS™ Posted August 11, 2017 Share Posted August 11, 2017 @SuperCroz, changing a variable won't change the element's size at all. Link to comment
ShayF2 Posted August 12, 2017 Share Posted August 12, 2017 instead of this - local marker = createMarker ( ax, ay, 0, "checkpoint", aradius, r or 255, g or 255, b or 255, 0 ) setElementAlpha(marker, 0) try this - local marker = createMarker ( ax, ay, 0, "checkpoint", aradius, tocolor( r or 255, g or 255, b or 255, a or 0 ) ) Link to comment
_DrXenon Posted August 12, 2017 Share Posted August 12, 2017 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. Link to comment
NeXuS™ Posted August 12, 2017 Share Posted August 12, 2017 @shay103, that won't work also. @SuperCroz, because that variable doesn't define the size of the element after it had been created. Link to comment
maksam07 Posted August 12, 2017 Author Share Posted August 12, 2017 (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 August 12, 2017 by maksam07 Link to comment
NeXuS™ Posted August 12, 2017 Share Posted August 12, 2017 @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. Link to comment
maksam07 Posted August 12, 2017 Author Share Posted August 12, 2017 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 Link to comment
maksam07 Posted August 12, 2017 Author Share Posted August 12, 2017 (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 August 12, 2017 by maksam07 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now