Unusual DelayCommand() Behaviour?

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Unusual DelayCommand() Behaviour?

Post 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?
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post 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.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post 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.
Locked