nwneetools / nwnsc

Neverwinter Nights Enhanced Edition Script Compiler Project
Other
34 stars 18 forks source link

Unpacked Effects resulting in Stack Underflow #20

Open Aschent89 opened 3 years ago

Aschent89 commented 3 years ago

When compiling scripts with nwnsc that have an unpacked effect, this causes the compiled version to fire STACK UNDERFLOW errors. When compiled in toolset, it functions as expected.

Per Discord; it appears this is related to the inability to handle vectors in the struct.

Aschent89 commented 3 years ago

Although STACK UNDERFLOW doesn't fire, nwnsc also fails to properly compile Unpacked and Repacked Special Abilities (nwnx).

ReachPW commented 1 year ago

I would also like this fixed if possible.

Here are the NWNX methods that can reproduce it: https://nwnxee.github.io/unified/group__effect.html

Which generate this struct: https://nwnxee.github.io/unified/structNWNX__EffectUnpacked.html

Which has two vectors:

vector vParam0

vector vParam1


If anyone is reading this and needs a work around you can modify NWNX to use 3 floats per vector instead:

The workaround is to modify nwnx_effect.nss to use three floats instead of a vector. https://gist.github.com/Daztek/2b998b03ec289330b32ee17fd79fcd7d

(though this is not an ideal solution, since you have to modify and keep your local copy patched every time NWNX updates that file)