1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Help with triggers/spells

Discussion in 'Triggers & Scripts' started by Knightmawk, May 20, 2009.

  1. Knightmawk

    Knightmawk

    Joined:
    Apr 17, 2008
    Messages:
    44
    Resources:
    0
    Resources:
    0
    ~The triggers are the main thing I need help with the rest I can find tutorials for. I have looked for a while for the right thread but have found very little

    I am trying to set up a trigger that spawns units once every x seconds. I know how to do that but then the problem arises in the manor inwich I wish to do this. If you ever played the map Broken Alliances, I want something like that. You can add units to the spawn for money, just like training them but instead of building them instantly it simply adds them to the spawn list to be spawned every x seconds

    then as for spells I am trying to work transformation spells, but I assume that will be done with triggers and I can figure that out but if you want to give me a pointer or two that would be wonderful.
     
    Last edited: May 21, 2009
  2. RabidParrot

    RabidParrot

    Joined:
    May 7, 2009
    Messages:
    19
    Resources:
    0
    Resources:
    0
    The first solution that pops into my head would be to create a trigger for each type of unit (every x seconds spawn 1 unitA at location). Then do one for unitB, unitC, etc. Have those triggers initially disabled. Then have another trigger that turns them on after certain things happen:

    • Enable (UnitA)
    • Events - A unit finishes a research
    • Conditions - Research is equal to <research>
    • Actions - enable <trigger>


    Though there may be a more efficient way.
     
  3. Coolty44

    Coolty44

    Joined:
    Dec 10, 2008
    Messages:
    576
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Integer variables my friend. Make an integer for it called say... SpawnAmount. Then make another trigger. Make the event something like A unit finishs construction or W/E it is. Then make the condition the building you want. Then the actions should be Set SpawnAmount = SpawnAmount + <what you want added>. Then switch the line Unit- Create X units at Point to Unit-Create SpawnAmount units at Point. I didnt have much time, but I'll add the propper triggers in later
     
  4. Knightmawk

    Knightmawk

    Joined:
    Apr 17, 2008
    Messages:
    44
    Resources:
    0
    Resources:
    0
    is their anyway I can use that, I mean it was a little confusing at first but I figured it out, some of it but can I make that to work to spawn one of unit type when it is researched the first time, then two the second research, etc etc.
     
  5. Coolty44

    Coolty44

    Joined:
    Dec 10, 2008
    Messages:
    576
    Resources:
    1
    Spells:
    1
    Resources:
    1
    If your doing it research way then use integers too.
    • Upgrade
      • Events
        • Unit - A unit Finishes an upgrade
      • Conditions
        • (Current research level of Iron Forged Swords for Player 1 (Red)) Greater than or equal to 0
      • Actions
        • Set SpawnAmount = (Current research level of Iron Forged Swords for Player 1 (Red))

    That will set the amount everytime the upgrade is well... upgraded. Replace player 1 with the correct one
    • Spawn
      • Events
        • Time - Every 60.00 seconds of game time
      • Conditions
      • Actions
        • Set TempPoint = (Center of (Playable map area))
        • Unit - Create SpawnAmount Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
        • Custom script: call RemoveLocation(udg_TempPoint)

    This one creates the units. Notice the SpawnAmount? That will create the number of units based on the level of the research.
    Ask if you have any questions

    Edit: Just saw the change unit stuff. Create a unit variable called UnitType. Make it an array. Set the units you want in the init trigger. Then in the footman part, change it to Unit-Create SpawnAmount UnitType(SpawnAmount) for Player 1 (Red) at TempPoint Bla bla