However, I noticed that fairly frequently not all the missiles were appearing. The enemies were there, they were visible, there was line of sight, etc., but only one missile would show up despite multiple enemies in range. So, I added some debug code to the spell that sent a note to nwclientLog1.txt after the calls to GetFirstObjectInShape() and GetNextObjectInShape(). I haven't noticed anything unusual with GetFirstObjectInShape() and GetNextObjectInShape() often seems to work fine. But, when I notice too few missiles, I pause and check the log and see that GetNextObjectInShape() has returned 0x7f000000, which is the invalid object that fails the GetIsObjectValid() test and stops the loop. The problem is that there are valid objects there, often right next to the initial target (which can be a creature or a location).
My call to the function was initially
location lTarget = GetSpellTargetLocation(); // outside the loop oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, lTarget, TRUE, OBJECT_TYPE_CREATURE);and then I thought maybe something funky was going on with the vOrigin variable, so I changed the call to
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_GARGANTUAN, lTarget, TRUE, OBJECT_TYPE_CREATURE, vFirstTarget);where vFirstTarget is defined (also outside the loop as
vector vFirstTarget = GetPositionFromLocation(lTarget);though I have also tested it with the location of the caster; neither is helpful.
Anyway, the issue is that sometimes GetNextObjectInShape() is saying there are no targets left when there are clearly some left. Initially, I was assuming that I had mucked up something else in my code. But, paying closer attention, I can see the same problem with (unmodified) Firebrand, where sometimes it just ignores all but one of the obvious targets.
Am I doing something wrong? Is this a known issue? Is there a fix. Any hints much appreciated.
Modifié par MrZork, 18 août 2010 - 08:55 .





Retour en haut








