• 0

    posted a message on How to write this condition?

    The default when you add condition after condition is "and" (i think it even say so if you click "and" / "or" and read the tooltip. So, we have to add an "or" group. Anything under this will work separately to pass the condition. i == 0,3 and 4 is pretty straight forward. For the last one, I'd like to use the "Within bounds" condition, but that's locked to "<=" on both ends, so we have to add an "and" condition in the "or" group and add the last two conditions here. Dunno why I felt the need to explain this in text form, probably made things more unclear, if anything. Just watch the code, it's pretty self explanatory.

        Conditions
            Or
                Conditions
                    i == 0
                    i == 3
                    i == 4
                    And
                        Conditions
                            i >= 10
                            i < 16
    
    Posted in: Triggers
  • 0

    posted a message on Any idea why this simple trigger doesnt work?

    Might be wrong here, but I believe someone said that that event is bugged. (add a debug message to see if the event ever fires)

    Maybe you could do a periodic check that picks all players in the player group Active instead and removes units for any player not in that group.

    Edit:
    Another thought. The other available options, are Win, Defeat and Tie. Also, the tooltip of the event: "...with the specified victory type."

    It's likely that this event is not supposed to catch players leaving the game without a victory type. I'd assume a player defaults to Loss when they leave, but maybe not.

    Perhaps if you add "UI - Player Any Player selected Quit Button on the Game Menu Dialog" as an additional event (or maybe you only need this one) to catch pleyers leaving your game. Like this:

    any player leaves
        Events
            Player - Player Any Player leaves the game with Any
            UI - Player Any Player selected Quit Button on the Game Menu Dialog
        Local Variables
        Conditions
        Actions
            Unit Group - Pick each unit in (Any units in (Entire map) owned by player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                Actions
                    Unit - Remove (Picked unit) from the game
    
    Posted in: Triggers
  • 0

    posted a message on [Solved][Trigger] Break down a region into points and spawn units

    @johney7289: Go

    Posted my take on this in the original topic since it doesn't really fit here.

    Posted in: Triggers
  • 0

    posted a message on Moving region, creating units

    There are still a few things to deal with here, but the here are the basics how I would do it.
    Move your HT, type "spawn" and "kill" in the chat to run the triggers.

    Thoughts...

    I'm ordering the units to a position relative to where it was when the new order was issued. This means that is they somehow get off course, they will not be able to correct themselves. If this turns out to be an issue you could de-spawn the units each time a move order is issued and recreate them on the correct position (run the kill and spawn triggers followed by the move orders each time). Since your units apparently are invisible, the kill/spawn won't be seen, so this might be what you want to do anyway to avoid random issues later on.

    A unit will be spawned on top of the main unit. I chose observers to avoid collisions in my test enviroment. If needed, you could add a condition to the spawn that checks for the "middle spawn" and skip that unit.

    There are some orders that will cause the follow move orders to misfire. An example is follow orders, the sub units will move to the initial position, but not follow further. Another is if the main unit auto aquires a target and runs off to attack, the move trigger will not fire.
    Running a trigger each 0.5 seconds or so that de-spawns and respawn the units instead of the move order trigger could be a better choice, especially if the units are not seen since it would look quite odd otherwise.

    Hope it helps!

    Posted in: Triggers
  • 0

    posted a message on Moving region, creating units
    Quote from fr0d0b0ls0n: Go

    I don't think you can "fill" a region with units. You can try using Create Unit in Random Point in Region multiple times. I don't know if it will show an error or something is the point is already occupied (there are workarounds for this anyway).

    It won't give an error, the unit will simply be created as close to the position as possible.

    As for the spawning locations, instead of randomly filling the region until x number of units, you could use this method (if the region is rectangular). Make that into a function with the region, unit type to be created and possibly the offset between units as parameters

    Making the entire unit group move as one could also be possible. Once you have the units spawned, issue orders to them, mimicking the main units order with an offset relative to their position in the region. This, however, would break badly as soon as they collide with anything. Depending on your map, I'd try the spawn and remove way first.

    Posted in: Triggers
  • 0

    posted a message on Return name of region

    ... or if the regions only contain hatcheries or other buildings you'd like to loop through, add the buildings to a unit group and use that instead in your for loop.

    There's pretty much always another way of doing the same thing (usually without too much "ugly code") when the editor doesn't let you do it the first way.

    Posted in: Triggers
  • 0

    posted a message on Timer is stuck on "visible"

    What he said.

    Generally, whenever you create something you want to keep track of. Save it to a variable ASAP. Don't use "last created ..." more than you have to.

    Posted in: Triggers
  • 0

    posted a message on Problems issuing orders

    I don't know how you got that to work miheinen. A burrowed zergling cannot be ordered to move or attack since those orders are disabled. I made this work by adding a brief wait before the attack/move order.

    Posted in: Triggers
  • 0

    posted a message on Create Saved Game

    If I'm not mistaken, you can't save games in multiplayer. So you'd either have to play the map in singleplayer mode or store and recall data manually to create your own saves. Where the hero is, who is alive / dead, etc.

    Posted in: Triggers
  • 0

    posted a message on Drawing a line

    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.

    Posted in: Triggers
  • 0

    posted a message on Problems With Shared Minerals

    Yup, that's what I was thinking, except you don't really need a new player just to store a mineral amount. You probably already finished the triggers for this, but it's fun to play around with, so I made one myself.

    I'm using the mineral cost of a unit to avoid having to define variables for each wave / unit. It's not the best for easy overview compared to having a trigger defining each wave... I guess it's not really easier my way either since you still have to modify each cost in the data editor. Well it was really easy to use in my example since I haven't defined anything anywhere. ;-)

    - Global variable
    Mineral pot = 0 <Integer>
    
    - Trigger
    Unit dies / Distribute Minerals
        Events
            Unit - Any Unit dies
        Local Variables
        Conditions
            Or
                Conditions
                    (Owner of (Triggering unit)) == 7
                    (Owner of (Triggering unit)) == 8
        Actions
            Variable - Modify Mineral pot: + (Minerals cost of (Unit type of (Triggering unit)))
            General - While (Conditions) are true, do (Actions)
                Conditions
                    Mineral pot >= (Number of players in (Active Players))
                Actions
                    Player Group - Pick each player in (Active Players) and do (Actions)
                        Actions
                            Player - Modify player (Picked player) Minerals: Add 1
                            Variable - Modify Mineral pot: - 1
    
    Posted in: Triggers
  • 0

    posted a message on Reading unit KillXP with a trigger?

    @EjnarH: Go

    Dooh, it clearly says experience level. Dunno what I was thinking. I probably wasn't. :-p

    Posted in: Triggers
  • 0

    posted a message on Reading unit KillXP with a trigger?

    I haven't tested it myself, but unless this is bugged it should be what you are looking for:

        Events
            Unit - Any Unit dies
        Local Variables
            Exp Gain = (Experience level of (Triggering unit)) <Integer>
        Conditions
        Actions
    
    Posted in: Triggers
  • 0

    posted a message on Commandable/Uncommandable

    Nope, I use the un/commandable functionality as an integral part of my map. Disabling it and enabling it multiple times. I'm guessing your trigger is bugged elsewhere. If you paste the trigger that is supposed to make the units commandable again and any other relevant info, maybe I can find the bug.

    My wild guess would be that you either make the wrong unit commandable, or that the trigger simply isn't running.

    Posted in: Triggers
  • 0

    posted a message on Problems With Shared Minerals

    Try to use the Active Players, player group. Each time anyone score a kill, add x minerals to a variable and share that among all currently active players. If it's an un-even amount, keep part of it in the pot until the next kill.

    Example:
    3 players are active (playing)
    A mob is killed that gives the team 14 minerals
    Each player receives 4 minerals, 2 are left in the pot.
    Another mob is killed (14 minerals)
    Each player receives 5 minerals, 1 remains in the pot.

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