• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] UnitSetContructionProgress wont finish construction

Status
Not open for further replies.
Level 17
Joined
Apr 27, 2008
Messages
2,455
1) I don't have a common.j right now, but IIRC we don't have a such native function.
So you can't, excepted if you use a custom function which catch the construct begin and then use a timer, you will also have to care when the construction is paused.

2) Same (can't check), the argument of UnitSetConstructionProgress is an integer, not a real ?
If it's a real it's more likely a percent, so it would be 1 here.
Anyway just be sure with a GUI example. After all that's the whole purpose of GUI for a jasser ^^
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
So i suppose it's a bug.
Try also to set its life to 100 % (to MAX_LIFE).

If it doesn't work i've an evil trick, add it an instant passive resurrection ability, kill it, remove the ability, you don't need any wait between these actions.
However, the unit will be probably unselected and untargeted.
So maybe using a passive morph ability would be much better.
Try to add a dummy one, remove it without any wait, and then with a wait if it doesn't work.

If none of these solutions work, try to add a morph ability which have the same unitid.
 
Level 2
Joined
Sep 9, 2012
Messages
6
thanks for replies.

life already is at 100%

i have tested the trick with resurrection and i have also tried to remove old unit and create new one at the same location

i did not tried the morphing, because i dont understand it

both ways work but both ways are wrong, you know ...
the problems with selection, targets, all other effects, bufs and so on

i cant accept that solutions, so i will probably try something without the construction at all

once more, thank you for your time
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
"chaos" abilities, you know like in the ROC (or TFT, don't remember) orc campaign, it's a passive ability which transforms the unit to an other one.

So i suggest to create a dummy ability, and try to add/remove it to the construction.

Or to create one with the unit rawcode which is the same of the structure being built and simply add it without removing.
But this last one requires one ability per construction possible.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Just tested one intuition, and it was true.
Use 101 for 100, it seems you need to add 1 to the wanted value.
It was not obvious since even GUI use the native without a such offset.

But the morph tricks also work with 100, and not with lower values as expected, so i don't really know what to think about that. It's the weirdest jass bug i've ever seen.
Anyway, just use 101.

However more tests would be good, i mean if you need to apply this offset every time or just for a complete construction.

EDIT : Ok i couldn't leave it like that and i've made more tests.

When a structure is being built in the native way (i mean without any function call) its life is increased as long it's not finished.
But when it's done with this function, its full life is reached when it's 90 %, probably because they forgot to consider the starting life (10 % of max life), so it's one other bug.

Also this function doesn't take in consideration the current life of the structure being built, unlike the native way, it just set the life according to the percent asked.

Now, since it's annoying to test it precisely i've not made the tests about the function UnitSetConstructionProgress accuracy, in term of construction time.
So either increment the wanted value, or make yourself the tests if you care about accuracy.

Also about the life thing, if in no way the construction life can change (damage or function call), then you can check its construction progress, simply by comparing its current life to the life max.
 
Last edited:
Level 2
Joined
Sep 9, 2012
Messages
6
wow, thanks for all the work you have done.

i have just tried to set it to 101 percent, but it still didnt work. this confuses me a bit, because this should work as you mentioned.

to be more exact:
i use some mechanism to "transfer" energy into that building, which is constructing the building at begin (increases life) and when the life reaches its maximum i call this function to set the building fully constructed. after that, the transfered energy is used to add mana.
to ensure, that the building is not, by mistake, constructed multiple times, i use userdata.

when i have been testing it, its life has been increasing as expected. when it reached the maximum, its construction progress bar jumped to full, but the building still acts unfinished (no abilities). after that, it starts restoring mana, as expected :D
 
Level 2
Joined
Sep 9, 2012
Messages
6
my w3 version is 1.26.0.6401
my w3 editor version is 1.21b (6052) ... this one is from jass new gen pack 5e
can any of this be the problem?

and i also want to apologize for my english, its not my native language
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
Don't double post (at least wait one day between 2 posts).

Even the morph trick doesn't work, i just didn't stop the worker in my previous test.
So without completely remplace the unit i only know this evil kill/revive trick with all the cons.
Or you could also eventually use a dummy worker to finish the structure, sounds lame but that seems the only way without any side effect (except the cost in gold and wood if there is any for the construction)

Oh and btw english is not my native language neither, like the majority of users here i guess.
But your english is decent, at least enough good to be understood by me.
Are you French ? Because it's my native language and if i translate your sentences word by word it sounds french :p
 
Last edited:
Status
Not open for further replies.
Top