PDA

View Full Version : Scripting Help


wasa7
10-20-2006, 04:20 PM
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.

Pavlos
10-20-2006, 06:10 PM
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!

}

}

wasa7
10-21-2006, 09:09 AM
Thank you Pavlos, this should come helpful.

wasa7
10-21-2006, 11:00 AM
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?

wasa7
10-23-2006, 11:46 PM
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!

Emperor Devon
10-24-2006, 01:12 AM
Hello, I need help!

Bumping will get you nowhere, and the forum rules (http://lucasforums.com/showthread.php?t=169078) explicitly state that it is not allowed. :)

You might also want to just create a new script and not bother with any decompiling. There's some info here (http://lucasforums.com/showthread.php?t=166640&highlight=walk) and here (http://www.lucasforums.com/showthread.php?t=142290) about the matter. :)

stoffe
10-24-2006, 06:50 AM
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);
}

wasa7
10-24-2006, 10:52 AM
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!