Salk

[KotOR] Swoop Racing Times

Recommended Posts

Hello!

I am in Manaan and while playing the Swoop Racing minigame, I am reminded of how useful it would be to have a chance of tweaking a little the record times (especially here in Manaan) to give more meaning to the "amateur", "semipro", "professional" racing class by making the time difference more prominent.

 

I noticed how in the file k_inc_man there is this:

 

int QUEEDLE_TIME = 3012;
int CASSANDRA_TIME = 2702;
int JAX_TIME = 2548;
int CHAMP_TIME = 2348;

Does anyone know whether or not this is what needs modifying? Is there something else I should be looking for?

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

It certainly.sounds as if it's what you're looking for. I'd just try it ;);)

 

I would gladly try but I am unsure about how to proceed with it. It's a k_inc_* file...

 

This same file has the following:

 

void SetTokenRaceTime(int nToken, int nRacerTime)
{
    // calculate the time components
    int nMinutes = nRacerTime/6000;
    int nSeconds = (nRacerTime - (nMinutes * 6000)) / 100;
    int nFractions =  nRacerTime - ((nMinutes * 6000) + (nSeconds * 100));


    //building the time string
    string sTime = IntToString(nMinutes) + ":";
    if (nSeconds < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nSeconds) + ":";
    if(nFractions < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nFractions);
    SetCustomToken(nToken,sTime);


}

I believe this part is what creates the actual CUSTOM tokens used in the swoop racing dialogues in Manaan.

 

I should find the script that uses the function SetTokenRaceTime... But how do I find it?

 

Edited by Salk

Share this post


Link to post
Share on other sites

I would gladly try but I am unsure about how to proceed with it. It's a k_inc_* file...

You might want to ask Fair Strides - hes the expert. 

 

Btw, im glad you try on these - vanilla swoop race is way too easy. For motivation, it would be cool to give special prizes like rare items etc.

Share this post


Link to post
Share on other sites

 

I would gladly try but I am unsure about how to proceed with it. It's a k_inc_* file...

 

This same file has the following:

 

void SetTokenRaceTime(int nToken, int nRacerTime)
{
    // calculate the time components
    int nMinutes = nRacerTime/6000;
    int nSeconds = (nRacerTime - (nMinutes * 6000)) / 100;
    int nFractions =  nRacerTime - ((nMinutes * 6000) + (nSeconds * 100));


    //building the time string
    string sTime = IntToString(nMinutes) + ":";
    if (nSeconds < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nSeconds) + ":";
    if(nFractions < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nFractions);
    SetCustomToken(nToken,sTime);


}

I believe this part is what creates the actual CUSTOM tokens used in the swoop racing dialogues in Manaan.

 

I should find the script that uses the function SetTokenRaceTime... But how do I find it?

 

 

 

I'm no expert but from what I can tell, this SetTokenRaceTime function takes the constants you posted earlier and translates them to the minute:seconds:fractions format the player sees and can interpret. So if you change the constants, the new race time should appear both in subtitles and as actual race time. As I said, just try to change one of them and see if the displayed race time changes. If it doesn't or somehow screws up the game you can always delete the modified ncs from your Override.

Share this post


Link to post
Share on other sites

IMO, the problem with trying to make the classes' differences more pronounced is the fact that you're running the exact same track with each one...

 

Don't know how that would be fixed, though.

Share this post


Link to post
Share on other sites

Kexikus,

 

from the little I understand, I cannot make a .ncs file of the above .nss file. That's the problem... 

 

In theory, I could extract the whole scripts.bif file where k_inc_man.nss is, change it there and then replace the original scripts.bif in the /Data folder of the game but I wonder if it is even possible to repack extracted files into a new .bif?

 

Alternatively, I would need to find the file in the game that does use the SetTokenRaceTime function included in k_inc_man.nss and change the time constants there. But the problem here is, what file is that?

Share this post


Link to post
Share on other sites

Fair Strides explains the reason here

 

In short, the k_inc_* files (from what I understand) are just libraries that are called by other scripts to allow for the use of extra functions.

 

Compiling an include file does not produce anything.

Share this post


Link to post
Share on other sites

I don't check DS for two days and I've already counted my name mentioned about six times (plus I got something like 8 emails related to DS, though some were status related)... :D

 

I'm at school but should be home tonight. Should be pretty easy to dig through the Manaan scripts and look for the code. I'll let you know what I dig up.

 

...And by the way, don't ask me to write a tutorial on how to find this stuff; I'm not sure I could actually explain it properly... :|

  • Like 1

Share this post


Link to post
Share on other sites

From what I've been able to track down, it's most likely set in the area's OnEnter script, which won't decompile.

 

What you could do instead is open up the Swoop organizer's (Sslamoth's) .utc file, man26_swpreg.utc in manm26ab. Set his OnDialogue script to something (for example, "salk_racers") and then make a new script with the following:

 

 

 

void SetTokenRaceTime(int nToken, int nRacerTime)
{
    // calculate the time components
    int nMinutes = nRacerTime/6000;
    int nSeconds = (nRacerTime - (nMinutes * 6000)) / 100;
    int nFractions =  nRacerTime - ((nMinutes * 6000) + (nSeconds * 100));

    //building the time string
    string sTime = IntToString(nMinutes) + ":";
    if (nSeconds < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nSeconds) + ":";
    if(nFractions < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nFractions);
    SetCustomToken(nToken,sTime);

}

void main()
{
    int QUEEDLE_TIME = 3012;
    int CASSANDRA_TIME = 2702;
    int JAX_TIME = 2548;
    int CHAMP_TIME = 2348;

    SetCustomToken(18, QUEEDLE_TIME);
    SetCustomToken(19, CASSANDRA_TIME);
    SetCustomToken(20, JAX_TIME);
    SetCustomToken(21, CHAMP_TIME);
}

 

 

 

I say to use the OnDialogue event so that we know for sure the changes are in effect, since this will be set every time you talk to him. You can just adjust the times in the void main at this point, but remember how the times themselves are calculated.

Share this post


Link to post
Share on other sites

Unfortunately the solution above did not work.

 

I had to put the SetCustomToken second parameter between "" for making it even compile but other than that when I tested it nothing happens when I click to initiate the dialogue.

 

Even if it *did* start the dialogue I was thinking that the script above would not do anything to actually change the record times since the function SetTokenRaceTime is never even called within the main function. Am I wrong?

 

I suppose I should just drop this, although it irks me... :D

Share this post


Link to post
Share on other sites

Yeah, I guess it should be SetTokenRaceTime that's called in the main function and not SetCustomToken. Then it would also work without the quotation marks since SetTokenRaceTime expects an integer as second parameter while SetCustomToken expects a String.

 

The thing I'm wondering now is whether or not this will affect the actual racing times. This probably depends on where they are set but I would assume that it's not the same as the string token used for the dialog but another function in another script that takes the original integer constant and transforms it into some kind of time scale the game can handle. But testing that would be pretty easy once you get the script posted by FS to work (which it should with the change I described above).

Share this post


Link to post
Share on other sites

Yes, it seems I was in a hurry...

 

This should work:

 

 

void SetTokenRaceTime(int nToken, int nRacerTime)
{
    // calculate the time components
    int nMinutes = nRacerTime/6000;
    int nSeconds = (nRacerTime - (nMinutes * 6000)) / 100;
    int nFractions =  nRacerTime - ((nMinutes * 6000) + (nSeconds * 100));

    //building the time string
    string sTime = IntToString(nMinutes) + ":";
    if (nSeconds < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nSeconds) + ":";
    if(nFractions < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nFractions);
    SetCustomToken(nToken,sTime);

}

void main()
{
    int QUEEDLE_TIME = 3012;
    int CASSANDRA_TIME = 2702;
    int JAX_TIME = 2548;
    int CHAMP_TIME = 2348;

    SetTokenRaceTime(18, QUEEDLE_TIME);
    SetTokenRaceTime(19, CASSANDRA_TIME);
    SetTokenRaceTime(20, JAX_TIME);
    SetTokenRaceTime(21, CHAMP_TIME);

    AssignCommand(GetFirstPC(), ActioNStartConversation(OBJECT_SELF));
}

 

 

 

However I just took a moment to do some digging, and the conditional script that checks if you lost the race is 3400+ bytes (3.4+ KB) instead of the usual several hundred. Unfortunately, DeNCS fails to de-compile it. Looking at the byte code I don't think it could be an issue, but if it is, we're pretty much out of luck here.

Share this post


Link to post
Share on other sites

Like before, clicking on the Swoop organizer does not start any conversation and disrupts the successive interaction with object (no matter where I click, nothing happens).

Share this post


Link to post
Share on other sites

In the latest version of FS' script it says ActioNStartConversation with a capital N where it should be a small n. If you haven't changed that it could be the reason. (Not sure why this line exists anyway^^)

 

Also, where in the dlg did you put the script and are you sure it's named correctly?

Share this post


Link to post
Share on other sites

Hello Kexikus!

 

Yes, I noticed the typo. It wouldn't compile before changing to a non capital "n".

 

The script is, as suggested by FS himself, been called by "OnDialogue" (so it is not in the .dlg file ) and must somehow disrupt things. Unfortunately I do not know enough to understand why it happens. The problem on my side is also that each time I want to mess with .utc files I need to change the DPI back to normal and reboot the system, making it for a very tedious process (Windows XP requires this reboot each time). 

Share this post


Link to post
Share on other sites

Oh right, OnDialogue is not in the dlg... Could have known that^^

 

Do you use a savegame where you've not been to the swoop area before when testing the script?

 

Or maybe try and put the script in the very first line of his dlg instead (and remove the ActionStartConversation line).

Share this post


Link to post
Share on other sites

Hello!

I resurrect my own old thread to report some news.

First of all, I am now able to choose new record times to beat for the three tiers in Tatooine and Manaan. 

Said that, there is still something that I can't figure out. Namely how the original times are calculated by the game.

Using Manaan as example we have the following record times:

Queedle: 0:23:82

Casandra: 0:23:25

Hukta: 0:22:50

Queedle as Sector Champion: 0:22:48

But the formula we find in the include script shows this:

int QUEEDLE_TIME = 3012;
int CASSANDRA_TIME = 2702;
int JAX_TIME = 2548;
int CHAMP_TIME = 2348;

void SetTokenRaceTime(int nToken, int nRacerTime)
{
    // calculate the time components
    int nMinutes = nRacerTime/6000;
    int nSeconds = (nRacerTime - (nMinutes * 6000)) / 100;
    int nFractions =  nRacerTime - ((nMinutes * 6000) + (nSeconds * 100));

    //building the time string
    string sTime = IntToString(nMinutes) + ":";
    if (nSeconds < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nSeconds) + ":";
    if(nFractions < 10)
    {
        sTime = sTime + "0";
    }
    sTime = sTime + IntToString(nFractions);
    SetCustomToken(nToken,sTime);

}

And according to this, the times should be:

Queedle: 0:30:12

Casandra: 0:27:02

Hukta: 0:25:48

Queedle as Sector Champion: 0:23:48

which would be just what I wished it was from the very beginning. Records that would show a real gap between one Tier and the next one rather than a series of almost identical results. Somehow the game changes those times somewhere although I wouldn't know how and when exactly.

Still,  in my own SW: KotOR Upgrade, the times indicated above will be restored thus making the Swoop Racing a much more sensible kind of challenge.

Cheers!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.