Sometimes if the PC casts a spell at just the wrong time or for some reason gets killed at just the wrong time, the conversation that is called in the on death script of the opponents will not fire, despite the usual precautions of clearing all actions, removing effects, resurrecting the speakers, providing for ample delay, removing areas of effect (so spells don't re kill arecently revived speaker).
So I made a conversation kick starter.
It is a function that contains all the usual precautions for starting a conversation after a battle and also causes the conversation to happen. It starts with a conditional that checks to see if the PC is in conversation. If the PC is in conversation, it returns and does nothing. If the PC is not in conversation (i.e. the conversation did not start for some reason) it will run and start the conversation, and also call itsself again in 2 seconds, just in case the kick start did not fire.
I have only used it in one place that seems particularly buggy (likely due to the fact that there are about 60 creatures in the battle and the PC has abut 10 players in the party at this point).
I'm interested to hear other scripters' perspective on this technique and any cautions or suggestions.
________________________________________________
void Kickstart()
{
object oPC = GetFirstPC();
object oArea = GetArea(oPC);
object oSelf = OBJECT_SELF;
effect eResurrection = EffectResurrection();
//only fire if PC is in conversation
if (!IsInConversation(oPC))
{
if (GetIsDead(oPC))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,eResurrection,oPC);
}
object oSpeaker = oPC;
ExecuteScript("ga_remove_aoe",oSelf);
DelayCommand(0.3,RemoveAllEffects(oSpeaker,TRUE));
DelayCommand(0.4,AssignCommand(oSpeaker,ClearAllActions(TRUE)));
DelayCommand(0.5,AssignCommand(oSpeaker,ActionStartConversation(oSpeaker,"204_after_winning_battle",FALSE,FALSE,TRUE)));
//recursion!!!!!
DelayCommand(2.0,AssignCommand(oArea,Kickstart()));
}
}
Scripting technique: The On Death Conversation Kick Start
Débuté par
M. Rieder
, janv. 31 2012 01:52
#1
Posté 31 janvier 2012 - 01:52
#2
Posté 31 janvier 2012 - 10:41
great idea, looks good M.
- will probly require a fair bit of testing though; eg, who knows what the PC will be doing if the initial conversation fails and all you're checking for is !IsInConversation() - what is supposed to happen if PC gets in another fight or gets involved with picking a lock or ......
test it for a month, perhaps inhibit the initial dialog from firing up so the script has to run
ya might try using this ( not sure how well it works )
----
- will probly require a fair bit of testing though; eg, who knows what the PC will be doing if the initial conversation fails and all you're checking for is !IsInConversation() - what is supposed to happen if PC gets in another fight or gets involved with picking a lock or ......
test it for a month, perhaps inhibit the initial dialog from firing up so the script has to run
ya might try using this ( not sure how well it works )
----
// Get the current action (ACTION_*) that oObject is executing. int GetCurrentAction(object oObject=OBJECT_SELF); // ACTION_INVALID
#3
Posté 01 février 2012 - 01:11
That is a really good point. I am going to keep that in mind when I broaden the use of the function.
#4
Posté 01 février 2012 - 04:53
oh, it'd be a good thing to run those extra helper functions on the Speakee, as well
(as applicable)
(as applicable)





Retour en haut






