lfnetwork.com mark read register faq members calendar

Thread: Walk and talk script?
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-31-2013, 06:39 PM   #1
supreme kotor
Junior Member
 
supreme kotor's Avatar
 
Join Date: Mar 2013
Location: I'm lost.
Posts: 326
Current Game: Modding.. Wait is that a game?
Walk and talk script?

I'm trying to make two NPC's walk together and have a dialog while walking start running during the dialog and then stop at a certain point in the dialog. An example of the walking would be like the twin suns in Kotor TSL where they walk and talk about how
Show spoiler


Current WIP: Learning to mod Kotor
supreme kotor is offline   you may: quote & reply,
Old 04-01-2013, 11:55 AM   #2
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Well you could do this a couple ways but I think the easiest way to do it would be with three or four scripts, so let's go that route (I'll assume you know the basics of modding, including how the dialogue editor works and how to compile scripts).

So I'll use an example conversation to show you what to do with the scripts. Below you'll see my example conversation. It has two people talking, then they decide to walk together.



Now, in order to actually make them walk together, rather than just saying they will, you will need to use a script to make them walk, which you can find below.
Code:
void main()
{

   object oNPC = GetObjectByTag("Bob");

   object oNPC2 = GetObjectByTag("Friend");

    int bRun = FALSE;

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(508.24, 33.24, 7.04), 0.0), bRun));


      AssignCommand(oNPC2, ActionForceMoveToLocation (Location(Vector(508.24, 33.24, 7.04), 0.0), bRun));


}
In this script, you would replace the red text with whatever the tags of your NPC's are, and you'd replace the greenish text with the coordinates of the location you want them to walk to (preferably you have them walk to generally the same place, but not the exact same coordinates).

So, once your script is compiled and you have the .NCS format, you are going to need to have it be executed. You do this by clicking on the node where you want them to first start walking, then putting the script name (without the file extension) in the "Script that fires when spoken" box.



You'll see in the node I selected above, there's text saying "[The two start walking together.]." This is completely unnecessary, and should be removed when you are finished making the dialogue. I just use it to keep track of where everything is/happens.

Also, remember to keep in mind that they will continue walking until they reach their destination, so if it's a long conversation you might want to have them walk to several locations, placing them all in the order you want them to be walked to, such as in the script below.
Code:
void main()
{

   object oNPC = GetObjectByTag("Bob");

   int bRun = FALSE;

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(508.24, 33.24, 7.04), 0.0), bRun));

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(525.21, 43.11, 6.04), 0.0), bRun));

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(611.01, 55.17, 6.42), 0.0), bRun));


}
Alternatively you could just make sure that the destination they are walking to is far enough away that they won't stop walking before they are supposed to.

Now next you wanted them to start running. Doing that is really simple. All you do is take the scripts I posted above, change the coordinates to what you want them to be, and then change the value of "int bRun = FALSE;" to "int bRun = TRUE;" such as what is below.

Code:
void main()
{

   object oNPC = GetObjectByTag("Bob");

   object oNPC2 = GetObjectByTag("Friend");

   int bRun = TRUE;

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(518.24, 43.24, 7.04), 0.0), bRun));

      AssignCommand(oNPC2, ActionForceMoveToLocation (Location(Vector(518.24, 43.24, 7.04), 0.0), bRun));


}
If you try this script and the NPC's don't stop walking and start running, you could try making them call ClearAllActions(); first, like in the script below.

Code:
void main()
{

   object oNPC = GetObjectByTag("Bob");

   object oNPC2 = GetObjectByTag("Friend");

   int bRun = TRUE;

      AssignCommand(oNPC, ClearAllActions());

      AssignCommand(oNPC, ActionForceMoveToLocation (Location(Vector(518.24, 43.24, 7.04), 0.0), bRun));

      AssingCommand(oNPC2, ClearAllActions());

      AssignCommand(oNPC2, ActionForceMoveToLocation (Location(Vector(518.24, 43.24, 7.04), 0.0), bRun));


}
Now after that's done and compiled, you'll want to put the script's name in a node's "Script that fires when spoken" box, just like the walking script. I won't go into too much detail on this, seeing as I already explained it, so if you get confused just look at the picture below.



Okay, now all that's left is to make them stop running at a certain point. To do this, all you have to do is take those ClearAllActions(); calls I had above, and put them in their own separate script, similar to the one below.

Code:
void main()
{

   object oNPC = GetObjectByTag("Bob");

   object oNPC2 = GetObjectByTag("Friend");

      AssignCommand(oNPC, ClearAllActions());

      AssignCommand(oNPC2, ClearAllActions());

}
Again, you'll want to put this in a node's "Script that fires when spoken" box.



All right, with that all done everything should work okay in-game. However, in order to make this scene look better, I would suggest using placeable cameras, animated cameras and delays/wait calls on some of the nodes. I hope this helped.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version

Last edited by Fallen Guardian; 04-02-2013 at 10:49 AM.
Fallen Guardian is offline   you may: quote & reply,
Old 04-02-2013, 08:15 AM   #3
supreme kotor
Junior Member
 
supreme kotor's Avatar
 
Join Date: Mar 2013
Location: I'm lost.
Posts: 326
Current Game: Modding.. Wait is that a game?
Thanks that helped a lot I wasn't expecting an in depth tutorial so that was great.


Current WIP: Learning to mod Kotor
supreme kotor is offline   you may: quote & reply,
Old 04-02-2013, 09:49 AM   #4
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Glad I could be of help.


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Walk and talk script?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:49 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.