PDA

View Full Version : [K1] ActionPauseConversation Function


Silveredge9
10-28-2007, 07:55 PM
I've been experimenting with the ActionPauseConversation function in order to make it possible to skip certain nodes, whilst not being able to skip others.

At the certain dialogue part that I want to make unskippable, NPC's are equipped with lightsabers. So technically, the dialogue prior to this should be skippable, and the actions defined in the script below shouldn't be skippable. But for some reason I can't get it to work... And everything can be skipped.

void main()
{
ActionPauseConversation();

object oPC = GetFirstPC();
object oNPC=GetObjectByTag("taris_guy");
object oNPC2=GetObjectByTag("taris_sol1");
object oNPC3=GetObjectByTag("taris_sol2");
object oSaber = CreateItemOnObject("guy_saber",oNPC);
object oSaber2 = CreateItemOnObject("G_w_Vbroswrd01",oNPC2);
object oSaber3 = CreateItemOnObject("G_w_Vbroswrd01",oNPC3);

AssignCommand (oNPC, ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand (oNPC2, ActionEquipItem(oSaber2, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand (oNPC3, ActionEquipItem(oSaber3, INVENTORY_SLOT_RIGHTWEAPON));

ActionResumeConversation();

}

Anybody have any ideas what the problem is? And why the dialogue isn't being 'paused'?

tk102
10-28-2007, 08:24 PM
Man I'm getting rusty when it comes to the scripting mechanics. Have you tried putting the ActionResumeConversation in an obviously long DelayCommand call or calling a SendMessageToPC function to see whether your script is even firing?

Silveredge9
10-28-2007, 08:40 PM
The script is firing as the characters perform the scripted actions, it's just that the dialogue it's coupled with is skippable. :P

stoffe
10-29-2007, 08:09 AM
Man I'm rusty the scripting mechanics. Have you tried putting the ActionResumeConversation in an obviously long DelayCommand call or calling a SendMessageToPC function to see whether your script is even firing?

Like tk said you'll need to either delay ActionResumeConversation or assign an ActionWait() action to the queue of OBJECT_SELF for it to make any difference in this script, since you are manipulating the action queue of different objects. The action queue of the conversation owner in your script just looks like (in scripting terms)...

ActionPauseConversation();
ActionResumeConversation();

...while the action queue of taris_guy looks like...

ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHTWEAPON)

...and the action queue of taris_sol1 looks like...

ActionEquipItem(oSaber2, INVENTORY_SLOT_RIGHTWEAPON)

...and guy_saber...

ActionEquipItem(oSaber3, INVENTORY_SLOT_RIGHTWEAPON)


So, since you aren't placing the equip actions in the same action queue as the Pause/Resume actions the resume action will not wait until the Equip actions are complete before running. It will run directly after the Pause action, since there is nothing assigned to the action queue of the dialog owner in between.

Think of the Action Queue as a sequential list of things that an object should perform in the listed order, where the next item in the list is not started until the previous one has finished. Script functions that place an action in the action queue of an object usually have names starting with Action. Each NPC and placeable in the game have their own action queue.

This differs from non-action scripting functions which are run immediately as the script executes, whereas Action functions just tell the object "do this when you get around to it" and then move on in the script. So if the object already has actions in their queue it may take a few seconds for an assigned action to be performed (unless you clear their action queue), whereas a script usually don't execute longer than a few milliseconds.

Silveredge9
10-29-2007, 08:31 AM
Yes,I understand. I added an ActionWait(); of around 5ish seconds to allow time for the NPC's to perform their scripted actions within the paused dialogue timeframe, and it worked. :P

Thanks for the explanation. :)