Jump to content

Home

Scripting Help


wasa7

Recommended Posts

Hello Stoffe, hello all at Lucas Forums. Is there a way to make a script only to work while on a planet or on an specific area? A while ago, Stoffe came up with an OnPerceit script that works perfectly for a mod but that doesn't make it for others. What I need is to make that script only to work while on Taris. Better yet, while on Upper City North and South area modules. Any ideas? What conditions should I add to make this happen? Thank you all in advance.

Link to comment
Share on other sites

A simple check for the file name of the module should work :).

 

void main() {

  string sModule = GetModuleFileName();

    // If we are in Upper Taris North or South then do this.
    if (sModule == "tar_m02ab" || sModule == "tar_m02ac") {

       // Do my stuff here!

    }

}

Link to comment
Share on other sites

I need to change some script behaviors. When PC reachs for the fisrt time Dantooine, Bastila ask him to come with her to see the Jedi Counsil, then they start running inside the Jedi Enclave. What I want is to make Carth and Bastila to walk instead of running. I have found the scripts that make them run:

 

k_pdan_bastilla11; that triggers from the dialog and execute Carth and Bastila's running script. For this I found the .nss file. Easy to change if need it.

k_pdan_bastmv and k_pdan-carthmv; that make them run. For these two, I can't find the .nss file so I can't change them. How do I decompile the .ncs files?

Link to comment
Share on other sites

Hello, I need help! I've been reading about de-compiling .ncs files. Now I think it can't be done! Anyways, I want to make a script where a NPC follows an existing waypoint. I also have to figure wich one is the correct waypoint file. Any ideas how can I do that?

The route I want Bastila and Carth to follow is the one described above, when they start running into the Jedi Enclave from the Ebon Hawk. Thanks in advance!

Link to comment
Share on other sites

I've been reading about de-compiling .ncs files. Now I think it can't be done!

 

If you have Java installed you should be able to use DeNCS to "decompile" scripts, if you use the nwscript.nss file from the KotOR game you want to decompile scripts for with it. I'm not too familiar with how DeNCS works though since I don't have Java on my computer.

 

If you need one of the scripts from the standard TSL game most of them have already been recreated with DeNCS and can be downloaded from PCGameMods. I don't think there is such a download for KotOR1 though.

 

(It can also be done by hand, but that's a rather time consuming process and requires you to understand the scripting language fairly well.)

 

 

Anyways, I want to make a script where a NPC follows an existing waypoint. I also have to figure wich one is the correct waypoint file. Any ideas how can I do that?

The route I want Bastila and Carth to follow is the one described above, when they start running into the Jedi Enclave from the Ebon Hawk. Thanks in advance!

 

If in general you want an NPC to patrol along a series of waypoints there is a waypoint walking functionality built into the character AI that can handle it. Just name the waypoints like WP_NPCTAG_01 where you set the green part to the tag of the NPC in question and the blue part to a sequence number. Also make sure waypoint walking is enabled in the OnSpawn script for the NPC. Those waypoints will then be patrolled in order.

 

* * *

 

That's not applicable in this case however, since waypoint walking is not used for that particular scene in the Dantooine enclave. The script you look for look something like:

// ST: k_pdan_bastmv.nss (danm13_s.rim)

void main() {
   int bRun = TRUE;

   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila1"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila2"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila3"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila4"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila5"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila6"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila7"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_bastila8"), bRun, 1.0, 60.0);

   ActionDoCommand( SetFacingPoint( GetPosition(GetObjectByTag("dan13_WP_council")) ) );
   ActionDoCommand(SetCommandable(TRUE));
   SetCommandable(FALSE);
}

 

Set the bRun variable to TRUE or FALSE if you want Bastila to run or walk to the council. Carth's move script is working in much the same way:

// ST: k_pdan_carthmv.nss (danm13_s.rim)

void main() {
   int bRun = TRUE;

   ActionWait(3.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth1"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth2"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth3"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth4"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth5"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth6"), bRun, 1.0, 60.0);
   ActionForceMoveToObject( GetObjectByTag("dan13_wp_carth7"), bRun, 1.0, 60.0);

   ActionDoCommand( SetFacingPoint( GetPosition(GetObjectByTag("dan13_wp_carth6")) ) );
   ActionDoCommand(SetCommandable(TRUE));
   SetCommandable(FALSE);
}

Link to comment
Share on other sites

Hello again.

@ Emperor: Sorry, I didn't realize that I was bumpig, I'll try to avoid that kind of behavior in the future. I hope there are not harsh feeelings friend.

 

@ Stoffe: I think I love you! hahaha, no, really, thanks again Stoffe. You've saved my life more than once in this modding bussines. I'll compile those files inmidiately to see if they work properly. If they do, this will make a fine mod. Thank you very much!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...