Jump to content

Home

Delaying a script execution


GeorgNihilus

Recommended Posts

Hi people :) this 'should' be pretty simple but it's not working for me :( ... well I'm trying to insert a delay of 15 seconds before firing a script but I'm not succeeding even though the script I'm using is compiling good.

Here's the script I'm dealing with:

 

//:: k_def_death01

/*

Default On Death Script

*/

//:: Created By: Preston Watamaniuk

//:: Copyright © 2002 Bioware Corp.

 

#include "k_inc_switch"

#include "k_inc_debug"

 

void main()

{

DelayCommand (15.0, ExecuteScript("k_spn_selk", OBJECT_SELF));

ExecuteScript("k_spn_selk", OBJECT_SELF);

ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DEATH);

/*

if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))

{

SpeakString("GEN_I_AM_DEAD", TALKVOLUME_SILENT_TALK);

//Shout Attack my target, only works with the On Spawn In setup

SpeakString("GEN_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);

}

if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_DEATH))

{

SignalEvent(OBJECT_SELF, EventUserDefined(1007));

}

*/

}

 

I just added the red marked line, nothing more, but they delay is completely ignored when running the script from the .utc I'm using (OnDeath field). Maybe 'ExecuteScript' is not an action command ... is it? Any ideas? :confused:

 

thanks on advance guys! :waive1:

Link to comment
Share on other sites

Hi people :) this 'should' be pretty simple but it's not working for me :( ... well I'm trying to insert a delay of 15 seconds before firing a script but I'm not succeeding even though the script I'm using is compiling good.

 

The problem is most likely that you are trying to run the delayed command off a dead character. Dead characters (except party members) will be removed from the game world after a few seconds, and as such will not be able to run your script.

 

Try assigning the execute command to some other object that will stick around after the character's death instead. For example:


#include "k_inc_switch"

void main() {
   AssignCommand(GetModule(), DelayCommand (15.0, ExecuteScript("k_spn_selk", OBJECT_SELF)));
   ExecuteScript("k_spn_selk", OBJECT_SELF);
   ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DEATH);
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...