mobn Posted March 10, 2006 Share Posted March 10, 2006 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! Link to comment Share on other sites More sharing options...
stoffe Posted March 10, 2006 Share Posted March 10, 2006 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: // 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); } Link to comment Share on other sites More sharing options...
mobn Posted March 10, 2006 Author Share Posted March 10, 2006 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? Link to comment Share on other sites More sharing options...
tk102 Posted March 10, 2006 Share Posted March 10, 2006 It would check just the active party. Link to comment Share on other sites More sharing options...
mobn Posted March 10, 2006 Author Share Posted March 10, 2006 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. Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 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?: // 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; } Link to comment Share on other sites More sharing options...
tk102 Posted March 14, 2006 Share Posted March 14, 2006 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). Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 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. Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 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. Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 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? Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 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 Link to comment Share on other sites More sharing options...
tk102 Posted March 14, 2006 Share Posted March 14, 2006 Don't capitalize the word return. Link to comment Share on other sites More sharing options...
mobn Posted March 14, 2006 Author Share Posted March 14, 2006 Don't capitalize the word return. Cool, that fixed it. Link to comment Share on other sites More sharing options...
FreddyFroglok Posted March 24, 2006 Share Posted March 24, 2006 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? Link to comment Share on other sites More sharing options...
Det. Bart Lasiter Posted March 24, 2006 Share Posted March 24, 2006 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: if(nCheck == TRUE) {do_something();} else if(nCheck == 0) {do_something_else();} Link to comment Share on other sites More sharing options...
stoffe Posted March 24, 2006 Share Posted March 24, 2006 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: 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: 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. Link to comment Share on other sites More sharing options...
tk102 Posted March 24, 2006 Share Posted March 24, 2006 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! Link to comment Share on other sites More sharing options...
FreddyFroglok Posted March 26, 2006 Share Posted March 26, 2006 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.