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.

.ncs function question

Page: 1 of 1
 Achilles
08-09-2004, 6:36 PM
#1
Has anyone ever tried to edit a function in a .ncs, then copy it into the Override folder? Does it work?

I would try it myself but I don't have any savegames near the script that I want to test.

TIA
 Glamador
08-09-2004, 6:51 PM
#2
kotor save game editor does wonders for that
 Darth333
08-09-2004, 6:51 PM
#3
Originally posted by Achillies
Has anyone ever tried to edit a function in a .ncs, then copy it into the Override folder? Does it work?
Huh? :confused:
What do you want to do?

One thing you can sometimes do is to call the ExecuteScript function. You can have a look at the script in my MInd Trick forcepower if you wish, it calls that function and the source code is included in the package: http://www.pcgamemods.com/5904/) (source is not included in the all-in-one force power package due to the number of files).

And what does KSE has to do with that? :confused:
 Achilles
08-09-2004, 7:03 PM
#4
Originally posted by Darth333
Huh? :confused:
What do you want to do?

One thing you can sometimes do is to call the ExecuteScript function. You can have a look at the script in my MInd Trick forcepower if you wish, it calls that function and the source code is included in the package: http://www.pcgamemods.com/5904/) (source is not included in the all-in-one force power package due to the number of files).

And what does KSE has to do with that? :confused:

I want to change the items that the Assassination Droid on Korriban gives you after you destroy his Sith programming. I know that this is done via a script. I found the .ncs for that part and I want to know if I can change the items there, move it to the Override folder and have it work.

Sorry if I wasn't clear.
 Darth333
08-09-2004, 7:38 PM
#5
Originally posted by Achillies
I want to change the items that the Assassination Droid on Korriban gives you after you destroy his Sith programming. I know that this is done via a script. I found the .ncs for that part and I want to know if I can change the items there, move it to the Override folder and have it work.

Sorry if I wasn't clear.
Here is what you could try: (note this script will only add new objects, not replace existing ones)

void main () {
object oPC = GetPCSpeaker();
CreateItemOnObject("my_item1", oPC);
CreateItemOnObject("my_item2", oPC);
ExecuteScript("the_script_i_want_to_fire",oPC);
}


Save as a .nss file with a custom name then extract the dlg file, change the name of the script in the proper script field and type the name of the new script.


I haven't checked the script but if the original script simply calls the CreateObjectOnItem function, you could simply replace it with your own script. In this case, simply remove the ExcecuteScript line.
 Achilles
08-10-2004, 12:09 AM
#6
Originally posted by Darth333
Here is what you could try: (note this script will only add new objects, not replace existing ones)

void main () {
object oPC = GetPCSpeaker();
CreateItemOnObject("my_item1", oPC);
CreateItemOnObject("my_item2", oPC);
ExecuteScript("the_script_i_want_to_fire",oPC);
}


Save as a .nss file with a custom name then extract the dlg file, change the name of the script in the proper script field and type the name of the new script.


I haven't checked the script but if the original script simply calls the CreateObjectOnItem function, you could simply replace it with your own script. In this case, simply remove the ExcecuteScript line.

So I would replace "my_item1" with my file name and then "the_script_i_want_to_fire" with the script that already exists??? That seems circular, so I must be missing something. I'm still very new to scripts so please use small words :)
 Darth333
08-10-2004, 9:44 AM
#7
Originally posted by Achillies
So I would replace "my_item1" with my file name and then "the_script_i_want_to_fire" with the script that already exists??? That seems circular, so I must be missing something. I'm still very new to scripts so please use small words :)
yes, this is exactly what you have to do. A complete example would be:
Let's say you want to add 2 items, one called my_sword.uti and another one my_armband.uti.
Since it is on Korriban, I assume that the originial script attached to the droid's dlg file is something like k_pkor_blahblah.ncs. So to to fire this script and add your items at the same time you would use:


void main () {
object oPC = GetPCSpeaker();
CreateItemOnObject("my_sword", oPC);
CreateItemOnObject("my_armband", oPC);
ExecuteScript("k_pkor_blahblah",oPC);
}

Then save this script as achillies.nss

Open the dlg file go to the dialog brach where the original script, k_pkor_blahblah, is atached and in the script field replace k_pkor_blahblah by achillies.

One more thing:
I haven't checked the script and where it is attached: i don't have my game with me. But you may have to replace:

ExecuteScript("k_pkor_blahblah",oPC);

by

object oDroid= GetObjectByTag("droid_tag");
ExecuteScript("k_pkor_blahblah",oDroid);


Is that any better?
 Achilles
08-10-2004, 9:49 AM
#8
That's brilliant! I ended up using something slightly different to get it done, but I will definitely remember this for next time :)

Thank you!
 Darth333
08-10-2004, 9:54 AM
#9
glad i could help :)
Page: 1 of 1