WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

Negative numbers don't seem to work with ObjectDefinition fields

Open jlfarris91 opened this issue 5 years ago • 5 comments

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 avatar Dec 05 '20 19:12 jlfarris91

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 avatar Dec 05 '20 20:12 jlfarris91

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 avatar Dec 05 '20 23:12 jlfarris91

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.

jlfarris91 avatar Dec 06 '20 00:12 jlfarris91

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 avatar Dec 06 '20 12:12 Frotty

any update on this?

Frotty avatar Feb 11 '21 15:02 Frotty