[RMMV Help!] Making a skill that targets groups..?

Status
Not open for further replies.

Mr_Von_Grimmsy

Old-School Enthusiast
Veteran
Joined
Apr 20, 2021
Messages
40
Reaction score
12
First Language
English
Primarily Uses
RMMV
Ok, so I've done a fair deal of forum-scanning, googling, and digging around... But all leads have ended up dead...

So, I'm asking here - how would one go about creating a skill that targets all of the same enemies in a troop? The easiest example I can equate this too is older games like Wizardry or Dragon Quest; for example: encountering a group of 9 Blackflies with a group of 4 Leech Lizards - my wizard could use a Katino (sleep) spell on one group at a time while the other group is unaffected, etc.

I'm assuming this could be done in some fashion by comparing the original target's enemyID to that of the remaining troop members to see if they match up, perhaps...?

I have access to all of Yanfly's plugins, so one of those could potentially solve the issue - I just need someone more experienced to steer me in the right direction!

(Sidenote: Please don't suggest RowFormations - it does something weird with how sideview weapons are displayed in my project for whatever reason; also nix AreaOfEffect as it apparently has issues with spell slot usage from FROG_Magic)

Thanks in advance to whomever can assist!
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
6,171
Reaction score
4,143
First Language
English
Primarily Uses
RMMV
This is what the Yanfly Selection/Targeting plugins handle. The targeting part is in the skill's execution, whereas the selection is what you are physically able to choose in battle.

Check those out, see if the notetags in the documentation can do what you need or you need help with a scripted one.
 

Mr_Von_Grimmsy

Old-School Enthusiast
Veteran
Joined
Apr 20, 2021
Messages
40
Reaction score
12
First Language
English
Primarily Uses
RMMV
Ok, an update: I dug around a little, and the 'Chain Lightning' Tips & Tricks seemed to be a good candidate for this sort of function:

<Custom Target Eval> // Adds the selected target to the target list. targets.push(target); // Grab the group of alive foes as candidates. var members = foes.aliveMembers(); // Remove the target from the group of candidates. members.splice(members.indexOf(target), 1); // This is the number of extra targets to select with Chain Lightning. var extraTargets = 3; // Loop the extra targets. while (extraTargets--) { // Grab a random foe from the alive foes. var member = members[Math.floor(Math.random() * members.length)]; // Check to see if the member exists. if (member) { // Add the member to the group of targets. targets.push(member); // Remove the member as a viable candidate. members.splice(members.indexOf(member), 1); } } </Custom Target Eval>

Upon testing it out as-is however, it had an unwanted interaction with FROG_Magic's spell slots - apparently it deducts one spell slot per additional enemy in the 'chain', as if the spell were cast multiple times... The same exact issue occurred with Yanfly's AreaOfEffect plugin.

So I'm guessing (key word here - I'm currently out of my depth) there needs to be some sort of computation done for selecting targets before those targets are actually designated; that or, I need to look through FROG_Magic and see how it decides to deduct spell slots... Because as far as I see, either one could be the problem. I'll continue fiddling around with it to see if I get any different results, so any additional input/illumination on the topic would certainly be appreciated!

Worst case scenario, I may just have to fall back on RowFormations and set targeting up that way. But then I'll need to figure out why the sideview weapons aren't lining up with the actors... One step forward, two steps... yeah, you know.

(and thanks for pointing me in the right direction, @ATT_Turan - I had looked at Target Core prior, but had totally overlooked Selection Control even though it was already in my plugins list. :rswt)

EDIT: Ooof, scratch RowFormations - I just double-checked it and it also deducts spell slots for every enemy a spell hits. I think it's time to take a good hard look at FROG_Magic... ~_~

EDIT2: I found absolutely nothing. But then again, I'm not even 100% sure what to look for... (though .gainSlotUsed was where I started) Here's FROG_Magic in case someone more knowledgeable feels like taking a look~

EDIT3: Last edit for now, I promise. Evidently this issue extends to even something as simple as changing the target scope to '3-4 Random Enemies' or 'All Enemies'; it seems that the way FROG_Magic deducts spell slots is certainly the issue here. Barring that little hiccup, I could just use RowFormations or AreaOfAffect and call it a day!
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
6,171
Reaction score
4,143
First Language
English
Primarily Uses
RMMV
Yeah, sounds like the FROG_Magic is deducting a slot per target of the spell, rather than at the time of you selecting the action. I would say write to the author, but he hasn't been active on here in a year and change. Could still be worth pinging him.
 

Mr_Von_Grimmsy

Old-School Enthusiast
Veteran
Joined
Apr 20, 2021
Messages
40
Reaction score
12
First Language
English
Primarily Uses
RMMV
Well, I've nailed down the specific function that deducts spell slots (and posted it below), at least; I'm sure of it, as I tested it by changing the value to add spell slots, as well as to be affected by the mp/tp cost(s) set within the database; however, the issue still persists, with additional slots being taken off per target.

Maybe if I wrote some sort of check at the beginning of that function to catch the number of targets, or something similar..? Gah, this is making my head swim. :rsad:

Outside of this (possibly) being a FROG_Magic issue - is there any potential of this being something caused by an interaction between some function(s) within the way targeting is handled in the MV core scripts..? Just curious, because if FROG_Magic is ruled out, I'll need to figure out what to dig through next.

FROG.Magic.useSkill = function (actor, skill) { if (actor.isActor() && DataManager.isSkill(skill)) { var classMagic = FROG.Magic.getClassMagic(actor, skill.stypeId); if (!classMagic) return; switch (classMagic.resource) { //Spell slots are deducted below (Mr.VG) case "Spell Slots": FROG.Magic.gainSlotUsed(actor, skill, 1); // Only remove the spell for Prepared casters, not Hybrid ones if (classMagic.casterType == "Prepared") { FROG.Magic.gainSpellPrepared(actor, skill, -1); } break; case "Magic Points": actor.gainMp(skill.mpCost * -1); break; case "Powers": FROG.Magic.gainPowerUsed(actor, skill, 1); break; } FROG.Magic.useSpellComponents(actor, skill); FROG.Magic.gainSpellXp(actor, skill); } }

EDIT: But yeah, I'll try to ping him while I continue to try and sort this out; I'd really hate to have to reconsider the magic system, because I really had my heart set on a Vancian magic set up... @Frogboy where art thou!?
 
Last edited:

Sword_of_Dusk

Ace Attorney
Veteran
Joined
Sep 13, 2015
Messages
845
Reaction score
829
First Language
English
Primarily Uses
RMMV

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
6,171
Reaction score
4,143
First Language
English
Primarily Uses
RMMV
I think this is actually a really simple fix/change.

To me, this is a mistake in FROG's plugin, as it's not how spell slots/components/etc. work in any other system. It also looks to me like it's making actors who use MP lose them more than once when you cast a skill (once in paySkillCost and again in useSkill). Lastly, it causes skills with a dual MP/TP cost to not spend the TP, which seems undesirable to me.

So this should fix all of that.

Open the plugin in a text editor, go to line 1980. Select from 1980 through 1988 and delete it. Gone.

Then go up to line 1883. Replace that whole function from 1883 through 1891 with:
Code:
Game_Actor.prototype.paySkillCost = function(skill) {
    var classMagic = FROG.Magic.getClassMagic(this, skill.stypeId);
    if (classMagic)
    {
        switch (classMagic.resource) {
            case "Spell Slots":
                FROG.Magic.gainSlotUsed(this, skill, 1);

                // Only remove the spell for Prepared casters, not Hybrid ones
                if (classMagic.casterType == "Prepared") {
                    FROG.Magic.gainSpellPrepared(this, skill, -1);
                }
                break;

            case "Magic Points":
                this._mp -= this.skillMpCost(skill);
                break;

            case "Powers":
                FROG.Magic.gainPowerUsed(this, skill, 1);
                break;

        }

        FROG.Magic.useSpellComponents(this, skill);
        FROG.Magic.gainSpellXp(this, skill);
    }
    this._tp -= this.skillTpCost(skill);
}

I have not tested this, please do so and let me know if you run into any problems.
 

Mr_Von_Grimmsy

Old-School Enthusiast
Veteran
Joined
Apr 20, 2021
Messages
40
Reaction score
12
First Language
English
Primarily Uses
RMMV
@ATT_Turan ...Would it be weird if I said I love you...?! :rswt

Because it works flawlessly! (and as an added bonus, this new function subtracts the spell cost at once, instead of round's end like the original seemed to)

Thank you very much for the assist. Mods can close this whenever, case closed! :)

EDIT: @Sword_of_Dusk I'll have to give that a look, I'm pretty sure I already have that one in my collection but haven't gone through it yet - thanks for bringing it to my attention!

EDIT2: Looking at ScopeExtend, it seems to be exactly what I need - unfortunately, it throws an error whenever I use a notetagged skill: 'PluginManagerEx is not defined'. Probably conflicting with something else on my list... I'll see if I can sniff out the problem, thanks for letting me know about it regardless! (Disregard, see below)

EDIT3: I see the issue now - ScopeExtend is for MZ. While I do have MZ, I've poured too much time into my current MV project to jump ship for one feature - I'll probably just use AreaOfEffect in the meantime unless I figure out a better alternative! (Disregard, I'm a fool.)

EDIT4: O--K! It seems as if the triacontane plugins I have were actually the MZ versions, and that a similar branch exists for MV versions of (most of) the same..! So, not only am I posting this to express that I do indeed have egg on my face, but that the ScopeExtend plugin @Sword_of_Dusk mentioned above works exactly as I had hoped it would. Again, cheers for that. Mods can close this thread whenever, all of the issues I had for making it have been solved - thanks again for the help guys! :D
 
Last edited:

Sword_of_Dusk

Ace Attorney
Veteran
Joined
Sep 13, 2015
Messages
845
Reaction score
829
First Language
English
Primarily Uses
RMMV
@Mr_Von_Grimmsy I see no egg on your face. I probably should've specified that there was an MZ and MV branch. My bad. Glad you got everything working properly.
 

Mr_Von_Grimmsy

Old-School Enthusiast
Veteran
Joined
Apr 20, 2021
Messages
40
Reaction score
12
First Language
English
Primarily Uses
RMMV
@Sword_of_Dusk Well, thanks for saying as much - but I honestly should've paid more attention to what I had previously downloaded instead of just jumping to conclusions about its efficacy~ :blush:

Thanks again for the recommendation either way, it works great!
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,840
Reaction score
5,877
First Language
english
Primarily Uses
RMMZ

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.

Latest Threads

Latest Profile Posts

working on an A/V sync system for my game! was NOT expecting the first roadblock to be accessing a variable from a public class!! Computers are so finicky sometimes :kaosigh:
For the first real time since my game's inception I found myself actually having fun playing around with my party's skills while testing out some battles! So much so, that I actually forgot what I was doing for a minute and had to force myself to move on to the next thing! :guffaw:

That's got to be a good sign considering it only has place holder animations, enemy skills, troop comps, etc. right now. Feels good!
Bex
Finally upgraded to RMMZ.
ScreenShot_11_28_2022_7_52_34.png
FINALLY, I figured out how to get the "tail" to appear IN the window and not directly below it lol. now it looks like it's part of the window and not hanging from the bottom of it.
Twitch! Stream is about to go live with some Dark Souls 2! Feel free to drop by!

Forum statistics

Threads
126,925
Messages
1,182,401
Members
166,755
Latest member
Hahah520
Top