wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
224 stars 30 forks source link

Negative numbers don't seem to work with ObjectDefinition fields #976

Open jlfarris91 opened 3 years ago

jlfarris91 commented 3 years ago

When trying to create a slow aura ability by setting the move speed factor to a negative number or even modifying the existing Slow Aura (Tornado) ability, for instance, I noticed that the final ability does not have the negative values but instead seems to be clamped to 0. I verified this in-game and in the editor by importing 'wurstCreatedObjects.w3o' into a blank map.

image

The first thing I saw was that presetAttackSpeedFactor and presetMovementSpeedFactor (of AbilityDefinitionAuraSlow) used setLevelsDataUnreal behind the scenes which could explain the clamped value of 0 if the compiler actually clamps the value for unreal expressions. However, I can't seem to find anything in the wurst compiler to suggest that it does...

image

I tried changed them to use their *Real counterparts instead but still no luck. The values still end up being 0 in-game and when viewed in the editor.

image

However, the values in WurstExportedObjects_w3a.wurst are correctly negative and now it is using the correct seLvlDataReal functions.

image

Somewhere between the Wurst call to setLvlDataReal and the final created object the values become 0.

jlfarris91 commented 3 years ago

All that for nothing. I checked the final map output by wurst and the values are negative as expected. Not sure why the imported w3o object data showed them as 0s.

jlfarris91 commented 3 years ago

For anyone else coming across this issue specifically with reducing movement speed: I needed to set the Game Constant Movement - Unit Speed - Minimum to 0 or at least to a value where the difference in movement speeds would actually be noticeable.

jlfarris91 commented 3 years ago

It was not sufficient for me to adjust the Unit Speed - Minimum constant. I was mislead by the original Slow Aura (Tornado) ability working as expected but I have discovered that my custom ability based on it is still not working. The related fields are still zeros in my maps.

Frotty commented 3 years ago

Perhaps the index or something wurst sets isn't correct. They were generated from game files but might have some error. Should create the tornado abil in the map and see what wurst exports it as. e: there seems top be a general problem of wurst not exporting non-wurst objects (?)

Frotty commented 3 years ago

any update on this?