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

[Trigger] Structure Constructer

Status
Not open for further replies.
Level 11
Joined
Dec 19, 2012
Messages
411
I believe he meant the unit who starts to construct/finishes a structure, it is triggering unit (for event unit begins construction/finishes construction).
Sorry for the confusion, my bad. (Triggering unit) refers to building which being constructed.

P.S : Asking anything not related to fix in trigger should mostly locates at W.E.H.Z
 
Last edited:
I believe he meant the unit who starts to construct/finishes a structure, it is triggering unit (for event unit begins construction/finishes construction).

Are you suuuuuure? I remember (Triggering Unit) in this instance would return the building that's being built, not the builder :p

@xYours Trulyx To catch the builder, you're going to have to use ConstructEvent. It requires specific Unit Indexers, but can be made to work with Bribe's with this plugin.
 
Blizzard, bad! Honestly if a patch 1.27 drops on our head, I do hope [pipe dream] a bunch of new natives will be added.[/pipe dream]

@xYours Trulyx, if you're wondering how to use that resource (doesn't look like you need help, but just in case), after you have your Event - A unit begins construction, in your actions do:

Custom Script: set udg_UnitVariable = GetStructureBuilder( your building aka triggering unit )

Your builder is now stored in UnitVariable
 
Level 12
Joined
Jan 2, 2016
Messages
973
let me rephrase what you posted with references.
Event: A unit Finishes construction
Conditions:
"1" is equal to 'a'
"1" is equal to 'a'
Actions:
Set Unit_constructedStructure = True

And the 2-nd trigger only checks if a construction-type has been already built.
Doesn't help with finding out who the builder is.
 
Level 6
Joined
Sep 15, 2015
Messages
211
let me rephrase what you posted with references.
Event: A unit Finishes construction
Conditions:
"1" is equal to 'a'
"1" is equal to 'a'
Actions:
Set Unit_constructedStructure = True

And the 2-nd trigger only checks if a construction-type has been already built.
Doesn't help with finding out who the builder is.

Ahhh you need find Who build this building. Sorry.
Wait. Triggering unit is builder.
What is target?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Why won't Blizzard make something useful such as Event Respond - Structure Constructer
Because a buildings "builder" is poorly defined. In theory builders only place foundations, and not actually build.

The big question is why is there no "a unit places a structure foundation" with triggering unit being the builder who placed the foundation and the structure functions being the foundation which was placed.

Anyway it is possible to a high degree of accuracy, but is a real pain to make such a system. When a unit is issued an order to place a foundation you need to remember its X/Y location, its builder, its foundation type and its owning player. When a unit starts construction you then track down which order it corresponded to. This is done by comparing the X/Y coordinate of the structure with some error (units are moved slightly from their order point), making sure the owner matches (builder owner is same as building owner), checking the structure type matches (you can stack foundations for different building types), and that its corresponding builder is nearby (obviously that builder across the map was not responsible for it).

If done correctly it will be 100% accurate for all normal construction cases. It will be 100% accurate with respect to player ownership (who paid for the building). It will not be accurate with respect to a player ordering two different builders to place a foundation at the same spot with both of them being near when one builds, in this case it could credit the wrong builder with placing the foundation. This inaccuracy will likely be harmless and not a source of exploits.

I made such a system for my never completed builder hero. The idea being the number of buildings he could maintain is based on his hero.
 
Level 12
Joined
Jan 2, 2016
Messages
973
Because a buildings "builder" is poorly defined. In theory builders only place foundations, and not actually build.

The big question is why is there no "a unit places a structure foundation" with triggering unit being the builder who placed the foundation and the structure functions being the foundation which was placed.

Anyway it is possible to a high degree of accuracy, but is a real pain to make such a system. When a unit is issued an order to place a foundation you need to remember its X/Y location, its builder, its foundation type and its owning player. When a unit starts construction you then track down which order it corresponded to. This is done by comparing the X/Y coordinate of the structure with some error (units are moved slightly from their order point), making sure the owner matches (builder owner is same as building owner), checking the structure type matches (you can stack foundations for different building types), and that its corresponding builder is nearby (obviously that builder across the map was not responsible for it).

If done correctly it will be 100% accurate for all normal construction cases. It will be 100% accurate with respect to player ownership (who paid for the building). It will not be accurate with respect to a player ordering two different builders to place a foundation at the same spot with both of them being near when one builds, in this case it could credit the wrong builder with placing the foundation. This inaccuracy will likely be harmless and not a source of exploits.

I made such a system for my never completed builder hero. The idea being the number of buildings he could maintain is based on his hero.

My system was doing something similar, but not exactly:
When a peon was ordered to build - I was remembering the x/y of the order.
And then periodically I was checking the distance between all of the builders and the coordinates of their order.
In this check - I was making a list, in which I was ranking the builders by "who is closest to their target".
And when a building was being constructed - I was checking who's the 1-st peon in that list :p
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
My system was doing something similar, but not exactly:
When a peon was ordered to build - I was remembering the x/y of the order.
And then periodically I was checking the distance between all of the builders and the coordinates of their order.
In this check - I was making a list, in which I was ranking the builders by "who is closest to their target".
And when a building was being constructed - I was checking who's the 1-st peon in that list :p
Sounds inefficient. There is no real need to poll since you already have a starts construction event. You just need to match up the construction to its order and find the unit which was issued the order.

To prevent orders leaking in the system when a construction order is canceled you need to track the orders of the units in the system. If one changes its order you need to remove it from the system to prevent leaks.
 
Status
Not open for further replies.
Top