Adding more stats that behave like SP - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Games Development (https://www.save-point.org/forum-4.html) +--- Forum: Code Support (https://www.save-point.org/forum-20.html) +--- Thread: Adding more stats that behave like SP (/thread-8100.html) |
Adding more stats that behave like SP - Bennerdeben - 07-17-2020 So this has been bothering me for a long time now.. so much so, that I’m calling out to you guys for any help or insight. For my project I’m wanting to add two stats that work just like SP, namely STM and MP. I found out adding the first (STM) was quite easy, I just replaced the names with “SP” in the script with “STM”, also since I am not interested in a stat called “SP”. With it I added a nice green STM-bar as a visual indicator which I’ve found a code for. Now for the MP stat it seems a lot harder. I had to make a whole new stat that does not exist in the database. However this seems at least partly possible. With help of Kitsune's Extra Statistics I managed to add MP, but here comes the problem: I cannot figure out how to define a minimal and maximum amount for MP to make it work like SP. I now have a MP stat that works more like a fixed stat such as STR or INT. My best guess is the code below has to be modified somehow? Code: def maxmp Does anyone know how to make it work with a bar and that can be used up using skills, just like SP? I’m very much a Rubyscript noob so after trying different things I am clueless RE: Adding more stats that behave like SP - DerVVulfman - 07-17-2020 Just like any of the RMXP stats, Strength, Intelligence, Raw Good Looks, they all have a fully minimum stat of 0 and a full blown max of 999 regardless of level. What you want is to understand about the stat's increase and how they work. When you change the Str, Dex, HP stats, you can do that in the editor. With this, you need the script. Please note the below section: Code: # Described below. Actor #1's char stat starts at 10 and const starts at 12 When it shows: 1 => [[10,2],[12,3]] .... it shows how actor #1 handles TWO different stats. The first array [10,2] is for the first stat, and [12,3] is for the second stat. I guess you'd have 1 => [[10,2]] all by itself to handle your #1 actor as you're adding only one stat, right? But you'd be doing this for actor #2, #3, #27, #98, whatever. Each of these arrays defines what your actors start off with at level 1, and how much of an increase you get insofar as a stat increase. In the above CODE example, Actor #1 startts off his first stat with 10 points to that stat, and Actror #2 gets 20 points of that stat at level 1. Both have a 2pt curve in the above example. So there is no begin or end stats, but a curve progression. Now you can run a test, jacking your hero up to the max level and see how high his stats are at that level. It would be so much easier if I could edit/alter the editor.... yeah, like that's gonna happen. Just remember, you need to make matching stats for enemies, weapons, etc. And the section of code you are looking at, XTRA_STATS_RATE, handles how status effect may play with the new Stat. Like if the VENOM state makes your stat reduce by 20% or so. I'm using it for 'fatigue' in my own action game. EDIT: Oh the bars thing. Remember that the script suggests both a 'Char' and a 'Const' stat? It's defined like: Code: def char RE: Adding more stats that behave like SP - Bennerdeben - 07-19-2020 (07-17-2020, 09:22 PM)DerVVulfman Wrote: Just like any of the RMXP stats, Strength, Intelligence, Raw Good Looks, they all have a fully minimum stat of 0 and a full blown max of 999 regardless of level. Thanks for your reaction. In fact I could use the second stat too because I'm thinking of a "Morale" stat. I have been trying to tweak with the min and max stats combined with the bar im using. But every time it gives me an error like 'undefined method []' for nil:NilClass' (might have to do a roll back since I've been messing around with it a lot). So far I do understand how the arrays work. Although I do not know if I can define a minimum and a maximum amount with the "def MP" method. Also with that mp bar It looks like it is conflicting somehow. For example, if I use the def MP method to say Code: def mp But if the hero levels, I'd want the max MP to be 25 for example. So it would look like this Code: def mp I don't think the above examples would work since the MP must be able to be unique for each character, while this method is meant for all actors right? The bar im trying to use has a hard time accesing the data from XTRA_STATS_ACTOR. I guess that is because I dont know how to do it RE: Adding more stats that behave like SP - DerVVulfman - 07-19-2020 Quote: The bar im trying to use has a hard time accesing the data from XTRA_STATS_ACTOR. I guess that is because I dont know how to do it Nonononononooo!!!! You don't link the bar to XTRA_STATS_ACTOR at all. You link it to the method defined for that stat. You have an mp stat designated above, so just consider this!!! Using a bar script called 'draw_bar' as an example. draw_bar(actor.hp, actor.maxhp, bar_x_pos, bar_y_pos, bar_length, 8, hp_bar_color) draw_bar(actor.mp, 999, bar_x_pos, bar_y_pos+20, bar_length, 8, mp_bar_color) At the time, I only assumed a static '999' maximum for character stats, not something akin to HP or SP. WORKING now.... RE: Adding more stats that behave like SP - kyonides - 07-19-2020 You'd need to replace that 20 or 25 with a variable or method call that processes the actual value for such a level. You can create an array full of this values for every single level and then search for its index via using the @level variable as its actual position inside that array. RE: Adding more stats that behave like SP - Bennerdeben - 07-20-2020 Alright. I will try to edit it like you guys are showing me (when I have some time for it). When I know more I'll let you know! RE: Adding more stats that behave like SP - DerVVulfman - 07-21-2020 Well, I did say WORKING, right? And that's what I did ....... ((( > HERE < ))) I updated Kitsune with a new TYPE of Stat, what I call an 'action' stat, one designed in the same manner as the HP and SP stats and for much the same reason. The new script has a 'draw_actor_fatigue' method which is similar to the draw_actor_hp. With that, creating a bar for such a stat should be no problem, And you can see its use within the demo script's altered Window_Status script. Meanwhile, I severely FIXED THE DANG STAT PROGRESSION system. It was recycled from another script, however I used the wrong method... one that made an experience points bell curve that made stat values increase exponentially instead of a flat grade as they should have. No one mentioned this in nearly a decade of its release? RE: Adding more stats that behave like SP - Bennerdeben - 07-21-2020 (07-21-2020, 03:53 AM)DerVVulfman Wrote: Well, I did say WORKING, right? And that's what I did ....... ((( > HERE < ))) This looks very promising man! Can't wait to try it out :thumbs up: RE: Adding more stats that behave like SP - Bennerdeben - 07-24-2020 Got it working! Thanks for the help |