• 0

    posted a message on Advanced ability

    I would use wait commands with conditions and/or events (chain triggers) that check for when attacks start, damage done etc.

    To add effects, you can create actors on the units. Just need to find some that fit well.

    Posted in: Triggers
  • 0

    posted a message on Advanced ability

    If all you want is to attack from different angles. I'd pick a random angle (integer) between -179,999... and 180, move/order the unit to that position using point with polar offset. The point is the unit you want the attacks to be centered on and the polar offset is the random angle while the distance is how far away from the attacked unit you wanna be.

    Posted in: Triggers
  • 0

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

    Yup, true. I didn't really think since I answered a similar question before. (I blame Zinatic for reminding me of that old topic, heh). Went on auto pilot answer mode. ;)

    Posted in: Triggers
  • 0

    posted a message on Move Random Unit

    Depends on how and why you need to avoid unit groups. This does use Unit Group functionality, but I don't see a scenario where this couldn't be used.

    The variables are not really needed, but made the code a bit cleaner and easy to read.

    Move Random Unit
        Events
        Local Variables
            Units in Region = (Any units in MyRegion owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) <Unit Group>
            Number of Units in Region = (Number of Living units in Units in Region) <Integer>
            Random Unit = (Random integer between 1 and Number of Units in Region) <Integer>
        Conditions
        Actions
            Unit - Order (Unit Random Unit from Units in Region) to ( Move targeting MyDestination) (Replace Existing Orders)
    
    Posted in: Triggers
  • 0

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

    Loop through the array containing the values multiple times, each time checking so that each value is greater than the one before it. Swap the values if they don't. If no values are swapped in a full loop, you have successfully sorted your array.

    I can modify the map I posted in that other thread to match this scenario if you need help understanding it. Just let me know how your variables are set up so I have something to work with.

    Posted in: Triggers
  • 0

    posted a message on quick timer question

    I haven't been using timers much, but destroying the timer would still leave the window, right? Try hiding the timer window.

    Posted in: Triggers
  • 0

    posted a message on quick timer question

    Don't refer to the timer as "last created timer". Set it to a global variable immediately and use that instead.

    Posted in: Triggers
  • 0

    posted a message on How can you change a units "PITCH" After The Units Created?
    Quote from Twinmold20: Go

    (which is what you need to send as the actor message)

    Ok, didn't know which format was used for that. Still, might be an issue, dunno exactly how he built the trigger.

    Posted in: Triggers
  • 0

    posted a message on How can you change a units "PITCH" After The Units Created?

    Units facing does not return 0 -> 359,9999... but -179,9999... -> 180. You can set an angle to say, 350, but it will return -10. Could maybe be affecting your triggers. I'd assume this "degree standard" is true for any kind of angle.

    Posted in: Triggers
  • 0

    posted a message on Larva Eating Cherry, Please help!

    You'll find that usually you want a very general event. In this case, any unit enters range... other times, any unit dies, a unit starts attacking, etc. Then you use conditions to narrow down the cases you want your trigger to fire. Who got into range of what, who died, who killed, who did damage.

    You want triggers that work for a whole map (yes, there are of course triggers that you only want to run once). Check the tool tip of the event and use the references to what triggered the event (triggering unit, attacking unit, triggering player, acquired target etc.) They make triggering so much easier.

    Posted in: Triggers
  • 0

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

    I briefly considered the idea of cows moving as a group since as it is now, herding would be somewhat tedious / difficult since a group of cows would scatter when you try to "push" them in a direction. You'd have to move around zig zagging a lot to keep them in a natural formation. But if the cows direction were influenced by other cows and even wanting drawn go to fertile ground... Yeah, would definitely be be cool to see that in action.

    Posted in: Miscellaneous Development
  • 0

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

    You don't need to make a unit group of all the cows (unless you continue to use that group later of course). Also, "pick each unit in last created", that shouldn't work, right? You didn't use the create unit action. I assume this was the thing you fixed to get it working.

    Pick Each Unit In Unit Group
        Unit Group: Units In Region Matching Condition
            Unit Type: Any
            Region: Entire Map
            Player: 9
            Unit Filter: Excluded: Missile, Dead, Hidden
            Count: Any Amount
    

    And... nitpicking here but, what exactly does the wait in your Flee Action do? Nothing ever happens afterwards. :-)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Make a unit attack units that are only in a certain region?

    I realize that the problem is already solved, but I found a different approach that does not rely on a periodic trigger.

    This way looks a bit weird since the photon cannon animates a shot even when the shot is canceled. There are probably an easy fix for this.. but I'll leave it as is for now.

    Since units attack the closest target first, it's possible that the cannon gets "locked" on a unit outside the lane, so I added a pick / check loop, similar to Chromium's, to see if any units from the correct lane was attackable. This could be expanded to make sure that the cannon also always picks the closest target.

        Events
            Unit - Any Unit starts attacking
        Local Variables
        Conditions
            (Triggering unit) == Photon Cannon 1
            ((Acquired Target) is in Lane 1) == false
        Actions
            Unit - Disable the Attack ability for (Triggering unit)
            General - Wait 0.1 Game Time seconds
            Unit - Enable the Attack ability for (Triggering unit)
            Unit Group - Pick each unit in (Any units in Lane 1 owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
                Actions
                    General - If (Conditions) then do (Actions) else do (Actions)
                        If
                            ((Triggering unit) can attack (Picked unit)) == true
                        Then
                            Unit - Order (Triggering unit) to ( Attack targeting (Picked unit)) (Replace Existing Orders)
    
    Posted in: Triggers
  • 0

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

    Edit: Oops, I seem to have kept typing a bit much. Ah well, I'll leave it anyway even though most of it is not really needed.

    So... as far as I cal tell from you trigger you are:

    Running the trigger when any unit owned by player 9 (the cows I assume) get close to a specific marine.

    Logically, this feels backwards. It should be the marine that enters within a distance from a cow. Doesn't really matter here though.
    The event may cause a problem if the marine manages to stay within the distance of the cow when it tries to run away, the trigger will not fire again until the marine moves outside the radius and then closer again.

    Distance between cow and marine... tried < 4

    Considering the content of the lop, the first condition seems ok combined with the wait 0.1. It will eventually finish. You are trying to make the trigger last until the cow is outside of the triggering range to avoid the problem I had concerns about in the event. However, if tries exceed 4, this till end the loop before the cow gets far enough away. You might end up having to make the event a periodic trigger instead since when cows are pressed against an obstacle, the cows cannot get outside of the range they want to.

    Variable - Set PathingCost

    I hate the pathing cost function. Because it returns an integer and not a real value, it is very inaccurate. Your pathing cost might be 4.4, 3.9, 4,9. I'm not sure exactly how these numbers are rounded, but they are being rounded, which is bad. Distance between points, however, returns a real number making it even harder to make a good comparison.

    You case, you are checking a point 3 distance away and then making sure it's pathing cost does not exceed 5. Should work, even if we take the inaccuracy into account. The cow will take small detours but not move around large obstacles.

    The problem as I see it is that tries < 4 really does nothing. I assume you added this to make sure the trigger ends when the cow gets stuck on something, but why count to 4? Just do a boolean variable "cow got stuck" and set it to true when the trigger should be aborted (side note, use "modify x: +1" instead of "set x = x + 1" )

    Ok, now I've simply been testing and writing my reactions and thoughts, but basically your trigger works. I entered your trigger exactly as you wrote it into my test map and things work well. You say that it does not work at all for you? The only thing I can think of is that your cows are not actually owned by player 9? Then the event would fire. Or maybe I made a mistake when I copied your code and corrected something without noticing.

    It should work, kind of and your only problem is making the trigger run again even when the marine and cow stays close to each other.

    A way to fix this would be to remake your trigger into a "New Action Definition" with two parameters (the marine and the cow). Replace all references to your marine and cow to these parameters.

    Now, make a new, periodic event trigger that runs every 0.5 seconds or so. "Pick each unit (cow) on the map and do actions" If picked unit close to marine... run the custom action with your marine and the picked unit (cow).

    If you need help making a custom action, let me know.

    Edit 2:
    Ah whatever, it was an easy change after I already had your entire trigger in my map. There was no real need to make a custom action for this, but it looks good and you can easily use it for multiple units like this, just add whatever units you wanna check in the periodic trigger.

    Now, since the Herd action runs automatically every 0.5 seconds, you don't have to keep the code that tried to make sure that the Cow exited the herd range since the triggers will run and check for distance permanently (and without time-out's or warnings since the trigger starts over instead of running an infinite loop). I kept it in the map example I posted since I didn't want to change too much. I'm sure you can figure out what parts are not needed.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Boss bars

    Yeah, same here. My german is very basic too. I agree that what you pasted seems ok.

    I doubt it will help, but I'd pull the periodic check to a new trigger that has a periodic event instead. Have this new trigger disabled by default and enable it from the trigger you pasted. Disable it once again when you don't need it.

    I'm not a big fan of triggers that loop until X happens, and sometimes they actually make things break.

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