Beamdog / nwn-issues

Neverwinter Nights: Enhanced Edition Technical Bug Tracker
http://nwn.beamdog.com
31 stars 1 forks source link

GetNearestObject() sometimes not returning all objects it should and instead returning some objects twice #689

Open Kamiryn123 opened 1 week ago

Kamiryn123 commented 1 week ago

Describe the bug

1) Start the attached module 2) Without moving the pc start the Debug Script Console pick the pc as OBJECT_SELF and run the script mk_s0_findtrap. The script use GetNearestObject() to list all objects in the area.
3) Without moving the pc pick up the Find Traps scroll. 4) Run the script mk_s0_findtrap again. This time some objects are left out while other are listed twice. 5) Move the pc and run the script again... sometimes the bug is gone, sometimes other object are left out and others are double 6) You can run the script mk_jump_pc to return to the starting location.

In my computer the output looks as in the screenshot

Test_GetNearestObject.zip Test_GetNearestObject

Custom content or overrides used

No response

Game version

36-13

First seen on game version

No response

OS

Windows

Distribution

Steam

Shad000w commented 5 days ago

I've seen this or similar bug in 1.69 while working on Community Patch. I believe I got double target listing also with GetFirst/NextObjectInShape function, but it was super rare and I couldn't find a repro. Plus at that time there was nobody to fix it, and fixing it inside script seemed too heavy solution to me for something that happens so rarely. So, good work on finding a repro, hopefully at least this one gets fixed.

Kamiryn123 commented 5 days ago

Seems to fixed: https://discord.com/channels/382306806866771978/995637334919893082/1311382243599454331