Jump to content

Home

A bunch of random questions - scripting/dialogue


Xavier2

Recommended Posts

1. Whats the script for Killing the npc (owner) in a certain dialog?

2. What is the script to make this particular npc henchman to attack you after you killed their boss?

<cough> The Talk-Fight-Talk sequence is documented here.

 

As for killing an NPC via dialog, you can do that with this script:

void main() {
 object oDeadMeat=GetObjectByTag("npc_to_kill");
 int nHP=GetCurrentHitPoints(oDeadMeat);
 SetMinOneHP(oDeadMeat,FALSE);
 ApplyEffectToObject(
   0,
   EffectDamage(nHP),
   oDeadMeat
 );
}

You certainly embellish this script by adding your favorite visual effects, etc.

Link to comment
Share on other sites

Originally posted by Xavier2

Anither questions.

 

1. Whats the script for Killing the npc (owner) in a certain dialog?

2. What is the script to make this particular npc henchman to attack you after you killed their boss?

 

Does anyone knows of a pink skined T'wilek in the game? I happened to find only blue, red and green...

 

Another question. I noticed that the Hutts in Kotor dont use any model or tex colums in app.2da. Then, what should i do to get a custom text for a hutt character?

 

I think I'm catching on here, are you trying to recreate Jabba's Palace?

 

...To tie into your recruit Boba Fett mod perhaps? :D

Link to comment
Share on other sites

Originally posted by Mono_Giganto

If I had to guess, Persuade

You are correct. Don't forget to specify "PLAYER" when setting this animation and it is more effective to set the animation on the Entry that occurs just after the Reply is spoken.

Link to comment
Share on other sites

Another of my questions...:nut:

 

1. Is there a standard script in game that fires a dialog only if the speaker is of a certain race or any other .utc field?

2. If i want to fire a dialog only if a party member is along, what is the correct script. k_con_partymembernpm or k_con_partymemberpm?

 

Oh. And Thanks Darth333 for pointing to that tut.

Link to comment
Share on other sites

1)

You can use the GetAppearance function to determine the appearance of a character (which is about the closest you'll get to Race.) Or you can use the GetGender function to determine if the creature is a man/woman/other etc. And finally you can use GetClassByPosition function to determine whether the creature is a Jedi or a Droid or whatever. As you would expect, these functions return the integer value that you see the .utc's fields in GFF editor and correspond to the values seen in appearance.2da, gender.2da, and classes.2da respectfully.

 

2)

The k_con_partymembernpm scripts return TRUE if the partymember is NOT present. The k_con_partymemberpm scripts return TRUE if the partymemer IS present.

Link to comment
Share on other sites

Originally posted by tk102

1)

You can use the GetAppearance function to determine the appearance of a character (which is about the closest you'll get to Race.) Or you can use the GetGender function to determine if the creature is a man/woman/other etc. And finally you can use GetClassByPosition function to determine whether the creature is a Jedi or a Droid or whatever. As you would expect, these functions return the integer value that you see the .utc's fields in GFF editor and correspond to the values seen in appearance.2da, gender.2da, and classes.2da respectfully.

Thanks for the reply TK102. Your second answer explains why my attempt is not working.

 

However i would like to know how should i place these functions in the dialog file. I'm not able to work scripting yet, so i am more or less looking for ncs already stored i the game to place in the "script that determines available" field of DLGEditor, as much as i did for the aforementioned k_con_partymemberpm.ncs:)

 

Xavier2

Link to comment
Share on other sites

Ah, ok. It's really not that bad.

 

There are basically two types of scripts used in dialogs: conditional scripts and normal scripts.

 

The conditional scripts return a TRUE or FALSE value and are used to determine branches of the dialog. They all begin with this line:

int StartingConditional() {

.

This differs from normal scripts which do not return a value and begin with this line:

void main() {

 

Using vinniemc's handy indexed nwscript (or just the nwscript.nss that comes in scripts.bif) you can see how functions are used.

 

Let's look at the GetAppearanceType function. You see this documentation:

// 524: Returns the appearance type of oCreature (0 if creature doesn't exist)

// - oCreature

int GetAppearanceType(object oCreature);

The int in front of GetAppearanceType tells you that this function will return an integer value. The object oCreature in parantheses tells you there is one parameter that must be passed to this function, and that parameter is an Object. The description of this function tells us more info: that the object must be a creature (not a placeable or a door, for example).

 

Ok, so let's say we want to use this to determine whether or not the PC has the appearance of a Jawa. We know that appearance corresponds to row 73 of appearance.2da.

 

int StartingConditional() {
 int nMyAppearance; // declare an integer variable
 object oMe;        // declare an object variable
 oMe=GetFirstPC();   // set the object 

 //call the function
  nMyAppearance=GetAppearanceType(oMe);

 if (nMyAppearance==73) {
    return TRUE;
  }
  else {
     return FALSE;
  }
}

This code can now be compiled using nwnsscomp. You can also use Fred Tetra's new KotOR Tool to compile the script I think. (I'm too old of a dog to learn those new tricks.) Then once you have the resulting .ncs file, you can put it in your override folder and reference your dialog branch to it as you described.

Link to comment
Share on other sites

Originally posted by tk102

Ah, ok. It's really not that bad.

 

There are basically two types of scripts used in dialogs: conditional scripts and normal scripts. This code can now be compiled using nwnsscomp. You can also use Fred Tetra's new KotOR Tool to compile the script I think. (I'm too old of a dog to learn those new tricks.) Then once you have the resulting .ncs file, you can put it in your override folder and reference your dialog branch to it as you described.

I really appreciate your effort to teach me. Unfortunatelly i am afraid i have spent all my grey matter in learning modeling and other stuff...:D It all still looks like chinese to me. :D. I will try to learn it eventually and i hope i can count on your help then.;).

 

Anyway. Here goes another:

1. What is the metric system used for x,y,z coordinates and orientation in area (.git) placements?

Link to comment
Share on other sites

1. What is the metric system used for x,y,z coordinates and orientation in area (.git) placements?

X, Y, Z are in meters.

Orientation -- good question -- sometimes it's in radians, sometimes it's a quaternion. Best to just do trial and error for it.

Link to comment
Share on other sites

Originally posted by Xavier2

Oh...I am starting to get the hang of it. I understood that talk-fight script and it is working in game. Now another of my questions...:nut:

 

1. I want to make a certain dialog branch to send PC and party members to a new area. How is the code?

 

You'll find everything you need right here: http://www.lucasforums.com/showthread.php?s=&threadid=132045

 

You can also have a look at my warping armband.

Link to comment
Share on other sites

I got it all to work...Sort of.

 

1. The boss goes berzerk but doesn't dies, although the NoPermanentDeath is unmarked in the .utc;

2. One of the henchmen doesn't become hostile and the others, although becoming hostile, stand still untill they are attacked;

 

I would like to know how to make the placeable in the git become a door. I noticed that i don't need to extract and pack them in the module, just reference in the .git. Then how to do it?

Link to comment
Share on other sites

Originally posted by Xavier2

I got it all to work...Sort of.

 

1. The boss goes berzerk but doesn't dies, although the NoPermanentDeath is unmarked in the .utc;

Make sure you have this line in the ScriptUserDefine:

SetMinOneHP(OBJECT_SELF,FALSE);

2. One of the henchmen doesn't become hostile and the others, although becoming hostile, stand still untill they are attacked;

Try adding those lines to your code and compile with k_inc_debug.nss and k_inc_generic.nss - there are other ways of doing it but this is what the game normally uses - :


           DelayCommand(0.5, AssignCommand(oThug1, ClearAllActions()));
           DelayCommand(0.5, AssignCommand(oThug1, GN_DetermineCombatRound()));

 

I would like to know how to make the placeable in the git become a door. I noticed that i don't need to extract and pack them in the module, just reference in the .git. Then how to do it?

Check the 3rd post in the second page of this thread:

http://www.lucasforums.com/showthread.php?s=&threadid=130451&perpage=40&pagenumber=2

 

...and I don't see why you wouldn't pack your door in a single module: it makes things soooo much cleaner ;)

 

As we said yesterday, please post what is in relation with the Talk-fight-talk sequence in the appropriate thread and make separate threads for new topics so it can benefit to everyone. Otherwise I 'll have to split threads.

Link to comment
Share on other sites

Originally posted by Darth333

Make sure you have this line in the ScriptUserDefine:

SetMinOneHP(OBJECT_SELF,FALSE);

 

Try adding those lines to your code and compile with k_inc_debug.nss and k_inc_generic.nss - there are other ways of doing it but this is what the game normally uses - :


           DelayCommand(0.5, AssignCommand(oThug1, ClearAllActions()));
           DelayCommand(0.5, AssignCommand(oThug1, GN_DetermineCombatRound()));

What ScriptUserDefine? The one in the .utc? Or are you talking about the script .nss file i made with your code? I really don't understand where should i place these lines...

 

As we said yesterday, please post what is in relation with the Talk-fight-talk sequence in the appropriate thread and make separate threads for new topics so it can benefit to everyone. Otherwise I 'll have to split threads.

Sorry about that. I posted in wrong thread. But my current doubts are spread over "Talk-Fight-Talk", "Help with script" and 2 "bunch of ramdom..." threads. At some point it gets confusing for me.

 

I can understand that making different threads is usefull for others, but is turning pretty much a mess to the author of the questions(me)...I had to overlook five threads and several posts to find that Killing npc script TK102 posted. I simply couldn't remember where it was and i missed it twice right here before finding it.

 

That is why i started one thread. To keep an easy track of my simple questions. So please do not split it even further.;)

Link to comment
Share on other sites

Originally posted by Xavier2

What ScriptUserDefine? The one in the .utc? Or are you talking about the script .nss file i made with your code? I really don't understand where should i place these lines...

 

For the Min1Hp thing, check tk102's post explaining the talk fight talk sequence: http://www.lucasforums.com/showthread.php?s=&threadid=126615

 

For the attack thing, check my last post in that same thread (talk-fight-talk) and simply add the lines to the code I gave you ;)

Link to comment
Share on other sites

Originally posted by Darth333

For the Min1Hp thing, check tk102's post explaining the talk fight talk sequence: http://www.lucasforums.com/showthread.php?s=&threadid=126615]

Works! It was the npc.utc.

For the attack thing, check my last post in that same thread (talk-fight-talk) and simply add the lines to the code I gave you ;)

Doesn't work. That's what i placed in the script, but it doesn't compile.

void main()

 

{

object otat19_bibfort_01 = GetObjectByTag("tat19_bibfort_01");

object otat19_gamthug4 = GetObjectByTag("tat19_gamthug4");

object otat19_gamthug1 = GetObjectByTag("tat19_gamthug1");

object otat19_gamthug2 = GetObjectByTag("tat19_gamthug2");

object otat19_gamthug3 = GetObjectByTag("tat19_gamthug3");

 

ChangeToStandardFaction(otat19_bibfort_01, 1);

ChangeToStandardFaction(otat19_gamthug4, 1);

ChangeToStandardFaction(otat19_gamthug1, 1);

ChangeToStandardFaction(otat19_gamthug2, 1);

ChangeToStandardFaction(otat19_gamthug3, 1);

 

DelayCommand(0.5, AssignCommand(otat19_bibfort_01, ClearAllActions()));

DelayCommand(0.5, AssignCommand(otat19_bibfort_01, GN_DetermineCombatRound()));

DelayCommand(0.5, AssignCommand(otat19_gamthug1, ClearAllActions()));

DelayCommand(0.5, AssignCommand(otat19_gamthug1, GN_DetermineCombatRound()));

DelayCommand(0.5, AssignCommand(otat19_gamthug2, ClearAllActions()));

DelayCommand(0.5, AssignCommand(otat19_gamthug2, GN_DetermineCombatRound()));

DelayCommand(0.5, AssignCommand(otat19_gamthug3, ClearAllActions()));

DelayCommand(0.5, AssignCommand(otat19_gamthug3, GN_DetermineCombatRound()));

DelayCommand(0.5, AssignCommand(otat19_gamthug4, ClearAllActions()));

DelayCommand(0.5, AssignCommand(otat19_gamthug4, GN_DetermineCombatRound()));

}

Link to comment
Share on other sites

Oops forgot to add the included files. Try this:


#include "k_inc_debug"
#include "k_inc_generic"

void main()
{
object otat19_bibfort_01 = GetObjectByTag("tat19_bibfort_01");
object otat19_gamthug4 = GetObjectByTag("tat19_gamthug4");
object otat19_gamthug1 = GetObjectByTag("tat19_gamthug1");
object otat19_gamthug2 = GetObjectByTag("tat19_gamthug2");
object otat19_gamthug3 = GetObjectByTag("tat19_gamthug3");

ChangeToStandardFaction(otat19_bibfort_01, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(otat19_gamthug4, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(otat19_gamthug1, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(otat19_gamthug2, STANDARD_FACTION_HOSTILE_1);
ChangeToStandardFaction(otat19_gamthug3, STANDARD_FACTION_HOSTILE_1);

DelayCommand(0.5, AssignCommand(otat19_bibfort_01, ClearAllActions()));
DelayCommand(0.5, AssignCommand(otat19_bibfort_01, GN_DetermineCombatRound()));
DelayCommand(0.5, AssignCommand(otat19_gamthug1, ClearAllActions()));
DelayCommand(0.5, AssignCommand(otat19_gamthug1, GN_DetermineCombatRound()));
DelayCommand(0.5, AssignCommand(otat19_gamthug2, ClearAllActions()));
DelayCommand(0.5, AssignCommand(otat19_gamthug2, GN_DetermineCombatRound()));
DelayCommand(0.5, AssignCommand(otat19_gamthug3, ClearAllActions()));
DelayCommand(0.5, AssignCommand(otat19_gamthug3, GN_DetermineCombatRound()));
DelayCommand(0.5, AssignCommand(otat19_gamthug4, ClearAllActions()));
DelayCommand(0.5, AssignCommand(otat19_gamthug4, GN_DetermineCombatRound()));
}

 

and make sure "k_inc_debug.nss" and "k_inc_generic.nss" are in the same folder as your script when you compile or it won't work.

Link to comment
Share on other sites

Originally posted by Darth333

Oops forgot to add the included files. Try this:


#include "k_inc_debug"
#include "k_inc_generic"

Amount of incode stuff...
}

 

and make sure "k_inc_debug.nss" and "k_inc_generic.nss" are in the same folder as your script when you compile or it won't work.

It is in the same folder but KT won't compile. It crashes duo to not being able to find k_inc_debug.ncs And there is no k_inc_debug.ncs in BIF tree. Only k_inc_debug.nss.

 

What to do?

EDIT: Here is the exception text of KT

"System.IO.FileNotFoundException: Could not find file "C:\Program Files\LucasArts\SWKotOR\working\k_inc_debug.ncs".

File name: "C:\Program Files\LucasArts\SWKotOR\working\k_inc_debug.ncs"

at System.IO.__Error.WinIOError(Int32 errorCode, String str)

at System.IO.FileInfo.get_Length()

at kotor_tool.clsERF..ctor(String outputFilePath, String FileType, UInt32 DescriptionStrRef, ERFLocalizedString[] ERFLocalizedStringList, String[] inputFileList)

at kotor_tool.frmProjectManager.miBuildProject_Click(Object sender, EventArgs e)

at System.Windows.Forms.MenuItem.OnClick(EventArgs e)

at System.Windows.Forms.MenuItemData.Execute()

at System.Windows.Forms.Command.Invoke()

at System.Windows.Forms.Control.WmCommand(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.ContainerControl.WndProc(Message& m)

at System.Windows.Forms.Form.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"

Link to comment
Share on other sites

I haven't really worked with KT integrated compiler until now (no offense Fred I haven't been doing any mod recently :D ) and I can't check it right now. So until Fred sees this or I get home to check it ( in about 8 hours) or someone else's answer the question, you can extract the two .nss files k_inc_debug and k_inc_generic and put them in the same folder as your custom script and compile with HazardX script compiler.

 

or the other solution you can chose (but it's a bit overkill) is to:

remove the lines #include "k_inc_debug" and #include "k_inc_generic" from the script. Copy and paste all the contents of k_inc_debug and k_inc_generic in your script and compile.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...