Notices

Go Back   FileFront Forums > The Games! > Star Wars: KOTOR Series > Star Wars: KOTOR2: The Sith Lords > SW:KOTOR2 Modding, Mapping and Editing

Remember Me?

SW:KOTOR2 Modding, Mapping and Editing
Want more info about a Mod? Making a Mod? Looking for Modders, Mappers, Skinners, etc.? This is your Spot!

Reply
 
LinkBack Thread Tools Display Modes
Old November 27th, 2005   #1
Your Kotor Modding Helper
 
Gsccc's Avatar
 
Join Date: September 20th, 2004
Status: Available
45 posts, 0 likes.
Rep Power: 0
Gsccc is a n00b
Default Tutorial -- Script how to give the PC an item

Giving the PC an item via script

This tutorial will show you how to, through a script give the pc an item. This is usefull for if you have your pc talking to someone and you want teh npc they are speaking with to give the pc a certain item.

Code:
 
void main()
{
 CreateItemOnObject("g_danceroutfit", GetFirstPC(), 1, 0);
}
As the script suggests, you are literally creating an item on an object, in this case the object is the pc.

In the first set of quotes you put the ResRef of the item, it is important you do not put the name of the tag of the item. If you want to find what the tag of a certain item is use kotor tool or a gff editor and see under tag.

Next you have the PC's basic tag, this is the tag you use if you want anything that includes the player.

Next is the quantity of the item that you are placing, you can change this to whatever number you want.

Once you are done with that compile it and you can put it in a dialog or a trigger.

NOTE: this differs from the way you give credits to the pc

-Gsccc

Last edited by Gsccc; November 27th, 2005 at 10:42 PM.
Gsccc is offline   Reply With Quote
Old December 18th, 2006   #2
Forum Hermit
 
Mando's Avatar
 
Join Date: November 11th, 2006
Location: Duxn
Status: As crazy as mEk
287 posts, 0 likes.
Rep Power: 0
Mando is a n00b
Default Re: Tutorial -- Script how to give the PC an item

Hmmmm... That script may work for kotor1 but there is an easier way to do it for kotor 2.

Code:
void main()
{
int nQuantity = 1;
CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), nQuantity);
}


In this script i want to get 1 item.

Code:
void main()
{
int nQuantity = 3;
CreateItemOnObject("g_danceroutfit", GetFirstPC(), nQuantity);
}

In this script i want to get 3 items.

To compile scripts go to the kotor tool text editor and make your script. use the text editor for your script then save it in the override folder as "myscriptname".nss. Then go to the scripts menu and say script is for kotor/2 (each games use different scripts. The one in this tutorial is for kotor2.) then press F5. you should get this message

Lookup path root set to C://program Files//LucasArts//SWKotOR2
Loaded nwscript.nss form C://program Files//LucasArts//SWKotOR2//Override
Compiling: myscriptname.nss
Total Execution time = X ms

If it says that then you have sucessfuly compiled your script!
If you don't, then try not to get mad and check your scripts. one of the most common reasons may be one of you things is wrong.

Then on the dialouge editor (kotor tool or DLGEditor by Tk102, a very talanted scripter), go to the string of dialouge you want to add the script to.Go to the scripts menu. Under the script option there are 2 things

1)script that fires when spoken
2)script that needs to run

The script that fires when spoken is the bit you need type in the name of your script,without the .nss/.ncs extention. The Needed script is best left alone as many functions in game are required with these.

*NOTE* There are different functions of scripting for kotor1 and 2. This scripting tutorial covers kotor 2 scripts. Also as Gsccc said there is no way to get LS/DS, exp, gold or infuence through these scripts. You may change the resref to a custom item if you use the UTI file in game.


Have fun With scripting!

~Mandalorian16965

Last edited by Mando; December 18th, 2006 at 10:50 AM.
Mando is offline   Reply With Quote
Old October 31st, 2008   #3
The Force is my ally
 
theman88's Avatar
 
Join Date: June 3rd, 2008
Status: Available
245 posts, 0 likes.
Rep Power: 0
theman88 is a n00b
Default Re: Tutorial -- Script how to give the PC an item

um I still dont under stand how that makes a certain NPC give you a item? you mean by killing them or when you talk to them?
theman88 is offline   Reply With Quote
Old October 31st, 2008   #4
[Insert User Title Here]
 
Inyri Forge's Avatar
 
Join Date: March 15th, 2005
Location: Chicago
Status: Debating whether or not to post.
16,452 posts, 517 likes.
Rep Power: 43
Inyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured OneInyri Forge - the Honoured One
Default Re: Tutorial -- Script how to give the PC an item

You have to call the script somehow. Dialogue is the most common option, but you can also do it in a variety of other ways.


Inyri Forge is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] Script to check if an item is in the actor's inventory SacriPan S.T.A.L.K.E.R. SoC Modding, Mapping and Editing 5 April 29th, 2010 02:09 AM
script tutorial? Diablo666 SW:JK Modding, Mapping and Editing 1 February 2nd, 2003 09:28 PM


All times are GMT -7.







   
 





This site is part of the Defy Media Gaming network

The best serving of video game culture, since 2001. Whether you're looking for news, reviews, walkthroughs, or the biggest collection of PC gaming files on the planet, Game Front has you covered. We also make no illusions about gaming: it's supposed to be fun. Browse gaming galleries, humor lists, and honest, short-form reporting. Game on!

FileFront Forums - Terms of Service - Top
Theme Selection
Copyright © 2002-2016 Game Front. All rights reserved. Powered by vBulletin®
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Forum Theme by Danny King (FileTrekker), Sheepeep & Graeme(rs)
RSS Feed Widget by FeedWind