• 0

    posted a message on Increasing Efficiency

    @gizmachu: Go

    Imho this is the "right" way to do this, except the multiple calculation of

    (Integer((Substring((Entered chat string), 7, (Length of (Entered chat string))))))
    

    Better to use a variable here. It is more efficient, easier to read and less error-prone.

    Posted in: Triggers
  • 0

    posted a message on Drawing a line

    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):

    Create a line for dialog
        Options: Action
        Return Type: (None)
        Parameters
            Dialog = (Last created dialog) <Dialog>
            x0 = 0 <Integer>
            y0 = 0 <Integer>
            x1 = 0 <Integer>
            y1 = 0 <Integer>
            thickness = 1 <Integer>
            Color = (100%, 100%, 100%) <Color>
        Grammar Text: Create a line for dialog (Dialog) from (x0, y0) to (x1, y1) using thickness thickness and color Color
        Hint Text: (None)
        Custom Script Code
        Local Variables
            dx = 0.0 <Real>
            dy = 0.0 <Real>
            xm = 0 <Integer>
            ym = 0 <Integer>
            length = 0.0 <Real>
            angle = 0 <Integer>
        Actions
            Variable - Set dx = (Real((x1 - x0)))
            Variable - Set dy = (Real((y1 - y0)))
            ------- The length of the line
            Variable - Set length = (Square root(((dx ^ 2.0) + (dy ^ 2.0))))
            ------- Find the middle of the line
            Variable - Set xm = (Integer((((Real(x0)) + (Real(x1))) / 2.0)))
            Variable - Set ym = (Integer((((Real(y0)) + (Real(y1))) / 2.0)))
            ------- The angle of the line
            Variable - Set angle = (Integer((Atan2(dx, dy))))
            Dialog - Create an image for dialog Dialog with the dimensions ((Integer(length)), thickness) anchored to Top Left with an offset of ((xm - ((Integer(length)) / 2)), (ym - (thickness / 2))) setting the tooltip to "" using the image Assets\Textures\dot.DDS as a Normal type with tiled set to false tint color Color and blend mode Normal
            Dialog - Set (Last created dialog item) rotation to angle for (All players)
    

    Usage:

    Test
        Events
            Game - Map initialization
        Local Variables
            line = No Dialog Item <Dialog Item>
        Conditions
        Actions
            Dialog - Create a Modal dialog of size (500, 150) at (0, 0) relative to Center of screen
            Create a line for dialog ((Last created dialog)) from (0, 0) to (150, 150) using thickness 1 and color (100%, 0%, 0%)
            Variable - Set line = (Last created dialog item)
            Dialog - Show (Last created dialog) for (All players)
    
    Posted in: Triggers
  • 0

    posted a message on Edit existing SC2 maps

    btw (sry for digging this up): Does Blizzard allow you to edit and republish their maps?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Drawing a line

    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.

    Draw Line
        Options: Function
        Return Type: Dialog
        Parameters
            Playergroup = (Empty player group) <Player Group>
            x0 = 0 <Integer>
            y0 = 0 <Integer>
            x1 = 0 <Integer>
            y1 = 0 <Integer>
            thickness = 0 <Integer>
            Color = Black <Color>
        Grammar Text: Draw Line(Playergroup, x0, y0, x1, y1, thickness, Color)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            dx = 0.0 <Real>
            dy = 0.0 <Real>
            xm = 0 <Integer>
            ym = 0 <Integer>
            length = 0.0 <Real>
            angle = 0 <Integer>
        Actions
            Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
            Dialog - Set (Last created dialog) to be fullscreen true
            Dialog - Hide the background image of (Last created dialog)
            Variable - Set dx = (x1 - x0)
            Variable - Set dy = (y1 - y0)
            ------- The length of the line
            Variable - Set length = (Square root(((dx ^ 2.0) + (dy ^ 2.0))))
            ------- Find the middle of the line
            Variable - Set xm = (Integer((((Real(x0)) + (Real(x1))) / 2.0)))
            Variable - Set ym = (Integer((((Real(y0)) + (Real(y1))) / 2.0)))
            ------- The angle of the line
            Variable - Set angle = (Integer((Atan2(dx, dy))))
            Dialog - Create an image for dialog (Last created dialog) with the dimensions ((Integer(length)), thickness) anchored to Top Left with an offset of ((xm - ((Integer(length)) / 2)), (ym - (thickness / 2))) setting the tooltip to "" using the image Assets\Textures\dot.DDS as a Normal type with tiled set to false tint color Color and blend mode Normal
            Dialog - Set (Last created dialog item) rotation to angle for Playergroup
            Dialog - Show (Last created dialog) for Playergroup
            General - Return (Last created dialog)
    
    Posted in: Triggers
  • 0

    posted a message on Drawing a line

    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):

    Draw Line
        Options: Function
        Return Type: Boolean
        Parameters
            x0 = 0 <Integer>
            y0 = 0 <Integer>
            x1 = 0 <Integer>
            y1 = 0 <Integer>
            thickness = 0 <Integer>
            anchor = Bottom Left <Anchor>
        Grammar Text: Draw Line(x0, y0, x1, y1, thickness, anchor)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            i = 0 <Integer>
            dx = 0 <Integer>
            dy = 0 <Integer>
            count = 0 <Integer>
            length = 0.0 <Real>
            direction = No Point <Point>
            position X = 0 <Integer>
            position Y = 0 <Integer>
        Actions
            Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
            Dialog - Set (Last created dialog) to be fullscreen true
            Dialog - Hide the background image of (Last created dialog)
            Variable - Set dx = (x1 - x0)
            Variable - Set dy = (y1 - y0)
            Variable - Set length = (Square root((((Real(dx)) ^ 2.0) + ((Real(dy)) ^ 2.0))))
            Variable - Set count = (Integer((length / (Real(thickness)))))
            Variable - Set direction = (Point(((Real(dx)) / length), ((Real(dy)) / length)))
            General - For each integer i from 0 to (count - 1) with increment 1, do (Actions)
                Actions
                    Variable - Set position X = (x0 + (Integer(((Real(i)) * (X of direction)))))
                    Variable - Set position Y = (y0 + (Integer(((Real(i)) * (Y of direction)))))
                    Dialog - Create an image for dialog (Last created dialog) with the dimensions (thickness, thickness) anchored to anchor with an offset of (position X, position Y) setting the tooltip to "" using the image Assets\Textures\white32.dds as a Normal type with tiled set to false tint color White and blend mode Normal
            Dialog - Show (Last created dialog) for (All players)
            General - Return true
    

    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?

    Posted in: Triggers
  • 0

    posted a message on Chrono Triggercraft!

    By custom decals, you mean doodads?

    Posted in: Project Workplace
  • 0

    posted a message on Turning off Fog and War

    yours is shorter ;)

    Posted in: Triggers
  • 0

    posted a message on Problems issuing orders

    You could also try giving the Zergling multiple instructions by using "After Existing Orders".

    Posted in: Triggers
  • 0

    posted a message on Turning off Fog and War

    @Magnum22: Go

    Reveal Map
        Events
        Local Variables
            p = 0 <Integer>
        Conditions
        Actions
            Player Group - For each player p in (All players) do (Actions)
                Actions
                    Visibility - Create a visibility revealer for player p within (Playable map area)
    
    Posted in: Triggers
  • 0

    posted a message on Kill Count not working

    @uiasdnmb: Killing Player works just fine (see my example map).

    Having copies of triggers is always a bad idea to start with. Every instance of redundancy is bad imho if it can be easily avoided. If you have 9 (more or less) equal triggers and you want to change a little thing, you will have to change all 9 triggers and if you forget one of them, you will never find the error.

    You want to know, which player has the most kills? Here is the way to do it:

    Get Player With Most Kills
        Options: Function
        Return Type: Integer
        Parameters
        Grammar Text: Get Player With Most Kills()
        Hint Text: (None)
        Custom Script Code
        Local Variables
            index = 0 <Integer>
            p = 0 <Integer>
            Player With Most Kills = -1 <Integer>
            Most Kills = -1 <Integer>
        Actions
            Player Group - For each player p in (Active Players) do (Actions)
                Actions
                    Variable - Set index = (p - 1)
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            Kills[index] > Most Kills
                        Then
                            Variable - Set Most Kills = Kills[index]
                            Variable - Set Player With Most Kills = p
                        Else
            General - Return Player With Most Kills
    
    Posted in: Triggers
  • 0

    posted a message on simplify move trigger

    Store all your regions in an array and loop through them.

    Posted in: Triggers
  • 0

    posted a message on Kill Count not working

    @Polantaris: Go

    It's maybe because you are using "Last Created Leaderboard", which is not defined at that point.

    Here is a small example map with a working kill counter:

    Posted in: Triggers
  • 0

    posted a message on Bridge + Water = Bug?

    Showing the terrain cells at the border makes it look a bit better, because it is hard to see whats under water. But isn't there another way?

    EDIT: Now it looks acceptable. I used the "Show Terrain Cells" Tool and covered the edges with rocks.

    Posted in: Terrain
  • 0

    posted a message on Bridge + Water = Bug?

    I think, the problem is, that below the bridge, there is a big black hole. This hole then gets filled by the background color and results in this strange rectangle. But I have no plan how to put terrain below the bridge, so you won't see the hole. Or is there a better way?

    Posted in: Terrain
  • 0

    posted a message on Bridge + Water = Bug?

    Hello,

    In my map, i placed a bridge (Castanar Bridge Horizontal Large) via the terrain object tool. Everything works and looks fine, except a strange bug. There is a strange bright rectangle under the bridge. I have marked it on a screenshot:

    Bridge Bug http://img810.imageshack.us/i/bridgebug.jpg/

    Is there a way to fix this?

    Thanks in advance.

    Posted in: Terrain
  • To post a comment, please or register a new account.