http://www.lucasforums.com/showthread.php?s=&threadid=143412)
Look for "How can I script an object into my Inventory?" Replace "item template" with g_w_lghtsbr01 and simply add the bit to your script. Don't forget your brackets and your opening statement and such.
The final script should look like this:
void main()
{
object oItem=CreateItemOnObject("g_w_lghtsbr01", GetFirstPC());
}If you can understand what each part of the script does, you'll understand how to write simple scripts better.
Hmm...
Don't you need to use your object then to fire the event???
It looks like you have only identified and declared your constant.
But it should be called as I remember...
void main()
{
int nQuantity = 1;
CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), nQuantity);
}
And here you may change nQuantity to any number you want, you will get this amount of items. In this example you will get 1 item with ResRef g_w_lghtsbr01 that will be given to the player.
p.s.: you may use Kotor Tool to compile some scripts.
Do it in this way: copy nwscript.nss to your Kotor II's Override folder.
Open your Kotor Tool. Look for black button labeled Txt
Click on it, open your .nss script in it, and then go to Script/Script is for KotOR II.
Then press F5.
Put the resulting .ncs script in your Override folder, this is compiled, ready for in-game work script.