That's the Q. I need to Delay the plot flag to stop after some time but you can't do it with delay command... Is there a way?
how can I delay a Set Plot Flag?
Débuté par
psiiijay
, juin 26 2013 07:56
#1
Posté 26 juin 2013 - 07:56
#2
Posté 26 juin 2013 - 07:57
Oooops, Yes you can 
Sorry!
Sorry!
#3
Posté 27 juin 2013 - 04:04
In general, for non-void functions you want to set on delay, you can just use a wrapper function:
void DelaySetPlotFlag(int iPlot) {
SetPlotFlag(iPlot);
}
and then use the wrapper in your main script:
DelayCommand(12.0, DelaySetPlotFlag(FALSE));
void DelaySetPlotFlag(int iPlot) {
SetPlotFlag(iPlot);
}
and then use the wrapper in your main script:
DelayCommand(12.0, DelaySetPlotFlag(FALSE));
#4
Posté 27 juin 2013 - 06:03
great thanks- but I think that just delaying it normally compiles fine- won't it still work?
#5
Posté 27 juin 2013 - 11:49
Yeah, but the wrapper is how you deal with other functions that don't compile.
#6
Posté 28 juin 2013 - 06:57
Btw- for some reason my delaycommand does not work and the wrapper you gave me does not compile.
#7
Posté 28 juin 2013 - 03:32
Lugaids script does not compile because the object of the plot flag is missing. It should be:
void DelaySetPlotFlag(object oTarget, int iPlot) {
SetPlotFlag(oTarget, iPlot);
}
call it by
DelayCommand(12.0, DelaySetPlotFlag(OBJECT_SELF, FALSE));
If it is still not working:
From where do you call the function? If you destroy that object, also all of its delayed function will be canceled. If that is the problem, write a wrapper script "delayedSetPlotFlag" where you call DelayCommand(...), and call this script with ExecuteScript("delayedSetPlotFlag", GetModule()) from your original script.
void DelaySetPlotFlag(object oTarget, int iPlot) {
SetPlotFlag(oTarget, iPlot);
}
call it by
DelayCommand(12.0, DelaySetPlotFlag(OBJECT_SELF, FALSE));
If it is still not working:
From where do you call the function? If you destroy that object, also all of its delayed function will be canceled. If that is the problem, write a wrapper script "delayedSetPlotFlag" where you call DelayCommand(...), and call this script with ExecuteScript("delayedSetPlotFlag", GetModule()) from your original script.
#8
Posté 28 juin 2013 - 07:31
That's probably it; a delayed command forgets the calling object.
#9
Posté 28 juin 2013 - 11:08
So if it works for delayed commands, does that mean it's safe to use ExecuteScript in an OnDeath slot to make sure the entire contents fire when a creature is dying?
#10
Posté 29 juin 2013 - 07:41
Tchos wrote...
So if it works for delayed commands, does that mean it's safe to use ExecuteScript in an OnDeath slot to make sure the entire contents fire when a creature is dying?
Yes, that is safe, although not bullet proof. The problem is if the player saves and reloads. Delayed commands are not stored in the savegame, so never put anything in a delayed command if the failure of its execution is game-breaking.





Retour en haut






