RPG Maker MV - Skill that becomes stronger based on how many other skills a character learns.

Maizarkos

Game Developer
Member
Joined
Jan 19, 2019
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hello, my name is Maizarkos. I am wondering if it is possible to create a skill which damage depends on how many other skills are learned. I plan to make an ability called "All-In-One" which takes the damage values of other abilities (and possibly their effects such as paralysis from Thunder) and combines them into one powerful move.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Hi @Maizarkos - I've moved your thread to the MV support section, since you accidentally posted in RPG Creator (which is a totally different engine).

There is no easy way for RPG Maker to "know" which other skills the character has learned. If you control the learning of skills rather than have it automatically learned by levels, what you might be able to get away with is to having the skill's "power" added to a Variable when that skill is learned. And then, in the All in One skill's formula, you can access the Variable's current value with v[n] where n is the variable index (e.g. v[18] to check Variable #18).

If you simply want to know how many skills the character currently knows, there may be an easier way (that can also work with automatic skill-learning-by-levels). I'm not sure what the syntax is to check the size of the character's Known Skills array, but that's what you'd be looking to include in your skill formula. Maybe someone can answer here. If you don't get an answer within several days, feel free to ask with a post on the Damage Formula Help thread, or on the Learning JavaScript board.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,523
Reaction score
1,415
First Language
English
Primarily Uses
RMMV
Hello, my name is Maizarkos. I am wondering if it is possible to create a skill which damage depends on how many other skills are learned. I plan to make an ability called "All-In-One" which takes the damage values of other abilities (and possibly their effects such as paralysis from Thunder) and combines them into one powerful move.
Try this (not tested, could work or explode horribly) in the all-in-one skill's damage formula box:

Code:
a.skills().reduce((acc, cur) => acc + (cur.damage.type === 1 ? (+eval(cur.damage.formula) || 0) : 0), 0)
Note that it:
  • Doesn't take multiple hits/uses into account, so extra hits via action sequences or repeat/x random enemies options only count the first hit
  • Doesn't take elements into account. Element is based on whatever you set up the all-in-one skill to use.
  • Only counts "HP damage" skills. Didn't bother setting it up for hp drain skills
  • Doesn't count additional effects, like states, debuffs, note tags, random action sequence effects, etc.
  • May have slight lag if the user has a lot of skills because eval sucks, but its what we have to work with so oh well.
Edit: Oh yeah, it will trigger any extra code in damage skill formula boxes, so if a skill has a.gainHp(-100); a.atk * 4 - b.def * 2, that -100 hp will also get applied to the user. Basically it's eval'ing the code in every single damage-dealing skill's formula box in sequence.

I'm not sure what the syntax is to check the size of the character's Known Skills array
Code:
a.skills().length
 

Maizarkos

Game Developer
Member
Joined
Jan 19, 2019
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
Try this (not tested, could work or explode horribly) in the all-in-one skill's damage formula box:

Code:
a.skills().reduce((acc, cur) => acc + (cur.damage.type === 1 ? (+eval(cur.damage.formula) || 0) : 0), 0)
Note that it:
  • Doesn't take multiple hits/uses into account, so extra hits via action sequences or repeat/x random enemies options only count the first hit
  • Doesn't take elements into account. Element is based on whatever you set up the all-in-one skill to use.
  • Only counts "HP damage" skills. Didn't bother setting it up for hp drain skills
  • Doesn't count additional effects, like states, debuffs, note tags, random action sequence effects, etc.
  • May have slight lag if the user has a lot of skills because eval sucks, but its what we have to work with so oh well.
Edit: Oh yeah, it will trigger any extra code in damage skill formula boxes, so if a skill has a.gainHp(-100); a.atk * 4 - b.def * 2, that -100 hp will also get applied to the user. Basically it's eval'ing the code in every single damage-dealing skill's formula box in sequence.


Code:
a.skills().length
I have entered the code into the damage formula for the All-In-One's skill box, along with having it set to HP damage. When trying it in battle, however it seems to freeze the game. I know I am missing something, which most likely involves the end zeros. I tested by changing the "?" into the number of skills which my character has (16). This caused it to not freeze, but still does no damage after placing each skill on them, even when changing it to the length. Playing with the other numbers doesn't seem to have any effect as well. If possible, could you give me an example of what the complete code should look like when taking into account of the "16" (for example) skills. I am still working on this as I am somewhat new and I am doing my best to learn as much as I possibly can with this.

Thank you for helping me.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,523
Reaction score
1,415
First Language
English
Primarily Uses
RMMV
Oh god, I'm such a moron. No, the ? should stay as it is, but the freeze is being caused by a recursive loop where the all-in-one skill is calling its own damage formula over and over and over to infinity. My bad. Try this version instead:
Code:
a.skills().reduce((acc, cur) => acc + ((cur.damage.type === 1 && cur.id !== this.item().id) ? (+eval(cur.damage.formula) || 0) : 0), 0)
This version tells it to skip itself to avoid the infinite recursion, and should be copy/pasted exactly as it appears above.

Edit: Just tested it out this time and it appears to work.
 
Last edited:

Maizarkos

Game Developer
Member
Joined
Jan 19, 2019
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
Oh god, I'm such a moron. No, the ? should stay as it is, but the freeze is being caused by a recursive loop where the all-in-one skill is calling its own damage formula over and over and over to infinity. My bad. Try this version instead:
Code:
a.skills().reduce((acc, cur) => acc + ((cur.damage.type === 1 && cur.id !== this.item().id) ? (+eval(cur.damage.formula) || 0) : 0), 0)
This version tells it to skip itself to avoid the infinite recursion, and should be copy/pasted exactly as it appears above.

Edit: Just tested it out this time and it appears to work.
Thank you very much! I tested the new code and it seems to work perfectly. It's attack power increases each time a skill is learned, just as planned. Once again, thanks for the help!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top