| 03-19-2007, 11:52 AM | #1 |
What's the simplest way in RoC (JASS is ok) to put text on the terrain, like in the picture below? ![]() Also, another quick question: do camera actions create memory leaks? Like the following: Events Every 2.00 seconds Actions call SetCameraFieldForPlayer( Player(0), CAMERA_FIELD_TARGET_DISTANCE, 2500.00, 2.00 ) Thanks (p.s. masda thanks for all the help recently) |
| 03-19-2007, 12:11 PM | #2 |
display floating text and set it to never expire |
| 03-19-2007, 12:16 PM | #3 |
Memory leaks are created when you make something and don't destroy it. This only holds true for all subtypes of handels (except things like players, which are never destroyed.) So the only possible leaks you will have are from functions that return a handle, because you are creating something, but possibly never destroying it. Like if you have a function that returns a location, and you do one thing with the location it returns and never use it again, but also never destroy it. |
| 03-19-2007, 04:08 PM | #4 |
Download JassCraft. It has all the natives. The text on the ground your refering to are Text Tags, also known as floating text. If you search in JassCraft for texttag. You will get the following functions (that arn't bj): JASS:native CreateTextTag takes nothing returns texttag native DestroyTextTag takes texttag t returns nothing native SetTextTagAge takes texttag t, real age returns nothing native SetTextTagColor takes texttag t, integer red, integer green, integer blue, integer alpha returns nothing native SetTextTagFadepoint takes texttag t, real fadepoint returns nothing native SetTextTagLifespan takes texttag t, real lifespan returns nothing native SetTextTagPermanent takes texttag t, boolean flag returns nothing native SetTextTagPos takes texttag t, real x, real y, real heightOffset returns nothing function SetTextTagPosBJ takes texttag tt, location loc, real zOffset returns nothing // Added cause it will probally help you out call SetTextTagPos(tt, GetLocationX(loc), GetLocationY(loc), zOffset) endfunction native SetTextTagPosUnit takes texttag t, unit whichUnit, real heightOffset returns nothing native SetTextTagSuspended takes texttag t, boolean flag returns nothing native SetTextTagText takes texttag t, string s, real height returns nothing native SetTextTagVelocity takes texttag t, real xvel, real yvel returns nothing native SetTextTagVisibility takes texttag t, boolean flag returns nothing function TextTagSize2Height takes real size returns real // Added cause it will probally help you out return size * 0.023 / 10 endfunction function TextTagSpeed2Velocity takes real speed returns real // Added cause it will probally help you out. return speed * 0.071 / 128 endfunction Now you have your functions, you need to use them to create your TextTag. You can use this simple few functions for this effect: There a ready made functions that create TextTags, that are bj. They are: JASS:function CreateTextTagLocBJ takes string s, location loc, real zOffset, real size, real red, real green, real blue, real transparency returns texttag set bj_lastCreatedTextTag = CreateTextTag() call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size) call SetTextTagPosBJ(bj_lastCreatedTextTag, loc, zOffset) call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency) return bj_lastCreatedTextTag endfunction And JASS:function CreateTextTagUnitBJ takes string s, unit whichUnit, real zOffset, real size, real red, real green, real blue, real transparency returns texttag set bj_lastCreatedTextTag = CreateTextTag() call SetTextTagTextBJ(bj_lastCreatedTextTag, s, size) call SetTextTagPosUnitBJ(bj_lastCreatedTextTag, whichUnit, zOffset) call SetTextTagColorBJ(bj_lastCreatedTextTag, red, green, blue, transparency) return bj_lastCreatedTextTag endfunction To use the first, you would simply do: call CreateTextTagLocBJ("My Message", MyLocation, 0., 10., 100., 100., 100., 0.) For the second: call CreateTextTagUnitBJ("My Message", MyUnitToCreateOn, 0., 10., 100., 100., 100., 0.) The numbers at the end are in order, offset, size, red, blue, green, alpha(how visable it is). 0. alpha is fully viewable, 50. alpha is 50% invisable, 100 alpha is invisable. The red, blue, green and alpha take reals, which are in percent. These reals are then converted to integers in range from 0-255. |
| 03-19-2007, 07:52 PM | #5 |
This can be used: http://www.wc3campaigns.net/showthread.php?t=87798 But I don't know if the image functions are available in RoC. |
