Create a unit with triggers, wait and then remove that unit - with variables

draist

Active Member
Reaction score
1
As the title suggests, I am unsure how to make this happen. At the moment it looks like:

Trigger:
  • Player Group - Pick every player in Humans and do (Actions)
    • Loop - Actions
      • Player - Set (Picked player) Current gold to 250
      • Player - Limit training of Heroes to 1 for (Picked player)
      • Camera - Pan camera for (Picked player) to (Center of HumansTavernCreation <gen>) over 0.00 seconds
      • Unit - Create 1 Tavern (Human) for Neutral Passive at (Center of HumansTavernCreation <gen>) facing Default building facing degrees
      • Wait 300.00 seconds


I am unsure of what type of variable I should use. I haven't used variables that much yet but am determined to learn, so any help is more than welcome.

I will make a brief explanation of what it is I want it to and you can point me in the right directions; I want create a tavern so that I can train the selected hero and then after 300 seconds (5 minutes), the tavern is supposed to be removed again. Now the problem is that i have 2 teams (humans and orcs) and both sides get an individual tavern with race appropriate units.

Here's the full trigger:

Trigger:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Item - Create The Flag at (Center of FlagSpawnPoint <gen>)
      • Game - Set game speed to Fastest
      • Game - Lock the game speed
      • Melee Game - Use melee time of day (for all players)
      • Game - Display to (All players) the text: You have 5 minutes ...
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player Group - Add Player 1 (Red) to Humans
          • Player Group - Add Player 2 (Blue) to Humans
          • Player Group - Add Player 3 (Teal) to Humans
          • Player Group - Add Player 4 (Purple) to Humans
          • Player Group - Add Player 5 (Yellow) to Humans
          • Player Group - Add Player 6 (Orange) to Humans
          • Player Group - Add Player 7 (Green) to Orcs
          • Player Group - Add Player 8 (Pink) to Orcs
          • Player Group - Add Player 9 (Gray) to Orcs
          • Player Group - Add Player 10 (Light Blue) to Orcs
          • Player Group - Add Player 11 (Dark Green) to Orcs
          • Player Group - Add Player 12 (Brown) to Orcs
      • Player Group - Pick every player in Humans and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 250
          • Player - Limit training of Heroes to 1 for (Picked player)
          • Camera - Pan camera for (Picked player) to (Center of HumansTavernCreation <gen>) over 0.00 seconds
          • Unit - Create 1 Tavern (Human) for Neutral Passive at (Center of HumansTavernCreation <gen>) facing Default building facing degrees
          • Wait 300.00 seconds
      • Player Group - Pick every player in Orcs and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 250
          • Player - Limit training of Heroes to 1 for (Picked player)
          • Camera - Pan camera for (Picked player) to (Center of OrcsTavernCreation <gen>) over 0.00 seconds
          • Unit - Create 1 Tavern (Orc) for Neutral Passive at (Center of OrcsTavernCreation <gen>) facing Default building facing degrees
          • Wait 300.00 seconds


Also, if anyone knows an easy way to make spells, auras and abilites to scale with Strength, Agility or Intelligence, that would also be more than welcome. And again, I just want you to point me in the right directions, otherwise I won't learn and i'll be stuck asking questions here every other hour.

Thanks in advance and if anything is unclear - please say so and I'll make a better explanation.
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You would want to create a Unit Variable, then set the variable to the tavern after you create it. You would need to create a new Unit Variable for each tavern you plan on creating, or you can create a Unit Variable Array. Though instead of using variables and waits, you could just add an expiration timer to the taverns after they are created, and they will automatically die after the allotted time.
I don't think your trigger is going to do what you want it to though, from the looks of it. You can simplify a lot of it, but first, is there supposed to be 1 tavern created per side? Or 1 tavern created per player?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Which means you should remove the actions
Trigger:
  • Unit - Create 1 Tavern (Orc) for Neutral Passive at (Center of OrcsTavernCreation <gen>) facing Default building facing degrees
and
Trigger:
  • Unit - Create 1 Tavern (Human) for Neutral Passive at (Center of HumansTavernCreation <gen>) facing Default building facing degrees
from the
Trigger:
  • Player Group - Pick Every Player in Player Group and Do Multiple Actions
loop.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top