Jump to content

Home

NPC 'twins'


DarthJebus05

Recommended Posts

I made a recruitable NPC, forgot to make the 'Eliminate Twins' script. So after I recruited the NPC, he was still stand where I spawned him, but also a Twin was in behind me in my party.

 

So I exit the game and make this script:

 

void main() 
{
ActionPauseConversation();
object oGoodbye;
oGoodbye = GetObjectByTag("Juhani");
SetGlobalFadeOut(1.0, 0.5);    
DelayCommand(1.0, DestroyObject(oGoodbye));
DelayCommand(1.0,SetGlobalFadeIn(0.7,0.0));
ActionResumeConversation();
}

 

Tag is Juhani, since my NPC replaces her.

 

But I have a problem still, he still has Twins when I recruit him.

 

Is that Script right or am I doing something wrong?

 

:EDIT: I got it to work, but now I need the recruit script to trigger right after the conversation ends. I needed to put the Twins script into the last line of conversation, so the recruit script triggers during the dialog.

 

Any help please?

Link to comment
Share on other sites

Merge the 2 scripts together. The easy way would be to make each script it's own self contained function call.

 

//This is Psuedocode not the real thing.

void TwinsFunction()
{
  //My code for the twins script.
  ............
}

void RecruitFunction()
{
  //My code for the actual recruiting of my NPC.
  .............
}

void main()
{
  TwinsFunction();
  RecruitFunction();
}

 

 

You could also pass paramaters such as coordinates into those functions if you wanted or you could self contain the coordinates if you don't need to.

Link to comment
Share on other sites

I just tried the script, it compiled alright, I tried repacking the .mod with the script, but I get this error if I have the script in the ERF/MOD builder and wont let me build it:

 

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

 

************** Exception Text **************

System.IndexOutOfRangeException: Index was outside the bounds of the array.

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

at kotor_tool.frmERFManager.btnBuild_Click(Object sender, EventArgs e)

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

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

at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

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

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

at System.Windows.Forms.Button.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)

 

 

************** Loaded Assemblies **************

mscorlib

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2407

CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll

----------------------------------------

kotor_tool

Assembly Version: 1.0.2131.27110

Win32 Version: 1.0.2131.27110

CodeBase: file:///C:/Program%20Files/Fred%20Tetra/Kotor%20Tool/kotor_tool.exe

----------------------------------------

System.Windows.Forms

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll

----------------------------------------

System

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2407

CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll

----------------------------------------

System.Drawing

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll

----------------------------------------

Microsoft.VisualBasic

Assembly Version: 7.0.5000.0

Win32 Version: 7.10.6001.4

CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll

----------------------------------------

System.Xml

Assembly Version: 1.0.5000.0

Win32 Version: 1.1.4322.2032

CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll

----------------------------------------

e9q5pbq3

Assembly Version: 0.0.0.0

Win32 Version: 1.1.4322.2407

CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll

----------------------------------------

 

************** JIT Debugging **************

To enable just in time (JIT) debugging, the config file for this

application or machine (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

 

For example:

 

<configuration>

<system.windows.forms jitDebugging="true" />

</configuration>

 

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the machine

rather than being handled by this dialog.

 

This is the script:

 

void TwinsFunction()
{
  ActionPauseConversation();
object oGoodbye;
oGoodbye = GetObjectByTag("Juhani");
SetGlobalFadeOut(1.0, 0.5);    
DelayCommand(1.0, DestroyObject(oGoodbye));
DelayCommand(1.0,SetGlobalFadeIn(0.7,0.0));
ActionResumeConversation();
}

void RecruitFunction()
{
  RemoveAvailableNPC(5);
  AddAvailableNPCByTemplate(5, "reign");
  DelayCommand(8.0,ShowPartySelectionGUI());
}

void main()
{
  TwinsFunction();
  RecruitFunction();
}

 

I named the script endar_two_scripts.

Link to comment
Share on other sites

I got the script to work and the BUILD MOD worked too.

 

But for some reason, the Party Selection Screen doesn't come up, my NPC does disappear, but can be added when I get to Taris.

 

Script used:

 

void TwinsFunction()
{
  ActionPauseConversation();
object oGoodbye;
oGoodbye = GetObjectByTag("Juhani");
SetGlobalFadeOut(1.0, 0.5);    
DelayCommand(1.0, DestroyObject(oGoodbye));
DelayCommand(1.0,SetGlobalFadeIn(0.7,0.0));
ActionResumeConversation();
}

void RecruitFunction()
{
  RemoveAvailableNPC(5);
  AddAvailableNPCByTemplate(5, "reign");
  DelayCommand(8.0,ShowPartySelectionGUI());
}

void main()
{
  TwinsFunction();
  RecruitFunction();
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...