Jump to content

Home

scripting help


m16965

Recommended Posts

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.

Link to comment
Share on other sites

well i did the script and installed this nsscomp. i put it in the override folder with blank.nss, (my script.nss) and nwscript.nss. i have double clicked on the nsscomp and i get this.

 

" __ __

" ___ ___ ___ _______ __ _ ___ / / ___ _/ /_

" / _ \(_-<(_-</ __/ _ \/ ' \/ _ \_ / _ \/ _ `/ __/

" /_//_/___/___/\__/\___/_/_/_/ .__(_)_.__/\_,_/\__/

" /_/

Contents of nsscomp-log.txt is as follows:

Could Not Find C:\Program Files\LucasArts\SWKotOR2\override\*.ndb

-------------------------------------------

NSSCOMP.bat output 03/12/2006 21:03

-------------------------------------------

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

Unable to locate or open Neverwinter Night

-------------------------------------------

Compilation complete: 9/9 files compiled

Press any key to continue . . .

 

anybody know how to help? :ball:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

thanks very much lit ridl

 

do i change the nQuantity to a number just like this

 

void main()

{

int nQuantity = 1;

CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), 1);

}

 

Yes, you may.

But it will be more visually appealable if you will do it like this:

void main()
{
int nQuantity = 12;
    CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), nQuantity);
}

In this example I want to get 12 items.

void main()
{
int nQuantity = 7;
    CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), nQuantity);
}

In this, I want to get 7 items.

Link to comment
Share on other sites

can you get me the scripts for that you can warp somewhare and that you complete a quest

Script to warp somewhere is like this:

void main ()
{
string sModule = "[i]file_name[/i]";
    StartNewModule(sModule);
}

In this example change file_name to your module's filename, without extension.

If you want to warp to some module to the specific waypoint, use this:

void main ()
{
string sModule = "[i]file_name[/i]";
string sWayPoint = "[i]waypoint_name[/i]";
    StartNewModule(sModule, sWayPoint);
}

Replace waypoint_name with your waypoint's name.

About quest.

this will be like this:

void main ()
{
string sQuestTag = "[i]quest_tag[/i]";
   AddJournalQuestEntry(sQuestTag, 99);
}

Here you have to repalce quest_tag with your quest's tag, as it specified in global.jrl file.

99 - is you quest's state, usually 99 marks finishing the quest. But, again, look in global.jrl file to see what is actually the last entry. Also, some qests do have LS/DS variants... So look in global.jrl....

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...