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

Hero w/ building skill, don't work as intended

Status
Not open for further replies.
Level 2
Joined
Mar 10, 2021
Messages
15
Hello! I'm currently making a(nother) test map laying the groundwork for my upcoming campaign. Basically, I'm putting everything in without regard to what should be where and when. I'm stuck at this quest when the heroes have to build a base camp.

I realize there's many problems with this quest, both with the triggers and the custom objects, so I'll post the triggers part in the sub-forum.

Breaking down the quest:
First, the melee heroes go chop some wood to gather base materials. Works good.
Second, one of the "advanced" hero (as in modern/futurist, basically a marine) gets a "mark base camp site" summon ability via triggers. Works fine, although not the way I would have liked: I had to make it a circle of power instead of a shadow building of the camp (I did not find any way to do it).
Third, once every melee has enough lumber, all the heroes get a repair ability and the "base camp site" changes to the actual base camp for the heroes to work on. Doesn't work so good.

So, the thing that technically works, is having the camp unit already on the map, hidden at initialization, and replace the camp mark and downed to 1 hp once the lumber is completed, and the heroes can repair the (burning) camp (the camp gets repaired, but the heroes just stand there without moving). Quest can mark as completed.

The thing I want to work, is the camp get build the "normal way", with heroes actually working on it, with resources being used. I triggered a dummy unit to build the camp, but the heroes don't "repair" it. They just stand next to the building site, repair on autocast and the camp don't get built.
 
Level 6
Joined
Oct 31, 2015
Messages
95
Look @ElDestructo your problem has a simple solution, but I don't think it will suit your setting. The reason why your hero does not work at the building is that in the field "Techtree - Structures Built" the building you are trying to make him build is not listed there.

Let's suppose you build a Town Hall with your Peasant, then immediately after your building spawns (still at the building phase with somewhat like 5% health) you order your Peasant to stop building, then you bring your mighty Paladin with a Repair (Human) ability and right-click him into the building. Nothing happens unless Paladin's field "Techtree - Structures Built" has a Townhall listed there. Otherwise, the Paladin will stand there, staring at the building.

Note: Both Repair and "Structures Built: (Your Structure)" are required to make it work. Not having the building in the list OR not having the Repair ability (I think any repair would work) will make this whole idea sink.

The best thing here, I believe at least, is that you trigger a channeled ability that will increase the progress rate of building construction over time. You cannot ADD progress with triggers, you can only SET. So when the building starts being constructed set a variable named Progress or (whatever) to 0% and when your hero channels that ability on a building it will add Total_Build_Time / Loop_Interval to Progress, and then you will SET the building progress to Progress using:

  • Unit - Set (Triggering unit) construction progress to 50%
The Progress variable should be MUI if you want it to happen multiple times. If it is a one-time event a normal variable will do it. MUI aspect is easily obtained with Bribe's Unit Indexer (or Unit Event).
 
Last edited:
Level 2
Joined
Mar 10, 2021
Messages
15
The reason why your hero does not work at the building is that in the field "Techtree - Structures Built" the building you are trying to make him build is not listed there.

That explains a lot! I'll try that. Should it not work, I'll try the trigger you suggest.
Thank you!
 
Last edited:
Level 2
Joined
Mar 10, 2021
Messages
15
UPDATE

So I added the building to "structures built" and you were right: I doesn't fit my setting, because I want the building to be a one-time event. Unless there is a way to add and remove structures to the built list via triggers :vw_wtf:
 
Level 2
Joined
Mar 10, 2021
Messages
15
How can I limit the amount of the building to 0?
And the Build ability, as far as I know, is not listed in "Abilities" because it's entirely dependent on the "Techtree - Structure built". If there's something in it, the unit has Built. If it's empty, no Build.
Or maybe it's been implemented on later patches? I'm still on 1.27🤔
 
Level 23
Joined
Oct 18, 2008
Messages
937
1643222256310.png

like this. should exist in all patches.
you have to use custom script to remove build ability:
call UnitRemoveAbility( udg_unit, 'AHbu')
 
Level 6
Joined
Oct 31, 2015
Messages
95
Another way of doing this is to replace your given hero with a version of him that does not build anything. Be through a morph ability like Bear (you set the alternate version as your hero WITH the build capability and your normal version as your hero WITHOUT the build stuff.
Add it, then remove. Since you will be adding this ability to your builder version while the ability itself expects this to be the normal version of your hero the transformation will occur immediately and your build stuff will be gone.

A simpler solution is to use:
  • Unit - Replace (BuilderFella) with a Non-BuilderFella using The old unit's relative life and mana

Also, make a For Loop from 1 to 6 to copy its inventory to the new unit and save its attributes in variables in case your hero had contact with attribute modification previously, like tomes. Replace does not consider those things, it will create a fresh new hero. The first method will just morph it, retaining items and attribute changes, but it might be a little less friendly in the first attempt.


Edit: How do I quote @doom_sheep? haha. I've misread his answer, consider what I've said but take his solution, it's far better to your case!
 
Last edited:
Level 6
Joined
Oct 31, 2015
Messages
95
'Replace unit' is a bad trigger at all. But it can be handy sometimes especially for people who are new to triggers and want to get things done (under particular circumstances). There are relatively easy workarounds for unit orders and selection, but they are still no match to the simple removal of skill in this case.
 
Level 2
Joined
Mar 10, 2021
Messages
15
@Mirage1 : I tested a «Replace unit» to make veteran versions of non-hero units, once. It did work on a small scale.

@doom_sheep : So, considering that the building quest is not at the start, I could use your suggestion, but the other way around. I add the structure to my hero’s build list, limit it to 0, then once the quest is ready, change the limit to 1, then back to 0 once it’s done?
 
Level 2
Joined
Mar 10, 2021
Messages
15
So I tried the "structures built" thingy and even with a limit of 0, the "build" icon still appears. Since I don't want this, I decided to do the whole thing via triggers. But now, when the heroes gather around the construction site, one of them gets right in the middle of the building-to-be and can't get out. I've put a large pathing blocker in the center of it (it's region-triggered) but I guess it's not large enough.
 
Status
Not open for further replies.
Top