Page 1 of 1

Unusual DelayCommand() Behaviour?

Posted: Thu Mar 08, 2007 7:23 pm
by AcadiusLost
Has anyone seen inconsistent behaviour for this function under NWN2? It's seemed to work fine for the Seamless AT system, and in several places in the spawn system, but not in setting a respawn delay.

the specific usage:

Code: Select all

float fRespawnDelaySecs = ACR_GameHoursToRealSeconds(fRespawnDelay);
DelayCommand(fRespawnDelaySecs, _RespawnPoll(oParentWaypoint));

I've confirmed that fRespawnDelaySecs is a reasonably-sized float, but a SendMessageToAllDMs() in the _RespawnPoll() function only seems to fire when fRespawnDelaySecs = 0.0 - I'm not sure what could be to blame for this one. I can try setting some nonzero float delay values, but it's a pretty straightforward usage, really.

Shouldn't be a problem to pass the pointer in a delayed fashion, should it?

Posted: Thu Mar 08, 2007 8:39 pm
by ç i p h é r
The usage looks fine to me. I've not had any problems with DelayCommand, and a simple SendMessage or SpeakString test will confirm if it's running on queue.

Where did you put the SendMessage output? Below any conditionals that might be failing perhaps? The only potential for problems I see is if oParentWaypoint can be destroyed before that script executes. Dunno how the spawn system manages its waypoints but if they're never destroyed, then no worries. Otherwise, you could have a race condition to contend with.

Posted: Sun Mar 11, 2007 10:57 pm
by AcadiusLost
Coming back to this again, in case others have problems: Delaycommands called from OnDeath events will only happen is the delay is 0.0. This is because the Object which is delaying the command no longer exists by the time the delay is up.

Got a better idea now though, on how to do what I was trying to do.