Sign in to follow this  
Salk

[K1] Scripting question

Recommended Posts

Hello!

I don't seem to understand why the following script (attached as OnOpen to a door file) works only for the currently selected character (the one opening the door) but doesn't produce any result for the other two party members. What am I missing?

void main() {


  object oParty0 = GetPartyMemberByIndex(0);
  object oParty1 = GetPartyMemberByIndex(1);
  object oParty2 = GetPartyMemberByIndex(2);

  AssignCommand(oParty0, ActionPlayAnimation(15, 1.0, 10.0));
  AssignCommand(oParty1, ActionPlayAnimation(15, 1.0, 10.0));
  AssignCommand(oParty2, ActionPlayAnimation(15, 1.0, 10.0));


}

Thanks!

EDIT:

I made a few searches and to answer my own question (but I would like to know if this is going to cause other kind of problems), it seems I can get all three party members play the above animation by changing the code to something very convoluted:

void main() {


  object oParty0 = GetPartyMemberByIndex(0);
  object oParty1 = GetPartyMemberByIndex(1);
  object oParty2 = GetPartyMemberByIndex(2);

  AssignCommand(oParty0, ClearAllActions());
  AssignCommand(oParty0, ActionDoCommand(SetCommandable(TRUE, oParty0)));
  AssignCommand(oParty0, ActionPlayAnimation(15, 1.0, 10.0));
  DelayCommand(0.1, SetCommandable(FALSE, oParty0));
  AssignCommand(oParty1, ClearAllActions());
  AssignCommand(oParty1, ActionDoCommand(SetCommandable(TRUE, oParty1)));
  AssignCommand(oParty1, ActionPlayAnimation(15, 1.0, 10.0));
  DelayCommand(0.1, SetCommandable(FALSE, oParty1));
  AssignCommand(oParty2, ClearAllActions());
  AssignCommand(oParty2, ActionDoCommand(SetCommandable(TRUE, oParty2)));
  AssignCommand(oParty2, ActionPlayAnimation(15, 1.0, 10.0));
  DelayCommand(0.1, SetCommandable(FALSE, oParty2));

}

 

Edited by Salk
Found answer... maybe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this