LS59

KotOR 1 - Walking animation during a dialog

Recommended Posts

Hello there' ! 

First of all, I would like to precise that i'm french and my english is not very good. Sorry, I'll do my best and I thank in advance everyone who will help me ... 😥

For a movie that I realize, I want to create a conversation with PC and NPC, because a static monolog isn't interesting.

I'm love making video since many years... but I don't have any abilities in script. I have read lot of tutorials from Lucasforum archives and here... but really,  i can't do it. I don't understand what I must do, and it's horrible because I make some effort to learn. 

For example, in KotOR1, I want that Carth walk to the window of the Hideout when he says « I'm Carth, one of the republic soldiers from the Endar Spire [...]» 

My script, created and compiled with Kotor scripting tool, called "C_walk" is in the Override folder.

void main () {
  
  object oNPC=GetObjectByTag("p_carth");    

  float x=85.9;                         
  float y=146.6;                        
  float z=0.0;                        

  int bRun=FALSE;         //If set to TRUE, the NPC will run to the location.

  vector vPoint=Vector(x,y,z);
  location lPoint=Location(vPoint,0.0f);
  ActionDoCommand(SetCommandable(TRUE,oNPC));
  AssignCommand (oNPC,ActionForceMoveToLocation(lPoint,bRun));

}

 

and in the " tar02_carth022.dlg " file ...................

1580201482-dialog.jpg

 

And nothing is working. Could you help me, please ? 

If someone could give me a complete example (because tutorials often use other skills that are not detailed ...), or guide me to success, it would be great.

Again, thank you in advance. 

 

LS.59

Share this post


Link to post
Share on other sites

You did everything right, except that Carth's tag is not "p_carth", it's "carth". You can check a creature's tag by opening their .utc with either kotor tool or a GFF editor.

Also, it is useful for debugging to check whether your script is running, you can do this by writing:

SendMessageToPC(GetFirstPC(), "Script is running!");

You should get the message to your Feedback window. If you do, it means the problem is not with running the script, so something must be wrong with the script if you are not seeing the result you want.

Bonne chance :)

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Yeah ! It's working !!!! Thank you so much Bead-v ! :D 

And for the PC, how can do that ? The script is not made for ? 

Share this post


Link to post
Share on other sites
2 minutes ago, LS59 said:

And for the PC, how can do that ? The script is not made for ? 

Do what?

Share this post


Link to post
Share on other sites

Command the PC to walk presumably. Something like this should work.

void main() {
	
	object oPC = GetFirstPC();
	object oCarth = GetObjectByTag("carth", 0);
	location lPC = Location(Vector(85.9,146.6,0.0), 0.0);
	location lCarth = Location(Vector(85.9,146.6,0.0), 0.0);
	
	AssignCommand(oPC, ActionMoveToLocation(lPC, FALSE));
	AssignCommand(oCarth, ActionMoveToLocation(lCarth, FALSE));
}

Just change the PC's location values as appropriate.

Share this post


Link to post
Share on other sites
1 hour ago, DarthParametric said:

Ordonnez au PC de marcher probablement. Quelque a choisi comme ça devrait fonctionner.



 

Modifiez simplement les valeurs de remplacement du PC, le cas échéant.

 

Je l'ai fait, mais ça ne marche pas ... 

 

	
void main() {
	
	object oPC = GetFirstPC();
	object oCarth = GetObjectByTag("carth", 0);
	location lPC = Location(Vector(86.3,147.0), 0.0);
	location lCarth = Location(Vector(85.8,145.1,0.0), 0.0);
	
	AssignCommand(oPC, ActionMoveToLocation(lPC, FALSE));
	AssignCommand(oCarth, ActionMoveToLocation(lCarth, FALSE));
}

 

I attached the script to a response from the PC, then to a sentence from Carth ...

Have got an idea please?

Edited by LS59

Share this post


Link to post
Share on other sites
1 hour ago, LS59 said:

Je l'ai fait, mais ça ne marche pas ... 

Donc il n'y a que Carth qui bouge c'est ça ? Parce que t'avais dit avant que ça fonctionnait ...

 

Share this post


Link to post
Share on other sites
1 hour ago, bead-v said:

Donc il n'y a que Carth qui bouge c'est ça ? Parce que t'avais dit avant que ça fonctionnait ...

 

The script of my first post with your correction is working, and i'm so happy for this. Carth go to the window of the hideout.

But now, I want that my PC walk too, behind Carth.  After test, the Darthparametric's script is not working.  My PC don't move. 

Edited by LS59

Share this post


Link to post
Share on other sites

Here are some things you can try:

1. Add AssignCommand(oPC, ClearAllActions()); before moving the PC.

2. Add SetCommandable(oPC, TRUE); before moving the PC.

3. Use ActionForceMoveToLocation() instead of ActionMoveToLocation().

4. Use a different location.

Share this post


Link to post
Share on other sites

Sorry, but no result ... 😥

 

void main() {
	
	object oPC = GetFirstPC();
	object oCarth = GetObjectByTag("carth", 0);

  	AssignCommand (oPC, ClearAllActions ()); 

  	location lPC = Location(Vector(86.3,147.0,0.0), 0.0);
	location lCarth = Location(Vector(85.9,145.6,0.0), 0.0);
	
	AssignCommand(oPC, ActionForceMoveToLocation(lPC, FALSE));
	AssignCommand(oCarth, ActionForceMoveToLocation(lCarth, FALSE));
}

 

And if I add Setcommandable, I have this : 

 

1580255467-error.jpg

 

 

I trust in you, and I hope not to be maddering... 😓

Edited by LS59

Share this post


Link to post
Share on other sites

Your SetCommandable commands are reversed. The proper form is:

void SetCommandable(int bCommandable, object oTarget=OBJECT_SELF);

You had the order right in your original script. Although note that assigning it via ActionDoCommand will add it to the creature's Action stack, not carry it out immediately.  I would suggest:

AssignCommand(oPC, SetCommandable(TRUE, OBJECT_SELF));

And it still needs to be assigned first anyway for non-script owners, like the PC in this instance (the script presumably belongs to Carth if it is his DLG). But it's debatable whether you actually need it anyway in typical use outside of setting NPCs to not be commandable. For example when setting them to exit an area you set commandable to false so the PC can't interrupt them by trying to talk to them.

Also, you should never need to use ActionForceMoveToLocation. The only difference (as far as I know) is that it adds a timeout to trying to path to the destination. In my experience though it makes no difference. If ActionMoveToLocation fails then so will ActionForceMoveToLocation.

Share this post


Link to post
Share on other sites
8 hours ago, LS59 said:

Sorry, but no result ... 😥

Have you also tried changing the location?

14 hours ago, LS59 said:

my PC walk too, behind Carth

If they are too close Carth may interrupt the PC's movement.

So another thing you can try is putting a delay on the PC.

DelayCommand(2.0, AssignCommand(oPC, ActionMoveToLocation(lPC, FALSE)));

 

Share this post


Link to post
Share on other sites
6 minutes ago, bead-v said:

Avez-vous également essayé de changer l'emplacement?

I changed coordinates with where ami, nothing has changed. 

I will try the Darthparametric solution. 

Share this post


Link to post
Share on other sites

This worked for me:

void main() {
	object oPC = GetFirstPC();
	object oCarth = GetObjectByTag("carth");

  	AssignCommand(oPC, ClearAllActions()); 

  	location lPC = Location(Vector(86.3,147.0,0.0), 0.0);
	location lCarth = Location(Vector(85.9,145.6,0.0), 0.0);
	
	AssignCommand(oCarth, ActionForceMoveToLocation(lCarth, FALSE));
	DelayCommand(1.0, AssignCommand(oPC, ActionForceMoveToLocation(lPC, FALSE)));
}

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, bead-v said:

This worked for me

 

I've copied and pasted your script, compiled and attached to "I'm Carth, soldier on the Endar Spire" and nothing happening.  Then, I've tested your script on PC response with "I had a strange dream". Nothing again...

 

 

[EDIT] : The compiled file was not in Override folder ! I've changed that. Only Carth walk to the window with your script.

 

[EDIT 2] : IT'S WORKING ! I've attached your script Bead-v to "I had a strange dream" (PC response) and to "I'm not surprised" (Carth response). 

 

  • Like 2

Share this post


Link to post
Share on other sites

One thing to keep in mind is that doing any sort of significant character movement while using dynamic cameras is generally not advisable. It often leads to unpleasant bobbing and jerky camera motion (most pronounced if the character is running). Ideally you'd use a static camera or animated camera for such shots.

  • Like 2

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.