(SOLVED) Increasing variables by amounts with reducing returns.

Status
Not open for further replies.

TheTsunaru

Veteran
Veteran
Joined
Mar 23, 2015
Messages
142
Reaction score
87
First Language
English
Primarily Uses
RMMV
So I've been working on a skill system that's akin to the original Grandia system, but I've hit a bit of a snag. In it, you unlock elements and the basic level 1 spells connected to them by trading in items called Mana Eggs. Then as you use that element, you'll gain proficiency experience, and the elements will level up at a certain point (100EXP), unlocking newer stronger spells when you reach certain levels.


I've managed to get that part done (though in a slightly convoluted way) using variables and common events placed in the spells, but I'm having trouble with properly balancing the exp you receive. Currently its set so that all spells of the element give the same amount of EXP regardless of its strength, but I want to set it up where weaker spells will give less exp based on the level of the element being used (For example, at Fire level 1, Fireball will give 10EXP, but at Fire level 10 it only gives 3EXP), thereby forcing the player to rely on their more powerful spells to train rather than just spamming the weaker, low MP spells and getting the same benefit from it.


Current setup is something like this

Fireball.png





I'd like to be able to change the first Control Variable to an Operand Script formula to something along the lines of (Base Spell EXP / v[2] + 1), with Base Spell EXP be set via notetags in the Skills tab, v[2] being the element's level, and +1 being in case it ignores decimal points and goes immediately to 0 rather than rounding up in the event that the v[2] is higher than the base exp.


I'm assuming this would require a plugin, hence why I'm posting it here rather than in the Maker Support, but if you know how to do it without a plugin I'm all ears.
 
Last edited by a moderator:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
what is triggering the common event?


if it's tied to the skill's use, and is common to your skill set, you should be better off by modifying the Game_Action or Game_Party bit that handles all the skills.


if all the skills give out xp based on their level, then create an instruction into the function that handles all the skills, rather than creating handlers for every separate skill.
 


I did something similar to your setup once, but then I started putting up so many skills that it was impossible to keep up.


I scrapped it and created a generic function, and tied it to Battler.item_apply()


maybe if you add a few lines to item_test(), and branch from there into your setup and then go back?


(You *will* need a way to check for when the case should happen.... in the default game, that's tied to the battler's level. Maybe adapt that to check for skill level instead?)
 
Last edited by a moderator:

TheTsunaru

Veteran
Veteran
Joined
Mar 23, 2015
Messages
142
Reaction score
87
First Language
English
Primarily Uses
RMMV
@gstv87The common event is being triggered by the skills, yes.


I wouldn't know where to even begin tinkering with the .json files though. I can't look at code without it jumbling up in my head until everything becomes illegible and I have to take a break :p. Even if its more time consuming and convoluted, I think the more I can get done using the database and eventing, the better off I'll be mentally.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
I wouldn't know where to even begin tinkering with the .json files though. I can't look at code without it jumbling up in my head until everything becomes illegible and I have to take a break


welcome to the world of coding. :D


Try it.


Make yourself a simple map of how the code works, and then you'll see you can make anything happen by just adding a few lines to the correct function.


A change to the top function, carries down to the lower functions, so it's always easier to modify the origin code.


Get yourself some program like notepad++ or pspad.


They support multiple languages and they'll mark instructions and key words so it's easy to find them.


Also, always, ALWAYS have the help file at hand.... it's impossible to remember every function, so always reduce your code to an arrangement of functions listed on the help file.... that way you always refer to a basic instruction; if that works, then the code should work. (mostly :p)


regarding the eventing itself.


try looking for the object skill's code, in the help files.


there should be a way to access the skill's formula. (I'm assuming that's how you gauge your skill's power.)


pull that up, evaluate it, and you should get a number.... use that number with your XP calculation.


now.... look at the check for level (If Fire Level = 2)


what happens at level 3? at level 4? 10?


how high can you get?


you're going to need as many checks as levels you have.


times, as many actors you have.


times, as many elements you have.
 
Last edited by a moderator:

TheTsunaru

Veteran
Veteran
Joined
Mar 23, 2015
Messages
142
Reaction score
87
First Language
English
Primarily Uses
RMMV
@gstv87 Well, I would only need to do the checks for whatever levels they learn the skills at. I just used the immediate Level 2 as the quickest point I could test it at. So if there's only 4 or 5 spells per element per character, that takes away a lot of that work (since we're down to 5 if statements instead of 99)


I'll see what I can do with coding it if I dont figure this out soon though.


Edit: Has been figured out, thread can be closed. Much thanks to gstv for the advice.
 
Last edited by a moderator:

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
I mean, straight off the top of my head the thing you need is a variable that holds a modifier that can be used with the +30 EXP to decrease it. So, easiest way is to take the 30 EXP and divide it by the current Fire level, and then add the result of this as the EXP gained instead.


So create new variable and call it Base Exp, set it to 30. Then do another control variable statement this time do Base Exp divide by Fire Level variable. Then on your next control variable that you already have set up instead of doing Fire EXP + 30, just do Fire EXP + Base EXP.


So if your fire level is level 1, you'll get 30 EXP. If it's level 2 you'll get 15 EXP, Level 3 will be 10 EXP etc etc.


Playing around with something like this should do as what you want.


If you really want a full on thing with EXP curves by skill and all that, you could setup notetags in the skills and then use a script call to access their meta property, assigning that to a variable you could then use it as a modifier. But that's a bit more long winded than what I described above.
 
Last edited by a moderator:

TheTsunaru

Veteran
Veteran
Joined
Mar 23, 2015
Messages
142
Reaction score
87
First Language
English
Primarily Uses
RMMV
@beenbaba I had tried setting up notetags, but have no idea how to do that outside of notetags that come with plugins, hence why I was asking for one.


What I did was set up a separate Common Event for the skill, used it to set the skill's base exp, and then called the Common Event that's in my OP, added a script to the top

var f1EXP = $gameVariables.value(4); (Base Skill EXP)


var gainEXP = $gameVariables.value(3); (Gained EXP)


var fLVL = $gameVariables.value(2); (Element Level)


gainEXP = (f1EXP / fLVL + 1);


$gameVariables.setValue(3, gainEXP);



and then change the initial Control Variable to be variable 3 (the total gained exp). Rinse and repeat for each spell, altering the base exp to make stronger spells worth more, and its done.


Its a little convoluted, but it works, so I'm going to count that as a victory.
 
Last edited by a moderator:

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
You can add notes to skills and then pick them up with a script call.


So if I got to a skill, we'll say skill 10 and put this in it's notebox


<EXPAmount:30>


So here the EXPAmount is the name and 30 is the value, separated with a :


I can then go to the events and go to control variables and in the script box write $dataSkills[10].meta.EXPAmount;


This call will then store 30 into whatever variable specified. You can do this for lots of different things. Just replace 10 with the skill ID and your good to go.


That's just a little that could help in the future, glad you got a working solution now though.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,837
Latest member
Dabi
Top