Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.


Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

GetNextObjectInShape bug?

Str8TStr8T Member Posts: 14
Some time ago, me and other players started to notice that sometimes spells doesn't affect all creatures in the area of effect. It was seemingly random but frequent occurrence and it became quite frustrating. There were things like:
- Mass heal didn't heal some allies in the circle, sometimes even a caster
- Bard song didn't buff some allies
- Enemy didn't get damage from some spell
Basically, every AoE spell seemed to have a chance to "misfire" for some reason. Sometimes, spells misfired continuously on single creature, until it moved from the spot where it was standing, then spells started working for it. Players started suspecting it has something to do with auras, like dragon fear or battletide, since creatures under effect of auras were giving problems most often. Sometimes it was enough to move a few steps or push enemy a little and spells started working but other times nothing seemed to help. I investigated spell scripts and my first suspect was the function which loops through creatures around given location - GetNextObjectInShape. Recently, an idea came to me and I've done some testing.

I created a module with single large area (16x16) where I spawn 300 humans in random positions. Then, I've written a function which fires cyclically and counts creatures with GetNextObjectInShape in random position and radius set to 10. For comparison, the creatures are also counted using brute force method, where I loop through all creatures in area (GetNextObjectInArea) and count these which distance to the same random location is less than 10.
- When humans are standing still, counts are the same most of the time. Sometimes the "in shape" method counts more humans, which I assume is because it's taking creature size into account.
- I made these humans wander (ActionRandomWalk) but it didn't seem to change anything.
- I've given all humans an aura of Battletide spell and counts started to mismatch by large margin. My cyclic check reported a difference almost every time. The "in shape" method sometimes registered less than a half of creatures which the "brute distance" method counted.
- I removed wandering and the mismatching persisted.

It seems that auras break the GetNextObjectInShape function and I was able to prove it with my test. I have my test module where the problem can be reproduced consistently. Could this be fixed? Can I somehow workaround this problem? I can share the module if it can help resolving the issue.


Sign In or Register to comment.