And if so, is there a plugin or a script code to achieve it? Thanks in advance!
MZ Is there a way to force a character to cast a spell out of battle?
Javascript/Plugin Supporti don't THINK so, but it wouldn't be hard to event an equivalent. choose the character, play the animation on the event location you want it at, subtract some MP.
Force action in event page?
Without leveraging an ABS, it is less-than-ideal as far as forced action execution is concerned to perform forced actions on the map.
However, the gist of it is something like this:
JavaScript:
// reference to the battler you want to perform the skill to be executed.
const casterBattler = $gameParty.leader();
// generate an action to apply.
const gameAction = new Game_Action(casterBattler, false);
// the id of the skill to be executed.
const skillId = 1;
// assign the skill to the action.
gameAction.setSkill(skillId);
// or
// the skill reference of the skill to be executed.
// const skill = $dataSkills[1];
// gameAction.setItemObject(skill);
// reference to the battler you want to execute the skill against.
const targetBattler = $gameParty.leader();
// apply the action against the target.
gameAction.apply(targetBattler);
I wouldn't really recommend this if possible, though. In most cases, if not in-battle, you can probably achieve your goal through alternative means more explicitly.
I haven't tried it yet but it's a skill that targets the user, if that makes a difference.
The easiest way would be to event the effects of the skill/item.
Otherwise, for a generally-applicable approach, this thread (for RMMV) may help:
forums.rpgmakerweb.com
I haven't tested, but I'm guessing the solution there will also work for MZ.
Otherwise, for a generally-applicable approach, this thread (for RMMV) may help:
How to use a item in eventing?
Hi, I can't figure out how to use a item in the eventing window. I want this to happen on a main map on player touch Hero consume item 1 .. must i 'change items' and make a eventing of the items effect and restore?
forums.rpgmakerweb.com
Hard to event it as it uses Visustella's plugin skill limited use.
Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-force-a-character-to-cast-a-spell-out-of-battle.147070/