Today I imagined how it could be possible to draw lines on the screen, because as far as I know there is no such function in the editor.
My first attempt was using screen images. Because they are limited to 50, this was no option. I then switched over to dialogs.
This is how it works (looks a bit ugly at the moment, because of rounding errors):
With this method, it is possible to store a line in a dialog variable and show/hide/destroy specific lines.
The result could look better (less crippled) using the bresenham algorithm. Because I use circles, these lines could look really good. A radial gradient would even make smooth lines possible.
Another idea would be to store a line in an image and scale/rotate that according to the coordinates. That may give the best looking results and the best performance.
Has anyone already been experimenting with such things?
I Have no experience in drawing lines on the screen, but i suggest using 100x2, 200x2, ... pixels wide imported images.. they are tiny, but the result should be way better. ontop of that, rotating dialog images should be no problem and importing more than one white line for better looking result should also not be too hard..
This way, depending on whats going on on the screen, you should be able to draw pretty much exactly what you want and it even will look better than your method.
Please also note that even though i try to use the most approachable way to do things like this, your method actually already works pretty well (except for the uber CPU usage and bazillions of generated images, ofcourse)
Now I think I got it. It isn't perfectly optimized, but it should be A LOT faster than the previous method. And it looks nearly perfect in my opinion. You can adjust thickness, color and show/hide single lines or even remove them completely.
DrawLineOptions:FunctionReturnType:DialogParametersPlayergroup=(Emptyplayergroup)<PlayerGroup>x0=0<Integer>y0=0<Integer>x1=0<Integer>y1=0<Integer>thickness=0<Integer>Color=Black<Color>GrammarText:DrawLine(Playergroup,x0,y0,x1,y1,thickness,Color)HintText:(None)CustomScriptCodeLocalVariablesdx=0.0<Real>dy=0.0<Real>xm=0<Integer>ym=0<Integer>length=0.0<Real>angle=0<Integer>ActionsDialog-CreateaModaldialogofsize(500,400)at(0,0)relativetoCenterofscreenDialog-Set(Lastcreateddialog)tobefullscreentrueDialog-Hidethebackgroundimageof(Lastcreateddialog)Variable-Setdx=(x1-x0)Variable-Setdy=(y1-y0)------- The length of the lineVariable-Setlength=(Squareroot(((dx^2.0)+(dy^2.0))))------- Find the middle of the lineVariable-Setxm=(Integer((((Real(x0))+(Real(x1)))/2.0)))Variable-Setym=(Integer((((Real(y0))+(Real(y1)))/2.0)))------- The angle of the lineVariable-Setangle=(Integer((Atan2(dx,dy))))Dialog-Createanimagefordialog(Lastcreateddialog)withthedimensions((Integer(length)),thickness)anchoredtoTopLeftwithanoffsetof((xm-((Integer(length))/2)),(ym-(thickness/2)))settingthetooltipto""usingtheimageAssets\Textures\dot.DDSasaNormaltypewithtiledsettofalsetintcolorColorandblendmodeNormalDialog-Set(Lastcreateddialogitem)rotationtoangleforPlayergroupDialog-Show(Lastcreateddialog)forPlayergroupGeneral-Return(Lastcreateddialog)
I asked for something like this a while back, but noone could come up with a real answer. I ended up using a range indicator actor and lowered the distance between images to fill in the gaps. Looks quite nice, but I'll be sure to test this out if I need something that isn't a circle sometime.
These are screen coordinate lines for the interface. I haven't found a way to draw good looking lines in 3D yet, but I think Beam Actors would be the way to go.
This is a more flexible way to do it using a custom action (useful if you want to draw lines in dialogs):
CreatealinefordialogOptions:ActionReturnType:(None)ParametersDialog=(Lastcreateddialog)<Dialog>x0=0<Integer>y0=0<Integer>x1=0<Integer>y1=0<Integer>thickness=1<Integer>Color=(100%,100%,100%)<Color>GrammarText:Createalinefordialog(Dialog)from(x0,y0)to(x1,y1)usingthicknessthicknessandcolorColorHintText:(None)CustomScriptCodeLocalVariablesdx=0.0<Real>dy=0.0<Real>xm=0<Integer>ym=0<Integer>length=0.0<Real>angle=0<Integer>ActionsVariable-Setdx=(Real((x1-x0)))Variable-Setdy=(Real((y1-y0)))------- The length of the lineVariable-Setlength=(Squareroot(((dx^2.0)+(dy^2.0))))------- Find the middle of the lineVariable-Setxm=(Integer((((Real(x0))+(Real(x1)))/2.0)))Variable-Setym=(Integer((((Real(y0))+(Real(y1)))/2.0)))------- The angle of the lineVariable-Setangle=(Integer((Atan2(dx,dy))))Dialog-CreateanimagefordialogDialogwiththedimensions((Integer(length)),thickness)anchoredtoTopLeftwithanoffsetof((xm-((Integer(length))/2)),(ym-(thickness/2)))settingthetooltipto""usingtheimageAssets\Textures\dot.DDSasaNormaltypewithtiledsettofalsetintcolorColorandblendmodeNormalDialog-Set(Lastcreateddialogitem)rotationtoanglefor(Allplayers)
Hello,
Today I imagined how it could be possible to draw lines on the screen, because as far as I know there is no such function in the editor. My first attempt was using screen images. Because they are limited to 50, this was no option. I then switched over to dialogs. This is how it works (looks a bit ugly at the moment, because of rounding errors):
With this method, it is possible to store a line in a dialog variable and show/hide/destroy specific lines.
The result could look better (less crippled) using the bresenham algorithm. Because I use circles, these lines could look really good. A radial gradient would even make smooth lines possible.
Another idea would be to store a line in an image and scale/rotate that according to the coordinates. That may give the best looking results and the best performance.
Has anyone already been experimenting with such things?
@Pfaeff: Go
I Have no experience in drawing lines on the screen, but i suggest using 100x2, 200x2, ... pixels wide imported images.. they are tiny, but the result should be way better. ontop of that, rotating dialog images should be no problem and importing more than one white line for better looking result should also not be too hard..
This way, depending on whats going on on the screen, you should be able to draw pretty much exactly what you want and it even will look better than your method.
Please also note that even though i try to use the most approachable way to do things like this, your method actually already works pretty well (except for the uber CPU usage and bazillions of generated images, ofcourse)
Now I think I got it. It isn't perfectly optimized, but it should be A LOT faster than the previous method. And it looks nearly perfect in my opinion. You can adjust thickness, color and show/hide single lines or even remove them completely.
Cool stuff.
I asked for something like this a while back, but noone could come up with a real answer. I ended up using a range indicator actor and lowered the distance between images to fill in the gaps. Looks quite nice, but I'll be sure to test this out if I need something that isn't a circle sometime.
These are screen coordinate lines for the interface. I haven't found a way to draw good looking lines in 3D yet, but I think Beam Actors would be the way to go.
This is a more flexible way to do it using a custom action (useful if you want to draw lines in dialogs):
Usage: