• 0

    posted a message on [Trigger]

    Disregard. : D I reread the trigger and it made a tad bit more sense. >.>

    Posted in: Triggers
  • 0

    posted a message on Help complete trigger

    @Form01: Go

    Firstly, create a region named Resource #05 and attach it to your Resource #05 unit. This make it easier to work with in the editor, and is what you're telling the editor to create anyway. Took out the leaving event, as it's basically worthless. The leaving unit cannot be within the range of the Resource and be leaving at the same time, so the trigger would never run when a unit leaves the area.

    Resource Capture 5
        Events
            Unit - Any Unit Enters Resource #05
            Unit - Any Unit dies
        Local Variables
            Number of Units = (Count of Any units in Resource #05 owned by player Any Player matching Required: Ground, Structure; Excluded: Missile, Dead, Hidden, with at most Any Amount) <Integer>
        Conditions
            ------- This is basically what you had here before, just not nearly as long, and far easier to read.
            ------- Note that ands are not needed and only make it more difficult to read.
            ((Triggering unit) is in Resource #05) == True
            Number of Units > 0
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    ------- If the unit enters:
                    ------- Check to see if the unit that entered has any enemies in the region.
                    (Count of units in Resource #05 having alliance Enemy with player (Triggering player) matching Required: Ground, Structure; Excluded: Player, Ally, Neutral, Missile, Dead, Hidden, with at most Any Amount) == 0
                Then
                    Unit - Change ownership of Resource #05 unit to player (Triggering player) and Change Color
                Else
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    ------- If a unit dies in the region:
                    ------- Basically the same as above for the first part, except that the addition is that the
                    ------- player has to have a building there already, or it doesn't matter.
                    (Count of units in Resource #05 having alliance Enemy with player (Killing player) matching Required: Ground, Structure; Excluded: Player, Ally, Neutral, Missile, Dead, Hidden, with at most Any Amount) == 0
                    (Count of Any units in Resource #05 owned by player (Killing player) matching Required: Ground, Structure; Excluded: Missile, Dead, Hidden, with at most Any Amount) > 0
                Then
                    Unit - Change ownership of Resource #05 unit to player (Killing player) and Change Color
                Else
    

    There's no reason to have a while loop in there.

    Posted in: Triggers
  • 0

    posted a message on [SOLVED] how to detect if command center -> orbital

    @riftgarret: Go

    I'd use an ability event:

    Any Unit uses Command Center - Upgrade to (Orbital Command/Planetary Fortress) at Generic1 - Any stage (Ignore shared abilities)

    Other than that, I can't really say.

    Posted in: Triggers
  • 0

    posted a message on [Triggers] [Help] some questions about 6 trigger events
    Quote from TheFuriousSam: Go

    1. how to create Nydusworms on specific locationson the map (with Points not in a Region) and make them spawn Units (like you see it through the whole game especially in the all-in Mission)?

    For the first part, create the points in the terrain editor. Then create a variable in your trigger editor named Nydus Worms Location, it's going to be a point variable with an array value set to the maximum you allow for your Nydus Worms - 1 (so if you're going to make 5 nydus worms, the value will be 4,) as well as an integer variable that's named Number of Nydus Worms. After that, add a trigger that detects whatever event you want to set off of the creation of the Nydus Worms. Then you'll add an action to the trigger to create a Nydus Worm at one of those points, an action to set the Nydus Worms Location[Number of Nydus Worms] = (Position of (last created unit)), and finally, Modify Number of Nydus Worms: + 1.

    To get the second part you're inquiring about, you can do it with triggers or the data editor. With triggers, it's as simple as setting the game up to have a periodic event, then creating one local variable: i, an integer.

    For the action, use the While loop, with the condition being i <= Number of Nydus Worms, and the action in the loop being to create whatever units you want to spawn here, and at the end of the loop, modify i: + 1.

    Quote from TheFuriousSam: Go

    2. How do i make an unit Group follow multiple Points one after another ?

    5. How do I make a medivac, hercules, or other dropships follow some Points and then unload/load Units?

    Use the event Unit Enters Point, and then the action Issue Order to Unit Group. I explained the rest of this in the other question you asked. Refer to there for the rest.

    Quote from TheFuriousSam: Go

    3.How do I make rigged nukes anywhere on the map (actually placed with Points) ?

    What exactly are you asking here? o -o

    Quote from TheFuriousSam: Go

    4.How to create random falling debris from the skies falling down as Long as the game goes ?

    All the falling debris I've been able to find is in the Doodads list, which makes it a bit harder to access. Since you have Heart of Swarm, I'd recommend checking out the map that had that happening in. I forgot which one it is.

    Quote from TheFuriousSam: Go

    6.How to create terror-nest like in Hots which spawn Terrors attacking any battlecruiser/Leviathan/Carrier in the air (enemies of course)?

    Again, check out the map in which this is featured. I don't remember which maps these are, or I'd tell ya.

    Posted in: Triggers
  • 0

    posted a message on [Trigger]

    @TheFuriousSam: Go

    Your issue seems to be the ending. Your variables are mismatched: Zerg_spawn_middle has been the group you've been assigning all these guys to, and then suddenly, you're ordering Zerg_middle_spawn to attack?

    I'd suggest trying to use the following action:

    Unit - Issue Order to Unit Group

    Set the Unit Group to Zerg_spawn_middle and then click the blue ( before the Ability Command and select Order Targeting Point, and then set the order to Attack and point to be Zerg_middle_end. In the end it should look like:

    Unit - Order all units in Unit Group to ( Attack targeting Start Location 001) (Replace Existing Orders)

    Other notes, combine your two create units. No point in having the two of them do the exact same thing in a different loop set up.

    Posted in: Triggers
  • 0

    posted a message on [AI Editor] The AI Editor and training custom Units

    @Kanitala: Go

    There is an AI development forum. You're more likely to get a better answer there than here.

    Glad you figured it out, though! : D

    Posted in: Triggers
  • 0

    posted a message on Remove territory from region?

    @azine12345: Go

    The problem is regions themselves. They can't be used for what you're looking for doing. A better way to do this would be to give the supply depots an ability that gives off an AoE buff, which in SC2, is a behavior data type. (To find out how to make one for your supply depots, the Mothership has an ability that cloaks every unit within a certain distance from it. Perfect place to start.) After you've got this ability made and assigned, it's as simple as this:

    Events
        Unit - Any Unit has Supply Depot - AoE Effect change Activate
    

    Use triggering unit to refer to the unit getting the buff. (This was kinda fun to play test. I took a Mothership and just flew it around the map, destroying everything that was supposed to get affected with the cloaking field.)

    The Activate parameter is anyone getting the effect, where as Deactivate is any unit losing the effect.

    Posted in: Triggers
  • 0

    posted a message on Hopefully easier type of randomized terrain.

    @nytemare3701: Go

    First, move

    tree = Agria Tree <Game Link - Unit>

    out of the trigger and into the global area of the editor. At this point, you can either turn it into an array, or make another variable (I'm going to do it this way):

    mineral = mineral <Game Link - Unit>

    Now, make a preset with the following:

    preset_LostForest
        Value Type: Custom Script (Game Link) [Unit type]
        Values
            Tree [Script value: gv_tree]
            Mineral [Script value: gv_mineral]
    

    Note: If you named your tree or mineral global variable anything other than what I showed, your script value will be different than mine. As a general rule, from what I've found, your variable will be name gv_assignedNameExample if you assigned a global variable the name: Assigned Name Example. One way to find this value out for your variables is to click on it. In the Script Identifier text box will be the name of your variable. Then, if you assigned the variable in a trigger, function or structure, it will have lv_ before the name, but if you assigned it in the global box, it will have gv_ before the name.

    Make another global variable now and have it call to the preset we just made. (A preset that's linking global variables apparently cannot be assigned a local variable.) I named mine Stupid Faith. ;P

    Back inside the Create Forest trigger, add the following local variables:

    Mineral Or Tree = (Random integer between 0 and 100) <Integer>
    

    Followed by this if then statement inside the loop, just before you create the unit:

    General - If (Conditions) then do (Actions) else do (Actions)
        If
            Mineral Or Tree <= 90
        Then
            Variable - Set Stupid Faith = Tree
        Else
            Variable - Set Stupid Faith = Mineral
    

    Basically, it's saying that if the tree random variable we set earlier is below the value of 91, then the object that we are going to create will be the tree. If it isn't, then the object will be the mineral. Also, you cannot assign forest to be anything but Tree or Mineral. With this current set up, about 90% of your forest will be trees, and the other 10% will be minerals. Now, modify the previous Unit - Create action to be:

    Unit - Create 1 Stupid Faith for player {X} at rnd_point[0] facing rnd_point[1] (No Options)
    

    After that, simple randomize the Mineral Or Tree integer again with the rest of the re-randomizing:

    Variable - Set Mineral Or Tree = (Random integer between 0 and 100)
    

    This is, of course, assuming you wanted to count the minerals as a part of the forest.

    Edit: ... I like willuwontu's way more. I think I tend to create a lot of work for myself sometimes. ;o

    Posted in: Triggers
  • 0

    posted a message on Hopefully easier type of randomized terrain.

    @nytemare3701: Go

    It would depend on how many trees are being made. If you're looking at a thousand trees, yeah, probably. May even make the user believe that they crashed. If it's not something they'll be seeing for a while, you could always put it on a timer and have it be something like...

    LostForest = reg_LostForest <Region>
    numOtree = 0 <integer>
    
    Create Forest
        Events
            Timer - Every 0.2 seconds of Game Time
        Local Variables
            i = 0 <Integer>
            rnd_point = (Random point in LostForest) <Point[1]>
            tree = Agria Tree <Game Link - Unit>
            maxTreeSpawn = 10 <Integer>
        Conditions
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                    i <= maxTreeSpawn
                Actions
                    Variable - Modify i: + 1
                    Unit - Create 1 tree for player {X} at rnd_point[0] facing rnd_point[1] (No Options)
                    Variable - Modify numOtree: + 1
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            numOtree >= 1000
                        Then
                            Trigger - Stop all instances of Create Lost Forest
                            Trigger - Turn Create Lost Forest Off
                            General - Break
                        Else
                    Variable - Set rnd_point[0] = (Random point in LostForest)
                    Variable - Set rnd_point[1] = (Random point in LostForest)
    

    You can always experiment and play with the variables to get it right. I dunno if it will actually work or not, but it should! I wrote it up quickly in my mod file since I'm too lazy to change over to my actual map and try it out quick. Obviously, your tree, region, and other things may be different, but yeah. If I get bored a bit later I'll copy it over and give it a whirl, then come back here and edit this post. ;o

    Posted in: Triggers
  • 0

    posted a message on Whats the best way to organize an array of values?

    @riftgarret: Go

    Option 1: Presets can be your friend. They do essentially what you're looking for, with the ease of not having to declare a ton of constants. Kinda defeats the purpose of declaring an array if you just go and make constants that point to parts in the array. And if I'm understanding what you're saying correctly, this is the better way to go, and it's easy to still use a loop with them. Do note, however, that the first value listed in a preset is 1 instead of 0.

    So, for example:

    The Preset:

    config_preset
        Value Type: Integer
        Values
            NUMBER_OF_LIVES
            DIFFICULTY_LEVEL
            SOME_OTHER_INFO
    

    (You could make another preset for Difficulty levels, too, if you wanted. Concept is the same.) Then create the action, or action definition (I'd go with definition) and set it so the config variable's array is linked to the config_preset preset.

    Option 2: Records. This option has an advantage of being able to assign many different types of data to it (for example, with a variable linked to a record can be assigned a string, integer, real, and unit.) The disadvantage is that it takes a lot of manual setting as, as far as I know, there is not a way to set a record with a loop.

    A record is easy to create, though. Just click the record (disc?) at the top, give it a name, and then add variables for the items you want to store in this record. Then, create a variable that is a record, linking directly to that record you just made.

    Posted in: Triggers
  • 0

    posted a message on how to replace some order with a stop?

    @strhsxx: Go

    A better way to implement this:

        Events
            Unit - Any Unit is issued an order to  Attack
        Local Variables
        Conditions
            And
                Conditions
                    (Owner of (Target unit for (Triggering order))) != (Player (Owner of (Target unit for (Triggering order))) from (Enemies of player (Triggering player)))
                    (Target unit for (Triggering order)) != No Unit
        Actions
            Unit - Order (Triggering unit) to ( Stop) (Replace Existing Orders)
    

    Vision's trigger would wait until the unit is attacked before it would react, as well as not caring if the attacked unit is allied to the player or not, which would make focus targeting an enemy down hard, as well as allowing the unit to kill the target with enough attack commands.

    Posted in: Triggers
  • 0

    posted a message on Help with trigger plz

    @Form01: Go

    Wait, so you want this to only run for the computer player(s) or only for the actual human players?

    Edit:

    Oh, so you're looking to have it be a contested resource field but to ignore the entering unit if it is a unit that gathers the resources?

    Posted in: Triggers
  • 0

    posted a message on Help with trigger plz

    @Form01: Go

    Not

    • Conditions
      • (Unit type of (Triggering unit)) == +1Income (Terran Small)
      • (Number of Living units in (Any units in (Region((Position of Resource 01 [69.32, 217.92]), 6.0)) owned by player (Picked integer) matching Required: Ground, Structure; Excluded: Ally, Neutral, Enemy, Air, Missile, Dead, Hidden, with at most Any Amount)) > 0

    Your not condition here is saying that if the unit that enters this area that you've defined is NOT a +1Income (Terran Small) unit, then it should run this action. It's also saying that if the number of living units in this area is NOT greater than 0, then it needs to run this action. Both of these are counter productive from what I'm assuming you want to have going on here (and technically, would cause this action to do absolutely nothing, since it is saying that there can't be a unit that's alive in this region for this action to run properly, killing the whole point of having this trigger activate when a unit enters the area.) This should be an AND condition.

    And

    • Conditions
      • (Number of Living units in (Any units in (Region((Position of Resource 01 [69.32, 217.92]), 6.0)) owned by player {(Player {Any Player} from (Allies of player (Picked integer)))} matching Required: Ground, Structure; Excluded: Player, Air, Missile, Dead, Hidden, with at most Any Amount)) == 0

    Why are you using an And here? Actually, what is this condition even LOOKING for? I don't quite understand it.

    Also, this whole thing is redundant. You shouldn't need to be picking out the players and running this for all of them, using the Owner of (Triggering Unit) will work to grab the player's identification, especially since it will only trip for a single player out of the 8 that you're searching through, anyway.

    Posted in: Triggers
  • 0

    posted a message on [Triggers - Records] A few questions

    @willuwontu: Go

    The most I really use them for is keeping track of things. I don't know how the Bit Flags work, but I think I have a pretty good idea how the rest work...

    With the default of integer, each item added to the preset is assigned a number, 1 - x. This can help keep track of things without having to keep a list laying around somewhere, especially with Arrays, to tell you which number is what. It all becomes an easier to read action. [For example, item[0].amount_in_inventory = 5. Now, if I left this map alone for a while, and came back to fix it, or work on it more, I'd have to go and find out what exactly item[0] is. With a preset, I can say: item[Potion].amount_in_inventory = 5. Now I know exactly what item I'm talking about without having to search through triggers to find out what item I assigned here.]

    With the custom script, things get slightly more complicated, but not by much, especially if you understand the galaxy script a bit. For all the settings, there are two different ways to put a value in the preset. For integers and reals, it's as simple as putting in value that is valid for that type. For almost all other things (I haven't looked into this too much,) the value has to be put into "". The other way is to have it call a variable you already set in the galaxy script's way of creating the variables (gv_untitledVariable001 and lv_untitledVariable001 for example.) Putting an incorrect value into a preset's script value area will not throw an error initially. It has to be called before it will cause any errors, and if it does cause an error, the Galaxy Editor will pop up with a box telling you that there's an error when the map is saved, and specify exactly where it is in the galaxy script.

    As you work on the map, though, if you want to find the value of ANY preset, you can simply press the View Raw Data option at the top.

    Posted in: Triggers
  • 0

    posted a message on Custom Triggers Newbee Question

    @Smoketragatu: Go

    Something like this should do the trick:

    Spawn Boss's Zerglings
        Events
            Timer - Every 10.0 secodns game time
        Local Variables
            Number of Zerglings = 0 <Integer>
            i = 0 <Integer>
        Conditions
        Actions
            Variable - Set Number of Zerglings = (Count of Zergling units in (region where they should be; I used entire map) owned by player 15 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
            General - While (conditions) are true, do (Actions)
                Conditions
                    Number of Zerglings <= [max amount]
                    i <= [spawn wave]
                Actions
                    Unit - Create 1 Zergling for player 15 at (region) facing 270.0 degrees (No Options)
                    Variable - Modify Number of Zerlings: + 1
                    Variable - Modify i: + 1
    

    I don't get why, but when I had it set so that it spawned the max amount of allowed zerglings in a single wave, I always got an error. That is why the i is taking care of the spawn waves.

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