lfnetwork.com mark read register faq members calendar

Thread: What scripts are involved in rolls during dialog?
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-10-2006, 12:56 AM   #1
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
What scripts are involved in rolls during dialog?

One of my biggest peeves with this game has always been that rolls during dialog (such as when trying to fix HK-47, or the Pazaak addicted droid on Nar Shaada) are determined by the PC's skill, rather than the highest skill in the active party. After all, your two buddies aren't just standing there for nothing, and the party leader shouldn't have to be a master of everything when s/he has friends around to help!
Because of this, I've decided to make a mod that would check in-conversation rolls against the highest skill in the active party instead of just the main PC's skill. Unfortunately, there's a whole tangle of scripts in the game, and I can't find which ones are used for this (BIOWARE, Comment your code better!). Can anyone be of any help? Thanks!
mobn is offline   you may: quote & reply,
Old 03-10-2006, 07:06 AM   #2
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by mobn
One of my biggest peeves with this game has always been that rolls during dialog (such as when trying to fix HK-47, or the Pazaak addicted droid on Nar Shaada) are determined by the PC's skill, rather than the highest skill in the active party. After all, your two buddies aren't just standing there for nothing, and the party leader shouldn't have to be a master of everything when s/he has friends around to help!
Because of this, I've decided to make a mod that would check in-conversation rolls against the highest skill in the active party instead of just the main PC's skill. Unfortunately, there's a whole tangle of scripts in the game, and I can't find which ones are used for this (BIOWARE, Comment your code better!). Can anyone be of any help? Thanks!
I assume you mean it's for K2:TSL since you mention Nar Shaddaa. The scripts used for skill checks have the prefix c_sc_ in their name, followed by a 3 letter identifier for which skill they check, and a _gt ending if the skill need to be higher than the set parameter value, _eq if the skill must match the parameter, _lt if the skill has to be lower and _bet if the skill must be in the interval set by the two parameters.

To make all skill checks using all available party members, you could modify those scripts to replace the skill check against the dialog speaker with a skill check against the party member with the highest skill rank. For example, a modified c_sc_rep_gt script, checking if the repair skill rank is higher than the set parameter, might be changed as:
Code:
// ST: c_sc_rep_gt
int StartingConditional() {
    int nCompareAmt = GetScriptParameter(1);
    
    // ST: Only check the speaker if in solo mode...
    if (GetSoloMode()) {
        return (GetSkillRank(SKILL_REPAIR, GetPCSpeaker()) > nCompareAmt);
    }
    
    // ST: Get the highest skill rank in the active party...
    int iParty;
    int iRank = 0;
    for (iParty = 0; iParty < GetPartyMemberCount(); iParty++) {
        object oParty = GetPartyMemberByIndex(iParty);
        
        if (GetSkillRank(SKILL_REPAIR, oParty) > iRank) {
            iRank = GetSkillRank(SKILL_REPAIR, oParty);
        }
    }
    
    // ST: Compare the skill against the parameter value.
    return (iRank > nCompareAmt);
}

stoffe is offline   you may: quote & reply,
Old 03-10-2006, 12:22 PM   #3
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Wow, thanks for the detailed answer! Will that script you just put up check only the active party (the characters currently in use), or the whole party?
mobn is offline   you may: quote & reply,
Old 03-10-2006, 01:52 PM   #4
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,765
Current Game: Watch_Dogs
Forum Veteran Helpful! Notable contributor 
It would check just the active party.


tk102 is offline   you may: quote & reply,
Old 03-10-2006, 02:18 PM   #5
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Okay, now I see it. I just had to work out what all those extra KOTOR-specific functions were. This is awesome. I'll apply this change to all the scripts, and the package it and distribute it. Do you want your name on it? I had planned to write it myself once I knew which scripts to work on, but you've doen it for me. So, would you like top billing, and I just list myself as distributor?

Another question. What situations are the lower-than or equal-to scripts used in? I'm not sure whether I should fix those.

Last edited by RedHawke; 03-13-2006 at 09:49 PM.
mobn is offline   you may: quote & reply,
Old 03-13-2006, 09:07 PM   #6
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Okay, I finally got some time to change the scripts, but I noticed something. It looks like these scripts all want a boolean value (TRUE or FALSE) returned, and not (iRank>nCompareAmt) returned.
My question is, will the game except the return values in the script you posted, or will the changes I've made here work better?:
Code:
// ST: c_sc_rep_gt
int StartingConditional() {
    int nCompareAmt = GetScriptParameter(1);
    
    // ST: Only check the speaker if in solo mode...
    if (GetSoloMode()) {
        if (GetSkillRank(SKILL_REPAIR, GetPCSpeaker()) > nCompareAmt){return TRUE;}
	return FALSE;
    }
    
    // ST: Get the highest skill rank in the active party...
    int iParty;
    int iRank = 0;
    for (iParty = 0; iParty < GetPartyMemberCount(); iParty++) {
        object oParty = GetPartyMemberByIndex(iParty);
        
        if (GetSkillRank(SKILL_REPAIR, oParty) > iRank) {
            iRank = GetSkillRank(SKILL_REPAIR, oParty);
        }
    }
    
    // ST: Compare the skill against the parameter value.
    if (iRank > nCompareAmt){return TRUE;}
	Return FALSE;
}
mobn is offline   you may: quote & reply,
Old 03-14-2006, 02:23 AM   #7
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,765
Current Game: Watch_Dogs
Forum Veteran Helpful! Notable contributor 
That is a good observation and I'm glad you asked that question.

They will both work. Inequalities evalute to TRUE or FALSE. In stoffe -mkb-'s syntax, the (iRank>nComparAmt) is evaluated to TRUE or FALSE before it is returned. Your syntax is more explicit (or more wordy depending on your point of view).
tk102 is offline   you may: quote & reply,
Old 03-14-2006, 01:53 PM   #8
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Very cool! I should finish this thing sometime this week then (if I don't finish it before Monday, Oblivion may keep me from ever finishing it!). I'll post it here first.
mobn is offline   you may: quote & reply,
Old 03-14-2006, 02:50 PM   #9
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Okay, yet another question

What situations are the BET, EQ, and LT scripts used in? I can't decide whether I want to mod them or not, because I'm not sure what it would change.
mobn is offline   you may: quote & reply,
Old 03-14-2006, 03:07 PM   #10
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
KOTOR tool is giving me an error at line 26 (the last Return FALSE in my version of the script). Any idea what could be wrong?
mobn is offline   you may: quote & reply,
Old 03-14-2006, 03:17 PM   #11
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
I can't seem to fix the error. Here's a rar of the scripts I changed. Can you see anything wrong?
http://rapidshare.de/files/15510473/scripts.rar.html
mobn is offline   you may: quote & reply,
Old 03-14-2006, 03:23 PM   #12
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,765
Current Game: Watch_Dogs
Forum Veteran Helpful! Notable contributor 
Don't capitalize the word return.


tk102 is offline   you may: quote & reply,
Old 03-14-2006, 04:15 PM   #13
mobn
Lurker
 
Join Date: Mar 2006
Posts: 9
Quote:
Originally Posted by tk102
Don't capitalize the word return.
Cool, that fixed it.
mobn is offline   you may: quote & reply,
Old 03-23-2006, 11:13 PM   #14
FreddyFroglok
Lurker
 
FreddyFroglok's Avatar
 
Join Date: Jan 2006
Posts: 7
Huh. I just noticed that you guys were talking about boolean values, but the function itself is declared as an integer function. Are KOTOR True and False 0 and 1 values?
FreddyFroglok is offline   you may: quote & reply,
Old 03-24-2006, 12:07 AM   #15
Det. Bart Lasiter
obama.png
 
Det. Bart Lasiter's Avatar
 
Join Date: Mar 2005
Location: `(.)~
Posts: 7,997
Current Game: all
Forum Veteran LF Jester 
TRUE and FALSE are merely const integer values, with TRUE being 1 and FALSE being 0. 1 and TRUE are interchangable; 0 and FALSE are interchangable. For instance:
Code:
if(nCheck == TRUE) {do_something();}
else if(nCheck == 0) {do_something_else();}



"No, Mama. You can bet your sweet ass and half a titty whoever put that hit on you already got the cops in their back pocket." ~Black Dynamite
Det. Bart Lasiter is offline   you may: quote & reply,
Old 03-24-2006, 06:55 AM   #16
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by jmac7142
TRUE and FALSE are merely const integer values, with TRUE being 1 and FALSE being 0. 1 and TRUE are interchangable; 0 and FALSE are interchangable. For instance:
Code:
if(nCheck == TRUE) {do_something();}
else if(nCheck == 0) {do_something_else();}
Keep in mind that this makes it somewhat risky to use TRUE in some conditional checks, since I've noticed that some functions that return true (the boolean value) does not return TRUE (the integer constant) for some odd reason.

The GetLocalBoolean() function is one such case. For example:
Code:
SetLocalBoolean(OBJECT_SELF, 120, TRUE);
int bBool = GetLocalBoolean(OBJECT_SELF, 120);

if (bBool == TRUE) {
	// This will not run in most cases....
}

if (bBool) {
	// This will run, on the other hand...
}
In the above case, testing the value of a LocalBoolean against TRUE is highly unreliable since it very, very rarely returns TRUE (the constant) when the LocalBoolean is set to true. It returns false or not false (i.e. a number higher than 0).

Worth keeping in mind since bugs resulting from the above can be hard to locate.

stoffe is offline   you may: quote & reply,
Old 03-24-2006, 10:08 AM   #17
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,765
Current Game: Watch_Dogs
Forum Veteran Helpful! Notable contributor 
Quote:
Originally Posted by stoffe -mkb-
some functions that return true (the boolean value) does not return TRUE (the integer constant)
I had no idea about this. Thank you for bringing attention to it!


tk102 is offline   you may: quote & reply,
Old 03-26-2006, 06:48 PM   #18
FreddyFroglok
Lurker
 
FreddyFroglok's Avatar
 
Join Date: Jan 2006
Posts: 7
I've been bitten by this bug before in other languages. Then I end up torturing some poor Ewok with a pair of hot pliers for hours while I try to figure out why my TRUE condition isn't processing. The best way I've found for this is to stick with only the conditionals (x==FALSE) and (x!=FALSE) for any language that doesn't have tightly defined booleans, but sometimes I slip up and do checks for TRUE. Then the Ewoks suffer...

Thank you all for the clarification on this.
FreddyFroglok is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > What scripts are involved in rolls during dialog?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:58 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.