Channeled Magic

Hello, fellow RPG Makers!


I am working on a game where one of the main characters is a sorcerer, and I would like to have some - if not - most of the character's spells be channeled. In battle, his skiils would work along these lines:

  • Character selects the spell to cast and its target.
  • Instantly after confirming the target, the character enters a "channeling state". This lasts for 3-5 turns, depending on the spell.
  • While the character is in the channeling state, they don't respond to commands. Instead, they automatically cast a spell on the defined target during their turn.
  • If the character takes damage while channeling, there is a chance that their casting is interrupted, thus removing the channeling state.
  • If the character succeeds to finish the channeling, they cast a more powerful "cash-out" spell in the end.
  • After the channeling ends, the character returns to normal/previous state and is controllable once again.



Basically, the channeled spells would mechanics-wise be somewhat similar to e.g. Arcane Missiles and Tranquility in World of Warcraft, though without the ability to cancel the channeling by yourself and with the added cash-out spell in order to make the system feel a bit more lucrative.
This system would probably mean that each skill takes two slots in the database (one slot for the channel and another for the cash-out) and that the database has to include at least one state for the channeling.


Ideally the plugin would have these features:

  • A way to mark the skills which should be channeled (for instance, inserting the tag <Channeled Skill> to the skill notes)
  • A way to denote cash-out skills, which wouldn't be normally available to the character but would be force-cast when the channeling ends.
  • A way to determine the duration of the channeling, either individually for each skill or on the general level in the plugin controls.
  • Possibility to make the character maintain channeling motion for the whole duration of the channeling state.
  • Compatibility with active battle time system (I am currently using Yanfly's ATB plugin in my project).



I initially tried to create channeled spells with the help of several Yanfly plugins (Battle Engine Core, Action Sequence Pack 1, Buff & States Core), but the code got quite quickly fairly complex and confusing and I could never quite get it work the way I wanted (or, most of the time, not work at all). Does this kind of system sound like it's feasible to create as a plugin?


//After a moment of pondering, I realised that it could be useful to upload a video of my failed attempts as well (apologies for the poor video quality, though). The first attempt doesn't work as I wanted because the buff counter decreases with ticks instead of character turns, causing it to end awkwardly. I also would probably like the initial cast only start the channeling and not do any damage. The second attempt succeeds in this, but then the channeled spell is no longer instant, and in the end, something breaks the whole game.
I think I got close to what you wanted just using those plugins you mentioned.


I created a skill with the following:


<Before Eval>


$gameVariables.setValue(10, $gameTroop.members().indexOf(target));


</Before Eval>


<target action>


add state 131: user


</target action>


This sets the target to Variable 10 (change if you want) and inflicts my actor with state 131 (my state for the channeling skill).


In state 131 I put this:


<Turn Start: 5>


<Custom Turn End Effect>


target.forceAction(107,$gameVariables.value(10));


</Custom Turn End Effect>


<Custom Leave Effect>


target.forceAction(101,$gameVariables.value(10));


</Custom Leave Effect>


With this the actor casts skill 107 (thunder in my game) once per turn and when the state is over she casts skill 101 on the target (fire in my game). If the enemy dies while the actor is channeling she automatically targets the next enemy.


Maybe tomorrow I implement the "lose status by random chance when attacked". Hope this helps.
To remove the state if damaged, just go to the state check the box 'Remove by Damage' and the rate. No need fot a custom setup or anything.
@Victor Sant


Thanks Victor. Sometimes I forget about the default rpg maker mechanics and overcomplicate stuff.
Thank you for the quick replies and the advice. I know very little about JavaScript, so I had tried guessing and deducing from what bits I could find in other plugins. This time, it didn't work so well, heh.


Now I just need to find out whether it's possible to force the actor stay in chanting motion for the duration of the state, but I'm already happy with the help I got.


//Seems like I can't get the  <Before Eval> part to work. I initially thought that the code worked like a charm since I was testing it against a single enemy, but when I tried it against multiple enemies, the spell is always cast on the first enemy regardless of which one I target. I tried starting a new project and copy-pasting the code there, but the result was still the same... Otherwise everything works just fine.
Hummm, I don't know why but the <Before Eval> notetag doesn't work. Maybe because the skill don't do any damage? I don't know. I did manage to make it work by putting the eval part in the <target action>


<target action>


eval: var u = $gameTroop.members().indexOf(target); $gameVariables.setValue(10, u);


add state 131: user


</target action>


See if this works for you. Worked for me. After that the only thing left is the chanting part.


One way to do it is creating another sideview charset and edit it with the chanting motion in the standby and status effects places. Then you can use Victor's State Graphics Plugin to change the image of the actor when it has the channeling state. If you find an easier way, please let me know 😀
Now it seems to work pretty much perfectly. I'll have to take a look at that plugin, too, as it sounds like something I could greatly benefit from. Thanks again for your help. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/channeled-magic.55471/