• 🏆 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!

[Solved] auto-spawn with food limit trigger

Status
Not open for further replies.
Level 5
Joined
Dec 7, 2009
Messages
96
How can I create a trigger that will stop unit spawn after reaching a certain amount of food? I don't want the region spawn to stop creating units forever, I want the region spawn to create sufficient units to fill up whatever food limit I set it to and fill up the empty food remaining. Any help will be greatly appreciated! :thumbs_up:
 
Level 5
Joined
Dec 7, 2009
Messages
96
every x seconds
if player x food used less than y
then create unit

I tried that and it doesn't work :( This the trigger I have:'
Events
Time - Every 40.00 seconds of game time
Conditions
Actions
Player Group - Pick every player in Player Group - Player 12 (Brown) and do (Actions)
Loop - Actions
Set PlayerBrown = Player Group - Player 12 (Brown)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Player 12 Brown) Food used) Less than 45
Then - Actions
Unit - Create 10 Alien Grunt for Player (Brown at (Center of Second Entrance <gen>) facing Default building facing degrees.
Unit - Create 3 Aliens for Player (Brown at (Center of Second Entrance <gen>) facing Default building facing degrees.
Else - Actions
Do nothing

They don't stop spawning. They keep spawning over the limit :/
 
Last edited:
Level 5
Joined
Dec 7, 2009
Messages
96
  • Entrance 1 spawn Copy
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Player = (Picked player)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player Food used) Less than 45
            • Then - Actions
              • Unit - Create 10 Alien Grunt for Player 12 (Brown) at (Center of Second Entrance <gen>) facing Default building facing degrees
              • Unit - Create 3 for Player 12 (Brown) at (Center of Second Entrance <gen>) facing Default building facing degrees
              • Unit - Create 6 Alien Grunt for Player 12 (Brown) at (Center of First Entrance <gen>) facing Default building facing degrees
              • Unit - Create 2 for Player 12 (Brown) at (Center of First Entrance <gen>) facing Default building facing degrees
              • Unit - Create 10 Alien Grunt for Player 12 (Brown) at (Center of Third Entrance <gen>) facing Default building facing degrees
              • Unit - Create 3 for Player 12 (Brown) at (Center of Third Entrance <gen>) facing Default building facing degrees
              • Player - Set Player Food used to 45
            • Else - Actions
              • Do nothing

Thanks for that lol
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
This works fine for me.

  • Untitled Trigger 006
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: (String((Player 9 (Gray) Food used)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 9 (Gray) Food used) Less than 8
        • Then - Actions
          • Unit - Create 1 Footman for Player 9 (Gray) at (Random point in Region 004 Copy Copy <gen>) facing Default building facing degrees
        • Else - Actions
CroMoX is correct, you're looping through all players, and if any player has les than 45 food used, it creates the units for P12.
 
Level 5
Joined
Dec 7, 2009
Messages
96
It has to do with the condition, since you are doing a loop you have to use picked players food is less than 45

I actually got the loop trigger from some thread in the hive similar to this thread in hopes that it worked but it didn't. So would it be better if I delete this trigger and start a new one? I'm just trying to find the easiest trigger for this to work
 
Level 5
Joined
Dec 7, 2009
Messages
96
This works fine for me.

  • Untitled Trigger 006
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: (String((Player 9 (Gray) Food used)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 9 (Gray) Food used) Less than 8
        • Then - Actions
          • Unit - Create 1 Footman for Player 9 (Gray) at (Random point in Region 004 Copy Copy <gen>) facing Default building facing degrees
        • Else - Actions
CroMoX is correct, you're looping through all players, and if any player has les than 45 food used, it creates the units for P12.

Oh my god, thank you so much! It works! And I really appreciate that you took some of your personal time to make the trigger for me! :grin: +REP!:thumbs_up:

Use makers his is simple and was kind enough to make you one

Yeah I used it. And thanks a lot for taking your time to help me out with my noob problem, too! :grin: +REP! :thumbs_up:
 
Status
Not open for further replies.
Top