Trigger

Discussion in 'World Editor Help' started by zll7, Apr 19, 2005.

  1. zll7

    zll7 New Member

    I dont know if this is possable...but ive been trying to make a trigger so that around a building (which you can build) a unit spawns every so many seconds. Any help would be appretiated.
  2. Kaerwynd

    Kaerwynd Guest

    Unit Spawning

    Hello zll7.

    Sd Ryoko posted how to do this. It is wrather easy. I'll walk you through it.

    The first thing you have to do my friend, is place the building on your map.
    Then Add a Region around the building.
    Now open your trigger Editor.
    Add a new category.
    Add a new trigger and Name it (unit name) Spawn *example: Footman Spawn*

    now fill in your events, conditions, and actions as follows.

    Events
    Time - Every ## seconds of game time
    Conditions - none
    Actions
    Unit - Create ## (your unit here) for (Player) at (your Region here) facing 0.00 degrees

    This event should now spawn units around your building according to the number of seconds you input.

    Have fun!!
  3. Seth Cross

    Seth Cross You want to see a magic trick? Staff Member

    Yes, but he's looking for a way to trigger the spawning units AFTER the building is built. (I think, anyway) It appears he doesn't want it to be preplaced, but rather built by a player, and THEN the spawning will take place...

    For now, I'm not 100% sure how to do this, but I'm thinking about it.

    If I have it wrong, then sorry.

    Alexander
  4. Im_On_56k

    Im_On_56k Hm...

    Create "#" "UNIT" at "Position of unit of type"barracks""
    • Like Like x 1
  5. Seth Cross

    Seth Cross You want to see a magic trick? Staff Member

    ...And 56k is a genius! :) However, there's a bit more to it. You're going to have to make two triggers, one to set off the spawning trigger after the barracks is built.

    E: A player finished building a building.
    C: Building is equal to Barracks <or whatever you want the units to spawn around>
    A: Run Spawn, ignoing conditions

    Spawn
    E: Every X seconds
    C:
    A: <Im_On_56k's action here>

    And that should work. (Thanks for the mental boost, 56k!)

    Alexander
    Hope it works.
  6. Im_On_56k

    Im_On_56k Hm...

    Why would you need 2 triggers, it would only create it at the building if its there.
  7. Seth Cross

    Seth Cross You want to see a magic trick? Staff Member

    Hmm, in trying to create a little test, to see if it works, I couldn't find your the right part for your action, 56k.

    "Position of unit-type barracks" <- What action do you use to find that in?

    Alexander
    Maybe it's more complicated then we thought...
  8. Demonfaze

    Demonfaze 8 yrs. Hell, it's been a long time.

    Here's the exact triggers about:

    Code:
    AddToSpawnGroups
        Events
            Unit - A unit Finishes construction
        Conditions
        Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Unit-type of (Triggering unit))  =  FootmanSpawner
                Then - Actions
                    Unit Group - Add (Triggering unit) to FootmenSpawners
                Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Unit-type of (Triggering unit))  =  GruntSpawner
                Then - Actions
                    Unit Group - Add (Triggering unit) to GruntSpawners
                Else - Actions
    Once a building is built, it checks if it is a footman spawner or a grunt spawner, then if its a footman spawner it adds to the footman spawner group, or if its a grunt spawner, it adds to the grunt spawner group. You can add more groups with copy and paste.

    Code:
    SpawnUnits
        Events
            Time - Every 60.00 seconds of game time
        Conditions
        Actions
            Unit Group - Pick every unit in FootmenSpawners and do (Actions)
                Loop - Actions
                    Unit - Create 5 Footman for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Position of (Triggering unit))
            Unit Group - Pick every unit in GruntSpawners and do (Actions)
                Loop - Actions
                    Unit - Create 5 Grunt for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Position of (Triggering unit))
    Every 60 seconds of the game, it picks all the footman spawners and spawns 5 footman for them and picks all the grunt spawners and spawns 5 grunts for them. You can add more with copy and paste.

    If you want those units to move somewhere, like automatically attack the enemy, just tell me and I'll add those actions in if you don't know how.
    • Like Like x 1
  9. Im_On_56k

    Im_On_56k Hm...

    test
    Events
    Time - Every 2.00 seconds of game time
    Conditions
    Actions
    Unit Group - Pick every unit in (Units in (Playable map area)((Unit-type of (Picked unit)) Equal to Barracks)) and do (Actions)
    Loop - Actions
    Unit - Create 1 Footman for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
  10. Seth Cross

    Seth Cross You want to see a magic trick? Staff Member

    Lol, NEVERMIND! :D Wow, Demonfaze, I've noticed you've been quite busy lately. (70+ posts in 2 days! :eek: ) And you're apparently good with triggers...Cool! :) Welcome to the forum, and thanks for setting me and 56k straight! ;)

    Alexander
  11. Im_On_56k

    Im_On_56k Hm...

  12. Demonfaze

    Demonfaze 8 yrs. Hell, it's been a long time.

    Alexander: Thanks for the welcome :cool:.

    56k: Yes, but I'm used to avoiding setting unit groups at periodical events because they create too much memory leaks.

    I know I have leaks with the regions that I could remove, but for simplicity's sake (and I don't think they are as bad as unit group leaks) I just made them the "simple" way.

    -Demonfaze
  13. Kaerwynd

    Kaerwynd Guest

    wow, i'm trying to recreate his triggers just for the experience, and haha i'm havin a hard time finding everything....

    i'm determined though =)
  14. Demonfaze

    Demonfaze 8 yrs. Hell, it's been a long time.

    Haha, determination & patience are like the two most important things in map making (experience with the editor comes in third).

    The first two are "If/Then/Else (multiple Actions)" and inside the "If" is a unit comparison, the "Then" is are Unit Group - Add Unit and the Unit Group it adds them to is a variable with the type of "Unit Group". and the "Else" is just blank.

    The next trigger has two "Unit Group - Pick Every Unit in Unit Group and Do (Multiple Actions)" And inside are just "Unit - Create Units facing Point" Conditions inside those should be pretty easy to find.
  15. Kaerwynd

    Kaerwynd Guest

    I figured it out. Man o Man the things you can do with triggers are just mind boggling....and this whole trigger was a wrather easy one to make. I would hate to see a difficult one.

    Reminds me of when I use to edit Dungeon Seige......@#$@# pains in my @#$@#

    /trigger Add Demonfaze to friends list
    You have added Demonfaze to your friends list!
    You have 1 friend!
    You have improved at socializing (1)!
  16. Demonfaze

    Demonfaze 8 yrs. Hell, it's been a long time.

    Haha ;).

    You can go to the Omnislash thread that was being posted in yesterday, the trigger I put there was like 10 times as long as this one... (and 10 times as hard)

    -Demonfaze
    • Like Like x 1
  17. zll7

    zll7 New Member

    Hey thanks Demonfaze apretiate it.
  18. Kaerwynd

    Kaerwynd Guest

    My comprehenstion level for what the triggers do, boolean, comparrison, all those kinds of triggers is low.

    So I am limited to what I can do because I do not understand those things.

    Hence why I need you all, your my support, my feet. Don't worry, when I take a !@#$ I clean it up.

    :banghead: Break it down :banghead:
  19. Demonfaze

    Demonfaze 8 yrs. Hell, it's been a long time.

    zll7: no prob, thats what this forums is for! ;)

    Kaerwynd: don't worry, you're a lot better than tons of people I've seen. IE: People looking for the "Create a TD button" :D
  20. Kaerwynd

    Kaerwynd Guest

    OMG there is a button for creating TD?!?!

    where?!?!??!?!

    Is there a button for creating Dota maps??!?!?!?!

Share This Page