![]() |
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: 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 |
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 |
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? |
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. |
| All times are GMT -7. |
Powered by vBulletin®
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.