じ☆ve冰风 发表于 4 天前

How To: Encore Skill (Pokemon)

For those of you who've never played Pokemon before, Encore is a skill that locks the target into repeating the last skill they used, and prevents them from taking other actions.

To create this effect, we'll be using a few Yanfly Scripts
Buffs & States Core
Skill Core
Auto Passive States

Step 1 'Last Skill' Tracking state
Create a state and place the following into it's notetag
Spoiler                Code:       
//Stores The User's Last used skill. Bypasses items for use with Encore<Custom Passive Condition>if($gameParty.inBattle()){condition = true;} else {condition = false;}</Custom Passive Condition><Custom Turn Start Effect>user._LastActionId = user._LastActionId || 0;</Custom Turn Start Effect><Custom Remove Effect>user._LastActionId = 0;</Custom Remove Effect><Custom Initiate Effect>var action = user.currentAction();if (action && action.isSkill()) {actionId = action.item().id || 0;if(actionId != x) {//Set X equal to your "Keep Playing Skill" that I'll discuss later.//You can also add "|| actionId != x" within the parentheses if there are other skills you don't want to be Encored.user._LastActionId = action.item().id;}}</Custom Initiate Effect>






I also tick 'Remove at Battle End', just incase.

Add this state as a passive to all of your actors and enemies.

This state

[*]Passively Adds itself at the start of battle
[*]At the start of every action, if the action was a skill that is not exempt, sets that to the subject's Last Skill Used
[*]Removes itself outside of battle
[*]Sets itself up with a default "Last Skill Used" of 0, meaning combatants who have not taken action yet in battle won't be encored.

Step 2: Setting Up your "Encore" State
Create another state.I call mine "Keep Playing"
Create a new skill type called "Encore" and have this state add that skill type.
Create a skill called "Keep Playing".
With this state afflicted, Seal all of the user's skill types except for the Encore type.Additionally, add the "Keep Playing" Skill while the subject has this state.
Have this state also seal the "Attack, Guard, Wait, & Escape Skills"
Tick "Remove at Battle End" and
I recommend you tick auto-removal, so that actors eventually escape encore naturally

Step 3: Setting up your "Encore & "Keep Playing" skills
Add an "Encore" skill

For "Encore"
Set the target as you like.I recommend "1 enemy" for accuracy to pokemon.
Set the hit type to "Certain Hit" unless you'd prefer it to be able to miss, then use either other option.

In encore's notetag add
Spoiler                Code:       
<After Eval>if(target._LastActionId > 0){target.addState(X);//Replace "X" with the ID of your "Encore" State}</After Eval>






This skill will make sure the target's _LastActionID is greater than 0, meaning they've made some action that can be Encored during battle.

Then in your "Keep Playing Skill"
Set the scope to "The User" and the Skill type to Encore
Add this in it's notebox
Spoiler                Code:       
<After Eval>if(user.canPaySkillCost(user._LastActionId)){user.forceAction(user._LastActionId, -1);}else{user.forceAction(WAIT SKILL ID, -1);}BattleManager.forceAction(user);</After Eval><Cast Animation: 0>






This will force the user to use the Skill with the ID matching their last skill used.

Because all other actions are sealed aside from the "Keep Playing" Skill, the user will be forced to use this skill until the state is removed.

You can optionally use Hime - Actor Battle Commands to disable item use as well.


本贴来自国际rpgmaker官方论坛作者:OverlyEpux处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/how-to-encore-skill-pokemon.95533/
页: [1]
查看完整版本: How To: Encore Skill (Pokemon)