• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Help with triggers/spells

Status
Not open for further replies.
Level 3
Joined
Apr 17, 2008
Messages
44
~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:
Level 3
Joined
May 7, 2009
Messages
21
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.
 
Level 12
Joined
Dec 10, 2008
Messages
850
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
 
Level 3
Joined
Apr 17, 2008
Messages
44
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.
 
Level 12
Joined
Dec 10, 2008
Messages
850
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
 
Status
Not open for further replies.
Top