PDA

View Full Version : .ncs function question


Achilles
08-09-2004, 07:36 PM
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, 07:51 PM
kotor save game editor does wonders for that

Darth333
08-09-2004, 07:51 PM
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, 08:03 PM
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, 08:38 PM
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, 01:09 AM
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, 10:44 AM
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, 10:49 AM
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, 10:54 AM
glad i could help :)