Jump to content

Home

KOTOR2: Where is Main { }?


Trom

Recommended Posts

I'm on a quest to restore the original ending to KOTOR2. I have some experience in C and scripting languages, but not using nwnnsscomp. I've been using the KOTOR Tool, and I was amazed by how much information was accessible not to mention a compiler. The VO and arrays of structures seem to be there for all the missing sequences. The only indication so far of something missing is in the dlg files. For example, in 852nih.dlg under 8 under 852NIH_dlg.erf there is a reference under Node Scripts, "Script to run for this node" to a script: "a_nihilus" which I can't find anyhere. (It *is* under a branch with a "SCRAP" notation.) Another is un 852sacri.dlg which starts out with this note

{Gameplay Programmer: If the player activates Visas body in second sequence - designer will set the flag for this: ("852NIH_VisasSacrifice" == 1, already in database and in 852NIH.dlg) - fire off a cut scene of the player walking over to the body of Visas and bending down. In the background the echo drumbeat plays in silence.}

Under one of the branches a_sacrifice is referenced and I can't find that file, if that's what it is, either.

 

At any rate, my major problem at the moment is finding the Main function of the program. I thought k_ai_master.nss might have it but that seems devoted to combat. There has to be main loop in there somewhere! I've searched through all the files (twice!), but there are a good many of them and I must have missed it. I had hoped that since it really looks like they changed the endgame at the last minute, that they might have just commented out some code or did a few GOTO statements, something quick to allow for the alternative ending. Well, that was wishful thinking. I would appreciate any help!

 

In short, where is the program entry point?

Link to comment
Share on other sites

Uh oh. Well I suppose that's good news/bad news. The scripts are there so that means they cannot be easily modifed? I'm sorry about the dumb questions, and I know you told me on the Obsidian Board it's more difficult than this, but there has to be a point where the program begins. It seems if I found that than I could trace the logic to discover if the original ending could be re-implemented.

 

Hey, I'd be the first to admit that I know little about this system, but I don't see anyone else working on this at present. Aurora's doing a great job in piecing together the missing endgame, but she needs programming help.

 

So my questions are:

 

1. Where in the code does the program start?

 

2. Is there anyway to decompile/recompile the sourceless compiled scripts other than into byte code?

 

3. I'm guessing that the secondary loop begins at the galaxy map when a planet is selected. By clicking on that map, all the resources--triggers, layout, npc's, characteristics, etc.-- for that planet are loaded, and once the PC exits EH, then the plot unfolds through dialogue and location of the PC. Is this logic correct? If so, then where would that begin? I've found the planet selection function, k_sup_galaxymap, but don't see where it's instanced.

Link to comment
Share on other sites

What's with this loop thing? :D

It seems you are thinking way too much into the source of actual executable (engine). Scripts are more "primitive" form of communicating with the game world. I don't think you'll find mysterious, all-controlling main loop there.

 

Originally posted by Trom

In short, where is the program entry point?

 

I wonder why you need that, provided you want to make new ending.. Hmm.

 

Just examine all files from 907MAL module: local scripts, dialogs, etc. This is where the ending happens, and those files are most likely responsible for it.

Link to comment
Share on other sites

Hey Trom, KOTOR's scripting system is using EVENT based programming, which is very different from the linear style of BASIC or C. Each object has a set of scripts that will fire depending on an event. Some of the events in Kotor is On Spawn, On Dialog, On Death, On Perception. You can see a listing of the events when you open up a creature file in Kotor tool. Just look at the "Scripts" tag.

 

If you want to learn more you should check out the NWN Lexicon. See the starting tutorials. There is a link to it in the stickies.

 

There is no way to decompile a script into nice easy to read code. This is one of the big roadblocks in modding KOTOR. But you can pick up the overall flow of what a program is trying to do by looking at the compiled version.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...