-
October 2nd, 2023, 02:53 #1
- Join Date
- Sep 2010
- Posts
- 13
Modifying Stat Bonus to match RMU?
I am curious if it is possible to change the stat bonuses so that they match RMU? I have tried making an extension with modifications to rules_stats.lua but no luck. Is there maybe a linked file I may be unaware of? or a central data file where stat bonuses are pulled from?
**EDIT: If I change it in the ruleset file, it works fine. It just won't load it as an extension. The extension gets no errors and loads, it just doesnt overwrite the ruleset file with mine.
Now I just need to find where in the files it has the math to divide stat bonuses instead of adding them. No luck so far.
ThanksLast edited by Jayded1; October 3rd, 2023 at 18:02.
-
October 6th, 2023, 07:16 #2
- Join Date
- Apr 2011
- Posts
- 2,253
Hi Jayded1,
To get it to work in an extension, you need it to use your version of a function instead of the built in version. You can do that by adding something like this in your script file:
Code:function onInit() Rules_Stats.StandardStatBonus = StandardStatBonus; end
Dakadin
-
October 6th, 2023, 16:43 #3
- Join Date
- Sep 2010
- Posts
- 13
Hi Dakadin
Thanks! This worked perfectly for my rules.stats change. Is this a norm when altering a ruleset file? having it initialize your change in the extension? I ask because I have a change to rules.skills.lua that also won't load when in my extension but works fine if I alter the ruleset itself. It is a slight modification to how rank bonuses are calculated.
Code:\function RankBonus(nRank, nCalc) if nCalc==1 then -- This is a skill with RMU progression if nRank < 1 then return -25; elseif nRank < 11 then return 5 * nRank; elseif nRank < 21 then return 3 * nRank + 20; elseif nRank < 31 then return 2 * nRank + 40; elseif nRank < 200 then return 1 * nRank + 70; end elseif nCalc==2 then -- This is a skill with basic progression return 5 * nRank; else -- This is a skill with manual progression return 0; end end
Last edited by Jayded1; October 6th, 2023 at 16:47.
-
October 6th, 2023, 17:26 #4
- Join Date
- Apr 2011
- Posts
- 2,253
Hi Jayded1,
Yes it is normal for global scripts. For a windowclass, you can just copy it or merge with the existing one. Hopefully that helps.
Dakadin
-
October 6th, 2023, 19:49 #5
- Join Date
- Sep 2010
- Posts
- 13
That does make sense. And it has helped with some other things. I cant seem to get it to work with the particular code above though. No matter how I try it, it gives the same error "attempt to call global 'RankBonus' (a nil value)
-
October 6th, 2023, 20:17 #6
- Join Date
- Apr 2011
- Posts
- 2,253
Can you attach the extension so I can take a look at it?
-
October 6th, 2023, 22:29 #7
- Join Date
- Sep 2010
- Posts
- 13
Sure. I just cut up the ruleset pak, removed what I wasn't altering, and renamed the base.xml to extension.xml. This is all new to me, this is no doubt a rough way to be doing this. This is the extension I have been working off.
-
October 7th, 2023, 00:53 #8
- Join Date
- Apr 2011
- Posts
- 2,253
Thanks that helps. Just to clear up a couple things.
* The onInit function only runs once when the script is first initialized so adding it to each function won't accomplish what you want.
* You also only need to include the functions that you are overwriting.
* I would recommend using a different name for your global scripts so there isn't any confusion. If you are just overwriting functions from the ruleset then you likely won't even need your name for the script.
* The rules_pc.lua file in your extension isn't declared but I assume that is because you wanted to figure out why the rules_skills.lua wasn't working
Here is the modified version that hopefully helps you see what I am talking about. I haven't tested it so let me know if it has any issues.
Dakadin
-
October 7th, 2023, 01:30 #9
- Join Date
- Sep 2010
- Posts
- 13
Awesome! Yes, it works!
* I assumed I only needed it once. I was just trying different things. Trial by error. I see I was in the wrong area. It was the definitions function I needed to init, not the actual modified function itself.
* Ah ok. That makes sense now that I understand the init feature.
* Ya, that was just there because I was trying to figure out how to change the CombinedStatBonus rule into a Sum function instead of Average. At least I assume it is something like that. Still working on it.
Thank you sooo much.
-
October 7th, 2023, 01:37 #10
- Join Date
- Apr 2011
- Posts
- 2,253
To change it to a sum, just remove the part where it is dividing the result and you should have it.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks