Masamune753 38 Posted April 22, 2021 General scripting question as I am giving myself a crash course...I am trying to get a feel for how functions work together since I don't have any previous experience. Would something like the following be possible... Could you use "GetSkillRank" to dynamically alter the "nBonusMarkup" and "nBonusMarkDown" values within the OpenStore function? If you could, could it be as direct as just taking the value and using a formula like [Persuade/20]=X*100=nBonusMarkUp? Or would you need to set up a conditional to fire specific instances of "nBonusMarkUp" based on certain "greater than" values for persuade? If so, that feels like it would be a really cool mod! I'd be happy to give a stab at doing it, though it feels so easy I have to assume it wouldn't work or else someone would have done it by now 😅 I was inspired to ask based on this thread. Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted April 22, 2021 4 hours ago, Masamune753 said: Or would you need to set up a conditional to fire specific instances of "nBonusMarkUp" based on certain "greater than" values for persuade? You could do it all in one script. It would just be a series of if statements. But you'd have to edit the individual scripts for every merchant in the game. They aren't defined universally. 1 Quote Share this post Link to post Share on other sites
Masamune753 38 Posted April 22, 2021 5 hours ago, DarthParametric said: You could do it all in one script. It would just be a series of if statements. But you'd have to edit the individual scripts for every merchant in the game. They aren't defined universally. Got it. Definitely didn't think it would be universal, copy and pasting the same adjustment to 20 scripts doesn't seem like it would be a huge burden (it would be finding them all). My most direct question is whether I could use a formula to fill in the value for nBonusMarkup and nBonusMarkdown? Can GetSkillRank equal value X, and then can I use some transformation of X to equal nBonusMarkup/down? Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted April 22, 2021 I mean you could do something as simple as void main() { object oPC = GetFirstPC(); object oStore = GetObjectByTag("STORE_TAG_HERE", 0); int nPersuade = GetSkillRank(SKILL_PERSUADE, oPC); int nBonusMarkUp = -nPersuade; OpenStore(oStore, oPC, nBonusMarkUp); } Looking at the scripts for Yavin Station in K1, it seems like Suvam's discounts are either -5 or -20, so using the negative value of the PC's Persuade total as-is could work. Although you could modify it using if statements like I said before, perhaps something like: void main() { object oPC = GetFirstPC(); object oStore = GetObjectByTag("STORE_TAG_HERE", 0); int nPersuade = GetSkillRank(SKILL_PERSUADE, oPC); int nBonusMarkUp; int nPersuadeAdj; if (nPersuade <= 5) { nPersuadeAdj = 2; } else if (nPersuade > 5 && nPersuade <= 10) { nPersuadeAdj = 5; } else if (nPersuade > 10 && nPersuade <= 15) { nPersuadeAdj = 7; } else if (nPersuade > 15) { nPersuadeAdj = 10; } nBonusMarkUp = -nPersuadeAdj; OpenStore(oStore, oPC, nBonusMarkUp); } You can use whatever mathematical operations you like to scale the values as you require. Google the C formatting for whatever operations you want to do if you are unfamiliar with the syntax. 47 minutes ago, Masamune753 said: it would be finding them all You'll need to check each individual module. Check the merchant's DLG file to find out what script/s fire when they open the store. You'll then need to decompile the binary script (NCS), since only the global scripts have included source. You can pull the Tag of the store from the UTM file, although the scripts you'll be editing will already have it. You'll need DeNCS (requires Java) to decompile the scripts. You'll want DLGEditor to browse the DLGs (don't use KTool's included editor - it doesn't work properly with TSL DLGs). You can use KTool or KGFF to examine the various GFF files like UTCs, UTIs, UTMs, etc. 2 Quote Share this post Link to post Share on other sites
Masamune753 38 Posted April 22, 2021 Amazing, thank you for the breakdown! I will give this a try and see if I can make this work broadly across the rest of K1 (and eventually TSL). Quote Share this post Link to post Share on other sites