Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Hi i want to make a research with multiple levels to speed up training time of units but i dont know how to do it.
I have searched through hive but did not find anything useful unfortunatly.
So far i know it would need to be made through JASS or Pausing or Making dummy which would use freeze ability (like frost wyrm) to stop production (also it would be kinda complicated to realize and make it to apply to multiple units).
The research will speed up the training time by some %.
there's no direct trigger for it afaik, so you'd need to use some kind of workaround like you said.
If there's not too many levels to this research then I think the simplest and most reasonable solution to it would be to basically just make duplicates of the same unit with different training times.
So if there's say 3 levels to this upgrade, make 4 (original + 3) versions of every unit that would be affected by this reduction.
You shouldn't really have to care about anything besides the training time and icons for the dummy versions though, as you could give the units berserker upgrade/chaos to instantly morph into the regular unit as soon as they're trained.
there's no direct trigger for it afaik, so you'd need to use some kind of workaround like you said.
If there's not too many levels to this research then I think the simplest and most reasonable solution to it would be to basically just make duplicates of the same unit with different training times.
So if there's say 3 levels to this upgrade, make 4 (original + 3) versions of every unit that would be affected by this reduction.
You shouldn't really have to care about anything besides the training time and icons for the dummy versions though, as you could give the units berserker upgrade/chaos to instantly morph into the regular unit as soon as they're trained.
The biggest problem is that the upgrade has 20 levels and its a map with lots of unit types.
Also the dummy and pausing method is kinda problematic since you cant cancel training while under effect.
Death Adder is correct; there is no way to change the training progress with a trigger. There is an event for it, and there is the Unit - Set <unit> construction progress to <%> action, but the problem is that until the unit is fully trained it doesn't 'exist'. There is no way to refer to it with a trigger. You can get the unit-type of the unit being trained by checking the order given to the building, but you cannot and never will be able to get the unit itself.
The 'simplest' solution is the one proposed already that requires you to have N different versions of each unit for N different upgrade levels. Headache in OE but few triggers. The opposite solution is one with only 2 units-per-unit but involves more complex triggers, as follows:
Instead of training the 'real' units, all of your buildings train dummy versions of the real units they will be called. I'll call them d-Foot for dummy footman and Foot for regular footman in this example.
All d-<unit> types have a training time of, say, 5 seconds or so which allow you to set up a queue of units properly and cancel them if you misclick.
All d-<unit> types have the permanent invulnerability and "ghost (visible)" abilities added to them in the OE. The regular versions of these units do not have these abilities.
Every d-<unit> can upgrade into its regular counterpart (with no cost associated with it); the OE Foot training time + the d-Foot initial training time is the total training time for a Foot. (Players can't do this upgrade themselves because the d-<unit>s have ghost and can't be selected, so a trigger does)
If no unit-type is loaded then it does nothing
If it does load a unit type, it orders the trained d-<unit> to upgrade into that unit, then sets its current upgrade % to whatever is appropriate based on the training speed upgrade level researched for that player
There are two problems with that method: units will be trained simultaneously with only a wait of the base training duration for each unit between units, and units can't be cancelled once they get past that initial training duration.
There are two problems with that method: units will be trained simultaneously with only a wait of the base training duration for each unit between units, and units can't be cancelled once they get past that initial training duration.
I guess the barracks could have it's training paused until the dummy unit is trained/upgraded into a real unit by using frost wyrm's frost breath ability.
Maybe add a fake cancel button on the building as well, so you can cancel the training/upgrade.
Though you still wouldn't be able to see the progress, and it might be confusing if the player sees their barracks seemingly doing nothing without any indicator of a unit being trained, so maybe using a floating text that count down or slapping an extra 'training bar' with the new natives above the barracks...
Actually, you might want to ask for a "GetTrainingUnit" native to be added on the wishlist... wait a minute
JASS:
function GetUnitTrainProgress takes unit factory returns real
//Returns the fraction completion of a unit that is being trained. Returns 1.0 if no unit is being trained.
function SetUnitTrainProgress takes unit factory, real fraction returns nothing
//Modifies the fraction completion of a unit that is currently being trained. A fraction of 1.0 causes the unit to be instantly trained. Does nothing to a factory that is not training anything.
The new natives do not actually care about the unit that's being trained, it just takes the unit that's training another unit and the progress in %. So this does exactly what you want. (Or well, technically it doesn't shorten the training time, but it's as close as you'll get.)
And if you need the research's training speed increase to only affect certain units or have a varying degree of effectiveness etc. then you can make use of the issued order like @Pyrogasm mentioned.
Though I did open up the 1.3 editor and it didn't recognize the function "SetUnitTrainProgress" or "BlzSetUnitTrainProgress". But maybe it's called something else since SetUnitTrainProgress is the name from the 1.29 PTR.
The natives were renamed to have the Blz prefix once the patch went live.
SetUnitBaseDamage
only ever existed in the 1.29 PTR. (it's
BlzSetUnitBaseDamage
now)
Though I did open up the 1.3 editor and it didn't recognize the function "SetUnitTrainProgress" or "BlzSetUnitTrainProgress". But maybe it's called something else since SetUnitTrainProgress is the name from the 1.29 PTR.
As I understand, Kam's list in the natives thread is a compilation of suggested new natives, not implemented new natives. It probably doesn't exist at all.
The easiest way to do it is by creating multiple dummy units that have various training times. These will serve as "icon units" as you will only ever see their icon in your barracks. So when your research is finished dummy 1 will be disabled dummy 2 will be enabled (x amount of dummies for amount of times you can do the research). These dummies don't have to anything other than their description, name, icon, cost, and training time.
When any of these dummies enter the map make a trigger than replaces them with the real unit. It's best to have 1 real unit and multiple training time dummies because that way you can double click the real unit and select all of them - if they were different that would not work. Also this method can be used to change unit gold cost.
I also want to add that you will need a replacement trigger based on the unit availabiliy for already qued units. Unit starts training check if unit is available to player if yes cancel training and then start the training of the new unit with the correct reduced training time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.