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.
 
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?
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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