• 0

    posted a message on Huge trigger
    Quote from OverPoweredZeratul: Go

    In my map, I have a really huge trigger and I'm planning to make about 5 more of that size... (When I say huge I mean incredibly humongous)

    Basicly, there are like 45 HUGE If/Then/Elses within the trigger. Would it be better to make 45 triggers to act in the same way instead? I mean would it increase editor or game speed once I'll have the whole bunch of em all at once?

    Or should I start learn scripting? :P (sry lol I dont use it yet...)

    Sounds like that can be reduced to one fairly small trigger by using switch-case, arrays and loops.

    Posted in: Triggers
  • 0

    posted a message on Couple general questions about triggering

    They are also required for loops:

    Player Loop
        Events
        Local Variables
            p = 0 <Integer>
        Conditions
        Actions
            Player Group - For each player p in (All players) do (Actions)
                Actions
                    Player - Make player 1 and player p treat each other as Ally With Shared Vision
    

    Or more fancy stuff, like graph algorithms:

    Does way exists
        Options: Function
        Return Type: Boolean
        Parameters
            u = 0 <Integer>
            v = 0 <Integer>
        Grammar Text: Does way exists(u, v)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            k = 0 <Integer>
            i = 0 <Integer>
            j = 0 <Integer>
            a = false <Boolean[6][6]>
        Actions
            ------- Copy matrix
            General - For each integer i from 0 to 5 with increment 1, do (Actions)
                Actions
                    General - For each integer j from 0 to 5 with increment 1, do (Actions)
                        Actions
                            Variable - Set a[i][j] = Matrix[i][j]
            ------- Floyd-Warshall algorithm
            General - For each integer k from 0 to 5 with increment 1, do (Actions)
                Actions
                    General - For each integer i from 0 to 5 with increment 1, do (Actions)
                        Actions
                            General - For each integer j from 0 to 5 with increment 1, do (Actions)
                                Actions
                                    Variable - Set a[i][j] = (a[i][j] Or (a[i][k] And a[k][j]))
            General - Return a[u][v]
    
    Posted in: Triggers
  • 0

    posted a message on Get the highest Value of (15) Intenger/Real

    Alternative solution:

    Highest Number
        Events
        Local Variables
            array = 0 <Integer[10]>
            highest number = -1000000000 <Integer>
            i = 0 <Integer>
            index of highest number = 0 <Integer>
        Conditions
        Actions
            General - For each integer i from 0 to 9 with increment 1, do (Actions)
                Actions
                    Variable - Set highest number = (Max(highest number, array[i]))
                    Variable - Set index of higtest number = i
    

    "index of highest number" is what you would call the "source".

    Posted in: Triggers
  • 0

    posted a message on How to rescue unit by non-preplaced unit? [SOLVED]

    Choose Comparison, then select unit type and there you are:

    Rescue
        Events
            Unit - Any Unit Enters RegionX
        Local Variables
        Conditions
            (Unit type of (Triggering unit)) == Marine
        Actions
    ...
    
    Posted in: Triggers
  • 0

    posted a message on Question about Reals.

    Reverting back to my second answer... Never compare if two Reals are equal. Maybe there is another way to achieve your goal. What exactly are you trying to do and what goes wrong?

    Posted in: Triggers
  • 0

    posted a message on Question about Reals.

    You could use an integer variable and convert it to a real when setting the transparency. If your using reals, there is something you should absolutely not do: compare if two of them are equal, because that might not happen. Always use a tolerance. In your case I would recommend something like:

    if (dialog transparency >= 100.0-TOLERANCE) then
      set dialog transparency to 100.0
    

    Where tolerance should be 0.1 or 0.01 or something like that.

    or even better:

    local variable: current (Integer)
    
    for each integer current from 1 to 100/step with increment step do actions
    set dialog transparency to Real(current)
    
    Posted in: Triggers
  • 0

    posted a message on Question about Reals.
    Quote from Pshyched: Go

    Im wondering why, whenever my real number gets to 140.52 it adds a 1.. so its, 140.521.... And when you get higher, 141.521 it becomes 141.522 any way to stop this, or change it somehow?

    It could help to see your trigger, because it looks like a numeric problem.

    The thing is, that for example a number such as 0.2 does not exist as a floating point number. It will convert to something like 0.19999998807907104 which is quite close to 0.2, but not exactly. That is because 0.2 is periodic in the binary system and the internal represenation of this number is finite and may be rounded. So it is always wise to use power of two numbers (if possible) like 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, .... to avoid these problems.

    @RileyStarcraft: Do you know if Starcraft 2 uses the IEEE 754 standard?

    Posted in: Triggers
  • 0

    posted a message on 2 diffrent roads in a map?

    Yeah it works. Just added another roadtype and restarted the map and there it is. Thank you.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 2 diffrent roads in a map?

    I have the same question, but I don't even manage to change the road type. How do I do that?

    Posted in: Miscellaneous Development
  • 0

    posted a message on Increasing Art-Scale but not the selection

    This solution doesn't work very well. Is there a way to set an absolute selection radius?

    Posted in: Data
  • 0

    posted a message on [Release] Facility 17 - A Terran RPG

    I don't know if it has been mentioned, but when a unit has time warp on it and uses an ability which isn't supposed to cost a turn, it will destroy the time warp effect.

    some more bugs:

    • restore costed 36sp and I had exactly 36sp, but I was not able to use it.
    • It happens that when (Vaas) having 0Sp the bar still is not empty.
    • Using timewarp and then timewarp again the next round, allows to do three actions (including one timewarp). It seems that you can't take any advantage of that, but it doesn't seem to be the way it is supposed to be.
    Posted in: Project Workplace
  • 0

    posted a message on Placing a structure in empty space

    Unchecking somehow seems to disable the grid, but when its on, I am not allowed to place the structure in space.

    Posted in: Data
  • 0

    posted a message on Increasing Art-Scale but not the selection

    Hi,

    I want a unit to look bigger, so I set the Art-Scale to 2.0 for example. The problem now is, that the selection circle also increases in size, which is something I absolutely do not want. Is there a way to set the size of the selection manually? Or another way to prevent this from happening?

    Thanks in advance.

    EDIT: maybe its not the best solution, but it is possible to adjust the selection scale in the model under Selection Radius.

    Posted in: Data
  • 0

    posted a message on Placing a structure in empty space

    Yeah but when trying to place it in the editor, it can be placed everywhere. It doesn't snap to the grid.

    Posted in: Data
  • 0

    posted a message on [Trigger Debugging] How to open and use the Trigger Debugger
    Quote from Zanam00: Go

    For novices like myself, here was the major issue that I never knew. I had assumed that the Condition of an Event was essentially a built in If-Then-Else statement, no different than any other. How wrong I was. Let's say you have a trigger that fires on a unit dying, and you have five different sets of actions you want to do depending on the type of unit. If you have no condition set up for that event, that event fires every time ANY unit dies, as you might expect. If you DO have a condition, and five seperate triggers (one for each unit type), only the proper trigger will fire, reducing your trigger run count by about 80% from your non-conditioned trigger, and thats assuming you only have five different unit types. Imagine how much efficiency you will have gained if you had 30!

    Wouldn't it be better to just add an OR-condition including all the unit types used in that trigger? So you would still be able to do everything in one trigger, because redundant triggers are very bad style. Internally it would have to check the conditions anyway, so i am not sure about a serious performance gain, but if you want to be sure, I would recommend doing it this way:

    Unit Killed
        Events
            Unit - Any Unit dies
        Local Variables
        Conditions
            Or
                Conditions
                    (Unit type of (Triggering unit)) == Ghost
                    (Unit type of (Triggering unit)) == Marauder
                    (Unit type of (Triggering unit)) == Raven
                    (Unit type of (Triggering unit)) == Thor
        Actions
            General - Switch (Actions) depending on (Unit type of (Triggering unit))
                Cases
                    General - If (Ghost)
                        Actions
                    General - If (Marauder)
                        Actions
                    General - If (Raven)
                        Actions
                    General - If (Thor)
                        Actions
                Default
    
    Posted in: Tutorials
  • To post a comment, please or register a new account.