• 0

    posted a message on Attacking a neutral unit to accelerate it.

    I've done that before in another map. I'll paste the relevant parts of that trigger here. Most of my variables are named to make sense when I (you) read the code. But if something is unclear, ask away.

        Local Variables
            Birds path = (Distance between Player[x].Current Position and Rally Click) <Real>
            offset = 0.0 <Real>
    
        Actions
            General - While (Conditions) are true, do (Actions)
                Conditions
                    offset <= Birds path
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Player[x].Current Position offset by offset towards Rally Click) is passable) == false
                        Then
                            Variable - Set Rally Click = Player[x].Current Position
                            Unit - Order Player[x].Hero to ( Set Next Move targeting Player[x].Current Position) (Replace Existing Orders)
                            Variable - Set offset = Birds path
                        Else
                    Variable - Modify offset: + 0.1
    

    When an obstacle is found I want my unit to stay still, but you'll want to change the new order to target the current position on the offset - 0.1 since that was the last position that was clear.

    Afterwards, I set the offset to Birds path so that the while loop ends and doesn't check any more.

    Posted in: Miscellaneous Development
  • 0

    posted a message on [Solved] [Trigger] Check if variables are in sequence?

    Well, if it works, thats all you need to know. :-)

    Posted in: Triggers
  • 0

    posted a message on Attacking a neutral unit to accelerate it.

    So... how does your trigger look? (copy as text, paste here in [code] tags)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Boss bars

    Are you sure you are calling the correct boss bar ID?

    Help us help you. Paste your boss bar triggers here so we can take a look and tell you whats going on and possibly where something has gone wrong.

    Posted in: Triggers
  • 0

    posted a message on Is there a way to display data in text?

    If you adapt the method used in this topic by changing what you convert to, you should be able to pull the data you want.

    Posted in: Triggers
  • 0

    posted a message on Unit switching

    I don't know but that would depend on what resolution the players have... so I'd assume SC2 rescales images to fit. There are probably recommended sizes though, maybe even different ones for wide screen etc.

    Posted in: Triggers
  • 0

    posted a message on [Solved] [Trigger] Check if variables are in sequence?

    Edit: Sorry for the long read, but I just jotted down my thoughts real fast. Hopefully you get what I'm trying to say.

    It is possible to "break" loops and end triggers. But that's sloppy programming and you shouldn't be doing it that way.

    You say that you already check for pairs so that you would not have to do that in straights. Then you say you want to check for the highest value hands first and kill the rest of the trigger when you do find one. This means that you would actually be checking for pairs after straights... maybe this works anyway since a full house contains a pair... but really, I think this gets waay too messy and you have too keep too much in mind. You should do a full check for each hand type. If you're feeling really nifty, you could make functions that look like mine, but do smaller things like, "All cards same suit?" (return true or false), "Hand contains a pair?" (return true or false), "Hand contains 3 of a kind?" (return true or false) etc. Then you can doo cool stuff like:

        If (contains a pair AND contains three of a kind) then "You got a full house yo!"
        else if (contains tree of a kind) then "Nice! Three of a kind.
        etc.
    

    If you place your 13 "if then else" inside each other, it will only check for the next hand combination if the previous one failed.

            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    ------- Royal Straight Flush
                Then
                Else
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ------- Straight Flush
                        Then
                        Else
                            General - If (Conditions) then do (Actions) else do (Actions)
                                If
                                    ------- 4 of a kind
                                Then
                                Else
                                    etc.
    

    I'm just throwing out ideas here and I realize that you are reluctant to change too much in your map since you seem to be nearing a finished version... but the ground work is the most important thing to get right, make it effective and all the other triggers that build on this will be childsplay.

    Posted in: Triggers
  • 0

    posted a message on [Solved] [Trigger] Check if variables are in sequence?

    Another way to do it would be to (copy a players hand to a temp variable and) sort the cards from lowest to highest, then check so that every card equals the last one minus one.

    5,2,8,10,2 would become 2,2,5,8,10 (this would fail the sequence check)
    3,5,6,4,2 would become 2,3,4,5,6 (which would pass the sequence check)

    I'm making a test map for fun and practice that tries to accomplish this in an efficient manner. I'll post it here when done for anyone that wants to see.

    Edit: Finished... This will check for straights. Should be easily adaptable to straight flush and royal straights too.

    ...and yes, as far as I understood that other solution, 5-7-7-7-9 would give a false positive.

    Posted in: Triggers
  • 0

    posted a message on Unit switching

    Ok, I've skimmed through the triggers... I'll look more later but I don't think you can replace a killed unit.. you have to create a new one. Also, i would merge the two for loops. You should always be switching both the killer and killed unit... or nothing. The break isn't really needed either since theres no risk of the killed unit being both an scv and a drone for example.

    ...later...

    You should use "replaced unit" instead of "created unit" when you select a replaced unit. I shrunk the unit type array and defined the rest of the numbers to get rid of the error messages.

    <kinda useless rant>
    The problem seemed to be your conditions, which confused me. I tested several different things.. converted the unit types to strings and displayed them.. changed the unit type variables to plain marine and scv.. It should work. Guess what broke your code? The friggin' 0.2 wait (and I placed most of my testing code before the wait, which is why it looked correct). Apparently that short wait messed up the triggering unit "variable".
    </kinda useless rant>

    What I found out after messing around is that the unit that died is cleared as soon as you "wait" and any variables that pointed to it break ("replace unit" breaks when you wait, so if you do keep the wait, you have to change to create unit, like I did). Basically, if you store any information you want from the unit that dies immediately (before you wait), you'll be fine.

    Posted in: Triggers
  • 0

    posted a message on Problem getting a random lowest from array.

    Probably helps that I'm not a programmer, I just use logic and look for possible solutions from what's available. :-)

    Posted in: Triggers
  • 0

    posted a message on Unit switching

    What exactly is the problem?

    Detecting a tag?
    Changing a unit between runner / tagger?
    Keeping track of who's what and to who?
    etc.
    etc.

    I get the feeling that all of the things needed for such a map are pretty basic, but I don't really feel like building all the triggers for you. Tell us exactly what you are having problems with, and perhaps paste the trigger you can't get to work.

    Posted in: Triggers
  • 0

    posted a message on Problem getting a random lowest from array.

    Ok, I got it. The only thing that bothers me is that I'm apparently not allowed to send an array as a parameter to my function.

    I'm using a temporary array to store the indexes of where the lowest numbers are found and a counter to keep track of the size. Each time a new lowest is found, I reset the temp-array and size.

    Apart from anything that has to be changed to fit in your map and perhaps optimize my ugly code a bit, this seems to be working. What was the problem you had doing this? I found it quite easy and I'm only a hobby programmer... well, maybe not even that.

    Edit: Managed to upload an unsaved, old, version of the test map, should be fixed now.

    Posted in: Triggers
  • 0

    posted a message on Get player resources for terrazine or custom

    It's called player property, I believe.

    ...yup, that's the one. You got a ton of stuff to choose from there.

    Posted in: Triggers
  • 0

    posted a message on Units loading a train

    Another variant would be to temporarily disable the move command for the train and then use the load order. Might work for your scenario unless the marines are train robbers trying to board it on the run. :-)

    Posted in: Triggers
  • 0

    posted a message on Units loading a train

    I'm guessing you're not finding the correct order since you're trying to issue something to the Marines. Marines rightclicking a bunker is using the smart command to load up. If you take a look at a bunker, you'll see an order that pretty much noone (that I know of) use in a normal game.

    Issue Order
        Unit: YourTrain
        Order: Order Targeting Unit
            Ability Command: Bunker - Load (Bunker)
            Unit: YourPassenger
        Queue: Replace Existing Orders
    
    Posted in: Triggers
  • To post a comment, please or register a new account.