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

Automatic Building Problems

Status
Not open for further replies.
Level 7
Joined
Feb 13, 2022
Messages
86
Hello hive community! I'm trying to implement an autobuild feature into my map (Rat Maze). There are six player slots all with the ability to build, I don't want every building to have the autobuild feature just some. I have been running into issues with specs of the trigger/s required for this. The glitch with the current system is that if a player tries to spam multiple of buildings that get auto built then, It doesn't kill the correct invisible workers (dummies) and if it kills the wrong worker/dummy then some of the buildings won't get finished being built. I can only imagine how this problem will be amplified when multiple players try out the autobuild system. I was hoping for this system to work like castle fight and kodo tag autobuild systems. Here are my triggers:
pt.1 hive.PNG


pt.2 hive.PNG


pt.3 hive.PNG



Please let me know if you have any suggestions that would fix this problem, thank you for anyone who takes the time to help me out!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Why not make the builder (or was it building?) undead and let the summon mechanic build the building? This way the invisible builder can be instantly removed and the building will finish itself. Another solution would be to make the buildings ancient and use night elf builders so that the invisible worker is automatically consumed on construction so can at most build 1 building.

I would avoid using wait (trigger sleep action), especially in a multiplayer situation. It is not that reliable for game time orientated timing and can produce significantly different results in actually waited time between single player, multiplayer and even between separate multiplayer matches. This is why people usually use timed events or timers for delays.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I don't get exactly what autobuild means, but there is one clear thing causing the problem you described.

when you give the command "remove last created unit" - that doesn't refer to the last unit you created in that specific trigger. it refers to the last unit that was created in game. so when you have a bunch of things going on in game, and all kinds of different triggers and gameplay things that are creating units - it will just kill whatever unit happens to have been most recently created after your 3, or 13 second timer. you can see why this is a highly unreliable way to do things.

In general using the "wait x seconds" command in triggers is something you have to be careful when using, bc it means that any variables that you have set before that in the trigger may have been overwritten by the time the "wait" finishes.

I could try to help you come up with a better solution, but it would help if you could describe what exactly this autobuild system that you want is, and what it is supposed to do.

p.s. - please post with trigger tags and not screenshots, this is much less convenient to read.
 
Level 7
Joined
Feb 13, 2022
Messages
86
I don't get exactly what autobuild means, but there is one clear thing causing the problem you described.

when you give the command "remove last created unit" - that doesn't refer to the last unit you created in that specific trigger. it refers to the last unit that was created in game. so when you have a bunch of things going on in game, and all kinds of different triggers and gameplay things that are creating units - it will just kill whatever unit happens to have been most recently created after your 3, or 13 second timer. you can see why this is a highly unreliable way to do things.

In general using the "wait x seconds" command in triggers is something you have to be careful when using, bc it means that any variables that you have set before that in the trigger may have been overwritten by the time the "wait" finishes.

I could try to help you come up with a better solution, but it would help if you could describe what exactly this autobuild system that you want is, and what it is supposed to do.

p.s. - please post with trigger tags and not screenshots, this is much less convenient to read.
I don't know how to post trigger tags, but I can definitely describe my autobuild system better. So basically the players (Rats) have the ability to build different structures. They can build five different buildings, I want three of the structures to be built automatically (barricade, wall, and stun trap). By built automatically I mean I want them to be able to be self built, like in Kodo Tag or like in Castle Fight. So once the player/s start construction I want the buildings to finish construction without necessarily having the players to do anything. So my main idea to do this, is to create invisible workers that finish the construction of the building/s then die afterwards.
You got any idea how to make this work?
 
Level 14
Joined
Sep 28, 2011
Messages
968
An alternate idea would simply make the building be replaced by a finished building that is paused(as in the unit property that makes the unit keep being animated but stop being able to take actions) but which is brought to low hp as if it just started being built and you use animation: birth to make it look as if it was being built and give it regeneration then make sure you unpause it later.
 
Level 39
Joined
Feb 27, 2007
Messages
5,016
I don't know how to post trigger tags
 
Level 7
Joined
Feb 13, 2022
Messages
86
An alternate idea would simply make the building be replaced by a finished building that is paused(as in the unit property that makes the unit keep being animated but stop being able to take actions) but which is brought to low hp as if it just started being built and you use animation: birth to make it look as if it was being built and give it regeneration then make sure you unpause it later.
I like this idea alot! How would you set up this trigger?
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I don't know how to post trigger tags, but I can definitely describe my autobuild system better. So basically the players (Rats) have the ability to build different structures. They can build five different buildings, I want three of the structures to be built automatically (barricade, wall, and stun trap). By built automatically I mean I want them to be able to be self built, like in Kodo Tag or like in Castle Fight. So once the player/s start construction I want the buildings to finish construction without necessarily having the players to do anything. So my main idea to do this, is to create invisible workers that finish the construction of the building/s then die afterwards.
You got any idea how to make this work?
here's one way you could do this:

to build the auto-building buildings, have the rats build a dummy version of the buildings that has like 0 build time. when the dummy building is finished building it spawns a dummy builder and is removed. the dummy builder builds your building and then is removed.

the way to detect when units need to be removed would not be with timers, but rather separate triggers that detect whenever a unit finishes building or spawning one of those types of units (the dummy builder or the real building) and then removes the spawner/builder.
 
Level 14
Joined
Sep 28, 2011
Messages
968
I like this idea alot! How would you set up this trigger?
By using a local variable, a wait and all the effects I mentioned(replace unit by an unit of the same unit type, set local variable to a replacement of the building being built, put the right commands from the animation tab, give an ability that speed up regeneration, set unit health, pause then a wait then unpause the unit of the local variable and reset its animation settings(make it do the stand animation once and set animation speed to normal values))
 
Last edited:
Level 7
Joined
Feb 13, 2022
Messages
86
Here is what I did to make it work for anyone who is curious on how to make autobuilding work for specific types of buildings :)! Btw thank you everyone for the help!
  • Redautobuild
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructing structure)) Equal to Barricade!
    • Actions
      • Unit - Create 1 Rat Soul! for Player 1 (Red) at (Position of (Constructing structure)) facing Default building facing degrees
      • Set VariableSet RatSoul1 = (Last created unit)
      • Unit - Order RatSoul1 to build a Barricade at (Position of (Constructing structure))
      • Unit - Order Rat 0001 <gen> to Stop.
      • Unit - Remove (Constructing structure) from the game
 
Level 20
Joined
Feb 27, 2019
Messages
592
Here is what I did to make it work for anyone who is curious on how to make autobuilding work for specific types of buildings :)! Btw thank you everyone for the help!
  • Redautobuild
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructing structure)) Equal to Barricade!
    • Actions
      • Unit - Create 1 Rat Soul! for Player 1 (Red) at (Position of (Constructing structure)) facing Default building facing degrees
      • Set VariableSet RatSoul1 = (Last created unit)
      • Unit - Order RatSoul1 to build a Barricade at (Position of (Constructing structure))
      • Unit - Order Rat 0001 <gen> to Stop.
      • Unit - Remove (Constructing structure) from the game
Since all actions happen instantly without waits there is no reason to have a trigger for each player, rather a more generic unit event on a single trigger, dont you think? It will be mui since its instant.

Why is undead build not a solution to this? Am I missing something? Undead already auto build their buildings, no triggers required.
You are missing that NOT ALL building built from the worker should autocomplete. Only a select few. Seems creating a nightelf worker works fine. Only problem would be if the night elf worker failed to build somehow.

Although cant nighelf buildings be cancellled and that would return the worker? Hmm. Kinda seems like undead would be better in theory. Along with that there seems to be an issue with cancelling the building.

Also if it doesnt cost anything to build but the original building does, it will create an issue if its cancelled. Maybe solved by adding the amount to the player just before the building is ordered to be built?
 
Last edited:
Status
Not open for further replies.
Top