Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

KotOR I - Compiling Scripts Question

Page: 1 of 1
 The Source
07-26-2006, 3:07 PM
#1
Compiling scripts with Kotor tool:

Before anything else, make sure you have enabled the view extensions option in Windows. If you haven't, open Windows Explorer and go to the Tools menu > Folder Options> View and uncheck "Hide extensions of known file types" and click OK.


1. Go to the tools menu
2. Select the text editor.
3. Then in the text editor window, go to the script menu, select your game (kotor 1 or kotor 2)
4. make your script, save with a .nss extension.
5. Either go to the script menu and select compile or simply press F5
6. The compilation should output a .ncs file.

1. Can I re-edit allready existing .ncs or .nss files?
2. Alien Voice Overs - I noticed there is a anliensound.2da file instead of a alienvo.2da file in KotOR I. I used some of the tags, I can hear a voice, but there is no animation. Any ideas?
 Pavlos
07-26-2006, 3:27 PM
#2
Scripting in KotOR I has exactly the same rules as scripting for TSL. TSL introduced approximately 100 nwscript functions and a handful of others in the includes. You will most likely find very little difference, except for the incovenience of having to create *loads* of scripts for dialogues, due to the fact that there is no parameter function available.

As for your voice overs, it is because your module doesn't have those particular .lips in the lips folder. Find the .lips for the alien voice overs in other modules and then add them to your module's lip file. This is simply a .mod and can be edited with stoffe's ERF tool, or KotOR Tool. You can, of course, just throw the .lips in with all of your other files, if you don't mind things getting a little messy, as the .mod format supports many file types.
 The Source
07-26-2006, 4:22 PM
#3
Scripting in KotOR I has exactly the same rules as scripting for TSL. TSL introduced approximately 100 nwscript functions and a handful of others in the includes. You will most likely find very little difference, except for the incovenience of having to create *loads* of scripts for dialogues, due to the fact that there is no parameter function available.

As for your voice overs, it is because your module doesn't have those particular .lips in the lips folder. Find the .lips for the alien voice overs in other modules and then add them to your module's lip file. This is simply a .mod and can be edited with stoffe's ERF tool, or KotOR Tool. You can, of course, just throw the .lips in with all of your other files, if you don't mind things getting a little messy, as the .mod format supports many file types.
I didn't realize that. I thought it was going to be easy sailing. Once I started to attatch scripts to dialouge, I was confussed about the missing option for parameters. It looks like I have to solve some issue.

.lips stuff:
I will probally do what you suggest, and consolidate everything into one .mod file.

I didn't realize all the extra work that everyone had to do for KotOR I modding. It is not too much, but enough to get you thinking. Everything is also labled differently. Do you happen to know if the scripts in KotOR II work in KotOR I?
 RedHawke
07-26-2006, 9:57 PM
#4
Do you happen to know if the scripts in KotOR II work in KotOR I?
Pavlos already answered this in the first paragraph of his post.

TSL introduced approximately 100 nwscript functions and a handful of others in the includes.
This means that there is a good chance they will not work, the basic ones should, but the more larger scripts will likely not as there is a good chance they use one or more of the new TSL functions. Many functions didn't exist in KotOR I script-wise.
 The Source
07-27-2006, 9:42 AM
#5
^^^ To RedHawke:
Scripting in KotOR I has exactly the same rules as scripting for TSL. TSL introduced approximately 100 nwscript functions and a handful of others in the includes. You will most likely find very little difference, except for the incovenience of having to create *loads* of scripts for dialogues, due to the fact that there is no parameter function available.
.
Actually, he said that TSL inroduced 100 nwscript functions. Like JavaScript, people discover thousands of new scripts everyday. Even though the first set of scripts were not found in the first version, this does not mean that they are not compatible. Otherwords, their codding is there, but no one had turned them on.

That is why I asked. ;)
 Darth333
07-27-2006, 9:57 AM
#6
hum...actually Redhawke was right (and Pavlos too). The new script functions added to TSL will not work with KotOR 1. Per example, you can grant a feat to an npc with a script in TSL with the function GrantFeat () but this is not possible in KotOR 1 as the function does not exist. Look at nwscript.nss for a list of the available functions in each game.
 Pavlos
07-27-2006, 10:02 AM
#7
Oh, no; I meant that you will find the syntax largely unchanged, I've never noticed any difference, I don't know about anyone else. But you may encounter issues getting scripts you made in K2 to compile with K1's nwscript. You can't grant feats or spells in K1 regardless of prerequisites. You cannot Increment a Global Number but instead have to use things like "SetGlobalNumber("K_PLOT_MASTER", (GetGlobalNumber("K_PLOT_MASTER")++))" I'm not even sure if my syntax is correct there, but it is an example.

The language is limited to however many functions the developers needed, and K1 lacks a few handy little bells and whistles.

Edit: Darth333 beats me to it...
 The Source
07-27-2006, 10:13 AM
#8
Thanks for clearing that up. :)
//:: k_ptat_giveitem
/*
The player receives Bastila's robe from Venora.
*/
//:: Created By:
//:: Copyright (c) 2002 Bioware Corp.

void main()
{
object oPC = GetPCSpeaker();
object oClothing = GetItemPossessedBy(OBJECT_SELF, "bast_ks");

ActionGiveItem(oClothing, oPC);
}
I am trying to construct a script, which will allow the NPC to give the PC an item (through dialouge). My problem is: When I try to complie the scriipt, the .ncs comes out cryptic and garbage. As I try to set off the script in game, nothing happens. Any suggestions. (See above for details.)
 tygaran
07-27-2006, 2:39 PM
#9
Thanks for clearing that up. :)

I am trying to construct a script, which will allow the NPC to give the PC an item (through dialouge). My problem is: When I try to complie the scriipt, the .ncs comes out cryptic and garbage. As I try to set off the script in game, nothing happens. Any suggestions. (See above for details.)

I think you need to alter that last part. "ActionGiveItem(oClothing, oPC);"
is an action and I don t think they can work by themselves. I belive you need the following...

AssignCommand(OBJECT_SELF,ActionGiveItem(oClothing , oPC));
 The Source
07-27-2006, 3:15 PM
#10
^^^^
I just tried that, and it didn't work. Thanks anyway. I still haven't figured out why Fred's KotOR Tool is creating greek when I complie the .nss into .ncs.
 Darth333
07-27-2006, 3:42 PM
#11
The following should work:

void main()
{
object oClothing = GetObjectByTag("my_object_tag");
object oNPC= GetObjectByTag(my_npc_tag"); //insert the tag of the npc giving the object
AssignCommand(oNPC,ActionGiveItem(oClothing , GetPCSpeaker());
}

or, even simpler:

void main()
{
CreateItemOnObject("my_object_resref", GetFirstPC());
}

When I try to complie the scriipt, the .ncs comes out cryptic and garbage.
Well don't be surprised it the .ncs "comes out cryptic and garbage" when you open it with notepad . That's just normal as it can't be opened with notepad. If you want to learn more about *.ncs files, you can check this page: http://www.torlack.com/index.html?topics=nwndata_ncs) but as long as you have the source code (*.nss file) you don't have to bother with this. And if you happen not to have the source code, there's always the DEncs utility to help you.
 The Source
07-27-2006, 5:57 PM
#12
First, I want to thank everyone for helping me out with this conundrum. When I was utilizing the scripts in KotOR 2, they were more user-friendly. I must have spent hours scanning through the nwnscript file, and my eyes were starting to glaze over.

Darth333 - Thanks for the help on that script. Your simpler script worked perfectly. I have never modded KotOR 1 before, so this is my maiden voyage.

Again, thank you for you help. Sorry for any confusion.
Page: 1 of 1