• 0

    posted a message on Trigger based unit spawner

    @hellmapperextreme2013: Go

    I would use an Action Definition (if you aren't already) and have it look something like:

    Make Units and Create Actions
        Options: Action, Create Thread
        Return Type: (None)
        Parameters
            Unit to Reference <Unit>
            Region <Region>
            Player <Integer>
        Grammar Text: Make Units and Create Actions(Unit to Reference, Region, Player)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            Spawned units = (Empty unit group) <Unit Group>
            Wait time = 0.0 <Real>
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                    (Unit to Reference is alive) == True
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            (Unit type of Unit to Reference) == Supply Depot
                        Then
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Number of Living units in Spawned units) < 10
                                Then
                                    Unit - Create 1 Marine for player Player at (Position of Unit to Reference) using default facing (No Options)
                                    Make Units and Create Actions((Last created unit), (Region((Position of Unit to Reference), 10.0)), Player)
                                Else
                                    General - Wait Wait time Game Time seconds
                        Else
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    (Count of orders on Unit to Reference) == 0
                                Then
                                    Unit - Order Unit to Reference to ( Attack targeting (Random point in Region)) (Replace Existing Orders)
                                Else
                                    General - Wait Wait time Game Time seconds
    

    The way you had it before I think was creating a nested iteration. And suffice it to say you can't have a while loop within a while loop.

    Something similar to @Dryopes: Go, except it figures this out in the same trigger.

    Posted in: Triggers
  • 0

    posted a message on Why use record?

    One thing to mention on the topic is that with the new way the trigger editor works; it works much like a library in the local window. So now you can hide variables and action definitions for use in their local folder only. Making records mostly necessary only if you have a lot of variables in one place.

    Posted in: Triggers
  • 0

    posted a message on (easy) please help spawn units

    @pokenoufl: Go

    Pick each player in Active Players and do
       Actions
         Create unit for player (Picked Player) at [...]
    
    Posted in: Triggers
  • 0

    posted a message on Trying to access value outside an array? [SOLVED]

    Solved. Had a friend come help me. He figured it out.

    Please delete this thread.

    Posted in: Triggers
  • 0

    posted a message on Issue Order Ability Missing

    @Cardanis: Go

    Does the issue order trigger look like this?

    Issue Order
        Unit: Triggering Unit
        Order: Order With No Target
            Ability Command: (No Value)
        Queue: Replace Existing Orders
    

    If so, make sure to change "Order With No Target" to "Order With Target" or otherwise.

    If not please post more information regarding the trigger. A screen capture is preferable.

    Posted in: Triggers
  • 0

    posted a message on Zombie respawn

    @redbean87: Go

    Haha, well I'm glad to hear it worked.

    If you post some code I could try to make sense of it. :P

    Posted in: Triggers
  • 0

    posted a message on Zombie respawn

    @redbean87: Go

    You'd have to add it to the unit after it's created if there are no units on the map.

    Something like:

        Actions
            Unit - Create Y Unit for player X at Point facing whatever degrees (No Options)
            Unit - Add Z amount Behavior to Y from Y
    

    Also, the caster doesn't need to be a different unit. If this was simply for wandering, you can use the same unit as I did.

    If you want to provide threat to a unit through behaviors, then yeah the unit would need to already be on the map at the same time, but you could catalog the unit in an array for use in this situation if you wanted to.

    Posted in: Triggers
  • 0

    posted a message on Zombie respawn

    @redbean87: Go

    Add behavior to unit from caster works...I use it all the time. How exactly are you using it?

    Posted in: Triggers
  • 0

    posted a message on Help creating a room through triggers [SOLVED]

    @SoulTaker916: Go

    With the help of helpful people in the IRC, I was able to use modulation to fix the offset problem.

    I doubt it will work for anyone else without the exact, same, problem but here it is just in case:

    Check and Mark Room (Validation and Marking)
        Options: Function
        Return Type: Boolean
        Parameters
            Size X <Integer>
            Size Y <Integer>
            Point <Integer>
            Region <Integer>
            Facing Opposite <Real>
            Creation Direction Y <Basic Creation Direction>
            Creation Direction X <Basic Creation Direction>
        Grammar Text: Check and Mark Room (Validation and Marking)(Size X, Size Y, Point, Region, Facing Opposite, Creation Direction Y, Creation Direction X)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            Creation Direction Y <Basic Creation Direction>
            Creation Direction X <Basic Creation Direction>
            i = 0 <Integer>
            x = 0 <Integer>
            Final Boolean = True <Boolean>
            Tile Flag = 0 <Integer>
            Additional Offset = 0 <Integer>
        Actions
            Player Group - Pick each player in (Active Players) and do (Actions)
                Actions
                    Set a Loading Bar for (Picked player) containing the text "DEBUG" with the maximum progress of bar one being Size X and the maximum progress of the bar two being Size Y.
            Variable - Set Creation Direction X = Creation Direction X
            Variable - Set Creation Direction Y = Creation Direction Y
            General - Switch (Actions) depending on Creation Direction Y
                Cases
                    General - If (Down)
                        Actions
                    General - If (Left)
                        Actions
                    General - If (Right)
                        Actions
                Default
                    General - Switch (Actions) depending on Creation Direction X
                        Cases
                            General - If (Left)
                                Actions
                            General - If (Up)
                                Actions
                            General - If (Down)
                                Actions
                        Default
                            General - For each integer x from 0 to Size X with increment 1, do (Actions)
                                Actions
                                    Loading Bar (Update)(1, Neutral, "Creating Room", 0, 0, i, x)
                                    General - For each integer i from 0 to Size Y with increment 1, do (Actions)
                                        Actions
                                            General - If (Conditions) then do (Actions) else do (Actions)
                                                If
                                                    (Point + i) <= 47
                                                    (Region + x) <= 83
                                                Then
                                                    Loading Bar (Update)(1, Neutral, "Creating Room", 0, 0, i, x)
                                                    General - If (Conditions) then do (Actions) else do (Actions)
                                                        If
                                                            Flag of Tile[(Region + x)][(Point + i)] == 0
                                                        Then
                                                        Else
                                                            Variable - Set Final Boolean = False
                                                Else
                                                    Variable - Set Final Boolean = False
                                            General - Wait 0.0 Game Time seconds
                                    General - Wait 0.0 Game Time seconds
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Final Boolean == True
                Then
                    General - Switch (Actions) depending on Creation Direction Y
                        Cases
                            General - If (Down)
                                Actions
                            General - If (Left)
                                Actions
                            General - If (Right)
                                Actions
                        Default
                            General - Switch (Actions) depending on Creation Direction X
                                Cases
                                    General - If (Left)
                                        Actions
                                    General - If (Up)
                                        Actions
                                    General - If (Down)
                                        Actions
                                Default
                                    General - For each integer x from 0 to Size X with increment 1, do (Actions)
                                        Actions
                                            Loading Bar (Update)(1, Neutral, "Creating Room", 0, 0, i, x)
                                            General - For each integer i from 0 to Size Y with increment 1, do (Actions)
                                                Actions
                                                    General - If (Conditions) then do (Actions) else do (Actions)
                                                        If
                                                            (x mod 2) == 1
                                                        Then
                                                            Variable - Set Additional Offset = -1
                                                        Else
                                                            Variable - Set Additional Offset = 0
                                                    Loading Bar (Update)(1, Neutral, "Creating Room", 0, 0, i, x)
                                                    General - If (Conditions) then do (Actions) else do (Actions)
                                                        If
                                                            Or
                                                                Conditions
                                                                    x == 0
                                                                    x == Size X
                                                        Then
                                                            General - If (Conditions) then do (Actions) else do (Actions)
                                                                If
                                                                    Or
                                                                        Conditions
                                                                            i == 0
                                                                            i == Size Y
                                                                Then
                                                                    Variable - Set Tile Flag = 2
                                                                Else
                                                                    Variable - Set Tile Flag = 1
                                                        Else
                                                            Variable - Set Tile Flag = 1
                                                    General - If (Conditions) then do (Actions) else do (Actions)
                                                        If
                                                            Or
                                                                Conditions
                                                                    x == 0
                                                                    x == Size X
                                                        Then
                                                            Variable - Set Flag of Tile[(Region + x)][(Point + i)] = Tile Flag
                                                        Else
                                                            Variable - Set Flag of Tile[(Region + x)][(Point + Additional Offset)] = Tile Flag
                                                            Variable - Set Flag of Tile[(Region + x)][(Point + (Size Y + Additional Offset))] = Tile Flag
                                                    General - Wait 0.0 Game Time seconds
                                            General - Wait 0.0 Game Time seconds
                Else
                    Variable - Set Final Boolean = False
    
    Posted in: Triggers
  • 0

    posted a message on Help creating a room through triggers [SOLVED]

    So I am taking the advice of someone from that other thread and am going to post in pieces where I need help.

    I've gotten pretty far along since then but hit a snag when trying to create my validation engine.

    A quick rundown: When a room is being created it has to validate that the points in questions aren't already occupied by tiles. So as not to intersect with walls of other rooms and doodads and what have you. To do this, I need to go through the arduous task of creating tons of math to make sure:

    1. The position isn't above or below the array (outside the map)
    2. the position isn't nonexistent (where a point isn't occupied; near an entry door.) And so on.

    Right now, while I could use help with the whole thing, the only part really getting me is the picture section. It's a debug so that's why it's a function that creates things. Anyway.

    Before continuing:

    1. = wall tile
    2. = corner tile

    So as you can see, when I get in game not only are corner tiles overlapping wall tiles and vice-versa (corner tiles go in the, you guessed it, corner. As fillers to look nice), but one of the wall tiles even shifts down a position.

    One thing I know is that the game catalogs the points in an odd fashion. The first unit to be cataloged into a point is the second in the row, and the second the first.

    Normally this wouldn't matter but maybe fresh eyes will catch something I've been unable to.

    Thanks in advance.

    EDIT: A few things I missed at first.

    1. there is also a(?) wall missing. It may be more, it's hard to tell.
    2. testing takes upwards of 6 minutes because of the way the map initializes. I'll try to get back to people in one bulk post rather than individual posts. If I take a while keep this in mind.
    3. there are 83 regions (or the X of the array) and 47 points per region (or the Y of the array)
    4. in the more recent picture (same file name but I gave a description for this one) not only are most walls shifted up or down incorrectly, but corners just seem to spawn however they want.
    5. my math skills are pretty bad, so please excuse any obvious errors and explain them as detailed as possible.

    Pretty sure that's it. I'll edit in more if I remember more.

    Posted in: Triggers
  • 0

    posted a message on A Solution to Generating Normally-Distributed Random Variables

    @bakonking: Go

    What's the difference?

    Posted in: Triggers
  • 0

    posted a message on Any simple trigger changing weapon?

    @cleanto: Go

    Level Unit Upgrade
        Options: Action, Create Thread
        Return Type: (None)
        Parameters
            Player = 0 <Integer>
            Array # <Real>
            Unit = No Unit <Unit>
        Grammar Text: Level Unit Upgrade(Player, Array #, Unit)
        Hint Text: Levels units via upgrades.
        Custom Script Code
        Local Variables
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Converting to Upgrades == True
                Then
                    General - Switch (Actions) depending on Capping Upgrades
                        Cases
                            General - If (False)
                                Actions
                                    General - Pick each integer from 1 to Maximum Unit Count, and do (Actions)
                                        Actions
                                            General - Switch (Actions) depending on (Unit type of Unit)
                                                Cases
                                                    General - If (Unit Array[(Picked integer)])
                                                        Actions
                                                            General - If (Conditions) then do (Actions) else do (Actions)
                                                                If
                                                                    Increasing Upgrades Beyond 100 == True
                                                                Then
                                                                    General - Switch (Actions) depending on (Upgrade for Unit[(Picked integer)] count for player Player, counting In Progress Or Better)
                                                                        Cases
                                                                            General - If (100)
                                                                                Actions
                                                                                    Tech Tree - Add 1 to Upgrade for Unit x100[(Picked integer)] upgrade for player Player
                                                                                    Tech Tree - Set Upgrade for Unit[(Picked integer)] upgrade level to 0 for player Player
                                                                        Default
                                                                            Tech Tree - Add 1 to Upgrade for Unit[(Picked integer)] upgrade for player Player
                                                                Else
                                                                    Tech Tree - Add 1 to Upgrade for Unit[(Picked integer)] upgrade for player Player
                                                Default
                        Default
                            General - Pick each integer from 1 to Maximum Unit Count, and do (Actions)
                                Actions
                                    General - Switch (Actions) depending on (Unit type of Unit)
                                        Cases
                                            General - If (Unit Array[(Picked integer)])
                                                Actions
                                                    General - If (Conditions) then do (Actions) else do (Actions)
                                                        If
                                                            (Upgrade for Unit W/ Cap[(Picked integer)] count for player Player, counting In Progress Or Better) < Maximum Upgrade W/ Cap Count
                                                        Then
                                                            Tech Tree - Add 1 to Upgrade for Unit W/ Cap[(Picked integer)] upgrade for player Player
                                                        Else
                                                            General - If (Conditions) then do (Actions) else do (Actions)
                                                                If
                                                                    Increasing Upgrades Beyond 100 == True
                                                                Then
                                                                    General - Switch (Actions) depending on (Upgrade for Unit[(Picked integer)] count for player Player, counting In Progress Or Better)
                                                                        Cases
                                                                            General - If (100)
                                                                                Actions
                                                                                    Tech Tree - Add 1 to Upgrade for Unit x100[(Picked integer)] upgrade for player Player
                                                                                    Tech Tree - Set Upgrade for Unit[(Picked integer)] upgrade level to 0 for player Player
                                                                        Default
                                                                            Tech Tree - Add 1 to Upgrade for Unit[(Picked integer)] upgrade for player Player
                                                                Else
                                                                    Tech Tree - Add 1 to Upgrade for Unit[(Picked integer)] upgrade for player Player
                                        Default
                Else
    

    Not sure how well this will work now, as the library I pulled this from is rather old, but the basic premise should remain the same.

    Posted in: Triggers
  • 0

    posted a message on Converting Java to SC2 code

    @Ahli634: Go

    Ah, got it.

    I'm not sure if that would work with my system but I'll see what I can do.

    @Mugen245: Go

    Umm...okay?

    Posted in: Triggers
  • 0

    posted a message on Any simple trigger changing weapon?

    @DuckyTheDuck: Go

    This, but you can also switch weapons via catalog. I forget how, but I've done it before so.

    Unfortunately, you cannot add or remove weapons via catalogs.

    Posted in: Triggers
  • 0

    posted a message on Converting Java to SC2 code

    @Ahli634: Go

    Well right now I think I got the creation down. I use regions to load in the points and so I am using a point array of [84](regions)[47](maximum points) and then manually adding offsets where applicable.

    What I really need to figure out now is how to make sure each room is reachable and that the doors leading to the next room (or basically that generate the next room) are also reachable.

    If you wouldn't mind my asking, what is the basic premise you used?

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