Hurricane

Today’s state is also a bit on the simple side, but it opens the developer up to all kinds of extra things. I present to you Hurricane.

What does it do?

When this state is active, all enemies take damage at the end of the caster’s turn. While this example state is designed to only be usable by an actor, so it will only deal damage to enemies, it is possible to modify it quite easily to make enemies capable of using it as well. The state is applied to the caster, by using a skill. At the end of each of the caster’s turns (including the one he used to apply the state), a storm causes damage to all enemies. I also included an extra effect, that with a 60% chance, a bolt of lightning will also strike a random alive enemy after the wind effect.

What do I need?

For this effect, we only need a couple of animations, a skill, and the usual plugins. The meat of what we’re doing is on the custom state, with the actual skill being just a vessel being used to apply the state to the caster.

Hurricane skillAbove, you can see our skill. It is important that it targets the user, and doesn’t do damage itself. Our action sequence is a little different:

 

<setup action>
eval: user.turns = 0
//This eval is used later to insure the hurricane effect only goes off once per turn
display action
camera focus: user
zoom: 250%, 30
wait: 30
motion chant: user
cast animation: user
animation wait: 12
motion spell: user
wait: 15
</setup action>
<Target Action>
clear battle log
eval: SceneManager._scene._logWindow._lines.push('A storm is brewing...' + '<CENTER>');
eval: SceneManager._scene._logWindow.refresh();
//These two eval codes cause the battle log to show text for the skill.
wait: 60
motion item: user
action effect: user
wait: 60
reset zoom
wait: 30
</Target Action>
<Finish Action>
reset camera
reset zoom
clear battle log
</Finish Action>

The skill itself doesn’t use an animation, and the sequence is brief, showing only some text and slight motion to the character using it.

Next we have our state. This is applied to the actor who casts the above skill on himself. This state is removed after combat, but I did not include a ‘remove after x turns’. This was because I didn’t want the turn counter to show on the state, so the user didn’t know how many turns it would last. The code allows between 4 and 6 turns of storming before being removed. Hurricanestate

And here is the copy paste code for this state:

 

<Custom Apply Effect>
target.hurricaneDmg = 200 + (target.mat * 4)
//The base damage for the effect
target.hurricaneTurns = Math.floor((Math.random() * 4) +3)
//The length of time the effect will last
</Custom Apply Effect>
<Custom Turn Start Effect>
user.turns = 0
//We're using user.turns to make sure the hurricane effect doesn't happen more than once per turn
//This is in case some sort of effect gives him two actions in a turn
</Custom Turn Start Effect>
<Custom Turn End Effect>
if (user.turns == 0) {
 var extraFramesToWaitFor = 15;
 var ele = 7 //The element for the wind effect
 var animFrames = ($dataAnimations[94].frames.length * 4) + 1 + extraFramesToWaitFor;
 var waitSeconds = (animFrames/60) * 1000;
 $gameScreen.startTint([-120,-120,-120,60], 20);
 $gameTroop.members()[0].startAnimation(94, false, 0);
 if ((Math.random()*100) > 60){
  var strike = true
//A strike has happened
  var extra = 120
//This extra value is used to add to the end of the timeout to make the damage show properly
 }else{
//No strike has occurred.
  var strike = false
  var extra = 0
 }
 //The setTimeout function below is used to make the damage popup after the animation finishes
 //This makes the code look confusing, but should be fine as long as you copy-paste it
 setTimeout(function () {
 for (i = 0; i < $gameTroop.members().length; i++) {
 //This for loop is finding valid enemy targets for the hurricane damage
  if (!$gameTroop.members()[i].isDead()){
 //For each alive enemy found, deal hurricane damage.
   var total = Math.floor((user.hurricaneDmg * ((Math.random()*40+80)/100)) * $gameTroop.members()[i].elementRate(ele))
   $gameTroop.members()[i].gainHp(-total);
   $gameTroop.members()[i].startDamagePopup();
   $gameTroop.members()[i].performDamage();
   if ($gameTroop.members()[i].isDead()) {
    $gameTroop.members()[i].performCollapse();
   }
   BattleManager.checkBattleEnd();
   }
  }
 var target = false
if (strike == true) {
 while (target == false) {
  var rnd = Math.floor(Math.random() * $gameTroop.members().length)
  var enemy = $gameTroop.members()
  if (!enemy[rnd].isDead()){
  //find a random alive enemy to hit with lightning
   enemy[rnd].startAnimation(172, false, 0);
   target = true
  }
  if ($gameTroop.isAllDead()) {
   target = true
  }
 }
 setTimeout(function () {
  if (!enemy[rnd].isDead()){
  //Deal damage to enemy struck by lightning
   var total2 = Math.floor((user.hurricaneDmg * ((Math.random()*40+80)/100)) * enemy[rnd].elementRate(4))
   enemy[rnd].gainHp(-total2);
   enemy[rnd].startDamagePopup();
   enemy[rnd].performDamage();
   if (enemy[rnd].isDead()) {
    enemy[rnd].performCollapse();
   }
   BattleManager.checkBattleEnd();
  }
  $gameScreen.startTint([0,0,0,0], 30);
  setTimeout(function () {
   for (i = 0; i < $gameTroop.members().length; i++){
    $gameTroop.members()[i].performActionEnd()
   }
  }, 180);
 }, 1200);
}
if (!strike){
 $gameScreen.startTint([0,0,0,0], 30);
 setTimeout(function () {
 for (i = 0; i < $gameTroop.members().length; i++){
  $gameTroop.members()[i].performActionEnd()
 }
 }, 180);
}
}, waitSeconds);
BattleManager._logWindow._waitCount += (animFrames + extra + 30);
user.turns = 1
//This is used to insure the effect doesn't happen more than once per turn
user.hurricaneTurns = user.hurricaneTurns -1
//lower the turn counter for the state
}
if (user.hurricaneTurns == 0) {
//remove the state if the turn counter is 0
 user.removeState(195)
}
</Custom Turn End Effect>
<Custom Remove Effect>
//If the state is removed at battle-end, remove the turn value
user.hurricaneTurns = undefined
</Custom Remove Effect>

Also, remember that you will need to change the animation numbers and the stateId for this to work in your project.

 

While this effect itself is pretty neat, you can use the framework for this state effect to make states that cause animations before showing the damage. The best part about this implementation is that states made in this way can show a full animation, as if a skill had been used, without forcing an action on the user, which can mess with turn order in a CTB or ATB system.

How does it look?

Check it Out!

That’s all for this update folks.

-Ramza

MP Absorb

This week I have a much more simple state to share, to make up for last week’s being convoluted and confusing. MP Absorb.

What does it do?

MP Absorb is a simple passive ability that is used by wizards in my project. When hit by a single target magical effect, the actor regenerates MP equal to the cost of that attack. This also works with single-target healing spells! As wizards are quite reliant on having lots of MP at all times, this effect is good for helping them maintain a higher amount of MP at all times.

What do I need?

Just the usual plugins. I recommend making this state a passive effect, but even that isn’t necessary.

The Code:

<Custom Respond Effect>
if (this.isHpEffect() && this.isMagical()) {
  var scope = $dataSkills[a._actions[0]._item._itemId].scope
  if (scope != 2 && scope != 8) {
      var cost = $dataSkills[a._actions[0]._item._itemId].mpCost
    if (b.hp != 0){
     b.gainMp(cost)
    }
  }
}
</Custom Respond Effect>

That’s all for this update folks.

~Ramza

Perform

Welcome back. Today I’m going to share a much more advanced state with you all, which requires a lot of description to fully get across what the state is intended to do.

First of all, in order to use this state to its fullest potential, you will need all of the usual plugins, as well as the action sequence plugins, and additionally the Weapon Unleash Plugin. The instant cast plugin is also recommended, though not necessary. I also made use of Yanfly’s Weapon Animation plugin to animate the play skill with a custom weapon graphic.

So first, what is Perform? Perform is an action used by the bard class in my project. When it is the bard’s turn, s/he can choose a song to play from his/her available skills. Choosing the song is an instant cast skill, that replaces the actors attack action with ‘Play’. If the actor doesn’t immediately play the song after choosing it (and does a different action), nothing happens, and the effect is removed. If the actor plays the song after choosing it, the song adds a special buff to all of the actors allies (but not the actor that is performing the skill). On any subsequent turns, an upkeep cost is charged to the bard, if s/he can’t afford this cost, the state is removed, as well as the buff that it gave to the other allies. If the actor continues to play the song on each subsequent action, the buff will remain active, but if they do a different action, the state will run out of turns and remove itself.

As a bonus add-on for this state, I will also include the ‘Lingering Song’ trait, which causes the song state to last one extra turn, allowing the actor to alternate between performing and doing a different action.

What we need for this Effect:

  • A skill for each song.
  • A skill for ‘Playing’ the song.
  • A skill for canceling the song that is being played.
  • A placeholder state for the play skill.
  • A state to change the actor’s weapon graphic to play the song
  • Two states for each song, one for the skill to apply, and one for the effect to each ally.
  • Optional: Yet another state that is provided as a passive effect by an item required to play the song (ex: equipping a harp gives you this state)
  • Bonus an extra state for lingering song effect.

First things first, let’s make our ‘Play’ attack skill.

Play
Play Skill screen

The state that this skill applies is going to be our placeholder state. The action sequence animates the playing of the song. For this sequence, I made a harp weapon sheet, and used a custom state to change the actor’s weapon sprite and motion to match the harp weaponsheet.

<Attack Text: Play>
<Setup Action>
display action
camera focus: user
zoom: 200%, 30
wait: 30
</Setup Action>
<Target Action>
add state 107: user
wait: 10
motion attack: user
ME: Harp1
wait: 15
motion attack: user
wait: 20
motion attack: user
wait: 20
motion attack: user
wait: 30
action effect: user
motion attack: user
wait: 35
remove state 107: user
if user.isStateAffected(168)
 eval: user.addState(168)
end
</Target Action>
<Finish Action>
clear battle log
reset camera
reset zoom
wait: 20
perform finish
</Finish Action>

The action sequence applies state 107, which will be pasted below, whose purpose is to change the weaponsprite and weapon motion of the actor using the skill temporarily to allow the ‘harp’ weapon to be used. After the little animation plays, the state is removed. The sequence then checks for state 168, which is going to be our song state. When it detects state 168, it re-adds the state, which adds one turn to its duration. This is important to the mechanic, as adding a turn to the state is what keeps the song going, and also, the re-application of the song state is what causes the song effect state to trigger.

Here is the paste-code for state 107: Harp Animation (requires weapon animation plugin mentioned above):

<Weapon Image: 30>
<Weapon Motion: missile>

Note that weapon image 30 is the index of my harp weaponsheet, change as needed for your own project.

Weapons3

Note that this harp was pulled from the RMVXAce Iconset, so you legally need to own a copy of RMVXAce to use it.

The placeholder state we add during the Play skill is actually used to apply the lingering song effect, I will cover that in the bonus section below.

Next, we will make our song skill.

ariaofmight

As you can see, this skill applies our ‘song state’. I have a custom show eval in the note tags to make this skill disappear when we are already affected by it, or any other song state (although in this tutorial I’m only sharing the one song). This is an instant cast skill, and the action sequence is basically empty, to ensure the player can quickly select a song without breaking the action too much. The actual song state is what handles most of the work here.

<Custom Show Eval>
if (user.isStateAffected(168)) {
 visible = false;
} else {
 visible = true;
}
</Custom Show Eval>
<Custom Requirement>
if (user.isStateAffected(171)){
 value = true
}else{
 value = false
}
</Custom Requirement>
/* The above custom requirement will prevent the actor from using this
*  skill unless they are affected by state 171. This state is used to
*  prove that the hero is equipped with an instrument. In my project
*  the bard must have a harp equipped to play a song. All harps bestow
*  this state when equipped. You do not need this code for the effect 
*  to work.
*/
<Setup Action>
display action
</Setup Action>
<Target Action>
wait: 10
action effect: user
wait for popups
</Target Action>
<Finish Action>
clear battle log
</Finish Action>

And here is the ‘Use’ state:

ariaofmightstate

It is important that this state end after one turn, otherwise it will not require the actor to immediately ‘play’ to keep the effect going.

<Replace Attack: 192> //This is the skill Id of your play skill made above
<Reapply Add Turns>  //If the affect is re-applied, it's duration increases
<Custom Turn Start Effect>
//This section performs MP upkeep of the song
if (user.mp < 6){
//If the cost cannot be paid, the state is removed
 user.removeState(168)
}else{
 user.gainMp(-6)
}
</Custom Turn Start Effect>
<Custom Apply Effect>
//This checks if the user already had the 'use' effect when it was applied
if (user.isStateAffected(167)){ 
//This is the state Id of the state added by the 'play' skill
//If the state detects it was applied by the play skill, it applies the effect state
 var targ = user.friendsUnit().aliveMembers()
 for (var i = 0; i < targ.length; i++) {
//Since the play skill was used, this adds the effect state to all allies
 user.friendsUnit().aliveMembers()[i].addState(169)
 }
 user.removeState(169)
//It then removes the state from the user, because it doesn't affect them
}
</Custom Apply Effect>
<Custom Remove Effect>
//If the state is removed, it also removes the effect state from all allies
var targ = $gameParty.members()
for (var i = 0; i < targ.length; i++) {
 $gameActors._data[targ[i].actorId()].removeState(169)
}
</Custom Remove Effect>

Next we have the actual state effect. This state is mostly blank, and only contains an attack parameter boost for the target affected. The state doesn’t expire on it’s own, because it is removed when the actor who applied it stops performing.

mightariaeffectstate

It is important that the state is removed at battle end, however, as it might stay up forever if the battle ended while it was active.

Since this is a really confusing state setup, I will do a brief recap before getting to the bonus section.

  • Actor uses our aria of might skill
    • Gains Might Aria use State
    • replaces default attack with ‘play’
  • Actor uses play skill
    • Use state is re-applied, making it last 2 turns instead of one.
    • On re-application Might Aria Effect state is applied to all allies.
    • Actor’s turn ends, reducing the Use state’s duration to 1 turn.
  • If actor chooses not to use Play skill
    • Use state expires naturally, which removes the effect state from all allies.

We also have yet another skill to make. This one stops the current use state from being active, in case the player chose the wrong song, or wanted to cancel the effect prematurely to attack. In my project, because I have the state set up to charge an upkeep cost at the beginning of the actor’s turn, the remove skill also refunds some MP to the user. This skill is only visible if the actor has a songs use state on them.

stopperformskill

Note that the skill simply removes the use state of all songs (I have a few more than might in this screenshot.) The MP recover effect is designed to restore part of the Mp cost of the song. In this example, my custom MP Cost formula is being used. For normal use, you would put a number in the box, like 6 (the cost of Aria of Might).

<EQS Ignore>
<Instant Cast>
<Custom Show Eval>
if (user.isStateAffected(168)) {
 visible = true;
} else {
 visible = false;
}
</Custom Show Eval>
<Setup Action>
display action
</Setup Action>
<Target Action>
wait: 10
action effect: user
wait for popups
</Target Action>
<Finish Action>
clear battle log
</Finish Action>

Bonus:

I promised an extra passive state to increase the duration of the song. We already have the building blocks in place for this state. We’re just going to cause the Use state to be added twice, which will make it last three turns instead of two turns.

First, we’re going to come back to our placeholder state, 167. This state is basically invisible to the player and only lasts one turn. It’s main purpose is for the song use state to check to see if it has been re-applied by the ‘play’ skill, and then add the song effect state to all allies. We’re also going to use it to check for our passive lingering song state, and then re-apply the use state of the song you’re using again. It is applied to the user whenever he uses the ‘Play’ skill.

continueperformstate

<Custom Apply Effect>
if (user.isStateAffected(170) && user.isStateAffected(168)){
// State 170 is our lingering song state
 user.addState(168)
//Re-apply Might Aria Use state if lingering song is detected
}
</Custom Apply Effect>

Because of the way we coded the Might Aria Use state earlier, re-applying it will add another turn to it.

There’s actually nothing special about our lingering song state at all, it’s a passive state, applied by equipment, or as a trait on your actor, or through skill learning if you use that. In this case, I’ve used state 170 for it, but it doesn’t do anything at all on it’s own, and is simply used to determine whether or not to re-apply a song use state a second time or not.

So, in conclusion:

  • Actor picks Might Aria from Skill menu
    • Immediately given one stack of the use song state.
    • Attack becomes ‘Play’
    • Instant cast – actor gets another turn immediately after
    • The song is hidden from the skill menu, preventing the actor from using it multiple times in the same turn
    • The stop performance skill becomes visible in the skill menu, allowing the actor to stop the song and choose another skill, or attack.
  • Actor uses ‘Play’ Skill.
    • Actor has the might aria use state re-applied, increasing duration to 2 turns
      • if actor has lingering song, it is re-applied again, for three turns total
    • When the second stack is applied the Might Aria Effect state is given to all allies
    • The effect state is then removed from the bard, as he cannot be affected by his own song
  • If the Use state runs out of duration, the effect state is removed from everyone
  • Lingering Song allows an extra turn, which lets the actor alternate between using Play and using a different skill
  • The stop performance skill can be used when a performance is happening to cancel it, and refund some or all of the MP cost of the song, allowing the actor access to his attack skill again

But how does it look?

See for yourself

Bleed Effects

Welcome back. Before I get started today, I just want to draw a little attention to a couple of links around the internet. First, there’s a link on the side bar, for my patreon page. If you like what I do, feel free to check that out, and see what else I could be doing for you (and everyone else). Secondly, I have a topic up on the rpgmakerweb forums  where I’m taking requests for custom states people want to see. I’ve already made a couple (stacking parameter buff, and Break/Topple/Daze), which you can find on that page. If you’re looking for ideas, or want some help with your own states, feel free to drop on in there and say hi.

 

Alright, so this week’s state is going to be a simpler one, bleed. In most rpgs, damaging states like poison inflict damage based on the stats of the actor that applied it. In RMMV, however, damaging states exclusively deal a percentage of the afflicted target’s HP. This presents a major balancing issue, namely, boss fights. In this scenario, a boss is susceptible to a poison status effect, but because poison does 10% of its health every turn, this boss fight won’t last more than ten turns if he’s inflicted with it. If you lower the damage of the state, the state becomes useless against normal monsters, as a lower number would lower the damage to the point where attacking is better.  The solution, is damaging states that deal damage based on the parameters of the attacker, like a normal skill, but every turn. The first of these states I created was actually poison, but that’s no fun, so bleed will be my share today.

Bleed causes damage over time to the afflicted target. When hit with a bleed effect, the total amount of damage the bleed effect will do is set by the skill that applied it. At the end of each turn the target takes afterward, he will take 1/3 of that damage. If the bleed effect is applied again, the total values are compared, and if the new effect would cause less total damage than the remaining effect of the current bleed, it will not be applied. After three turns, the bleed will have fully run its course.

Example:

Rend is a strong melee attack that adds 100% of damage done as a bleed effect.

Axe Mastery causes a small 1/3 of damage dealt bleed effect to physical attacks when an axe is equipped.

Harold performs a normal attack on Bat A, with an axe. He deals 180 damage. The bat’s bleed value is set to 60. When the bat next attacks, it takes 20 points of bleed damage after its turn, lowering the bleed total to 40. The next round, Harold uses rend, and deals 360 damage. This bleed value is higher than the one currently on the bat (40 v 360), so it overwrites the old bleed, and resets the turns to 3. The bat then takes 120 damage on it’s next turn. Harold attacks again, causing 180 damage. The new bleed effect is only 60, to the remaining 240 of the previous bleed, so it is ignored. The bat goes again and takes another 120 damage.

What You Need:

What to Do:

  • First thing we need is a state. Give it whatever icon you wish, there is nothing fancy in any of it’s default parameters. The meat of the state is coming from the note tags, as usual.
  • Some set up is required on the skill that will apply the bleed effect. I will cover that code first, below.

The Skill:

For our rend skill, we need to use the action sequence plugins to run some custom code when the attack is used. We’re using these to apply the bleed damage and number of turns to the enemy that is attacked. Text in red needs to be modified to meet your project.

<Setup Action>
display action
camera focus: user
zoom: 200%
wait for camera
cast animation: user
wait for animation
</Setup Action>
<Target Action>
wait: 20
motion attack: user
wait: 10
camera focus: target, 5
wait for camera
action animation: target
wait for animation
action effect: target
if (target.bleedValue == undefined || target.result().hpDamage > target.bleedDamage)
 eval: target.bleedValue = (target.result().hpDamage)
 eval: target.bleedTurns = 3
 add state 191: target
end
wait: 20
</Target Action>
<Finish Action>
clear battle log
reset zoom
reset camera
perform finish
wait: 10
</Finish Action>

Please note that the state applied in the action sequence above must have its ID changed to match your project.

In the actual state, we make use of those two parameters we create using the eval tags, to determine the bleed damage, and the length of the bleed effect. Those values can be modified to better fit your project,  if needed as well.The if statement in the action sequence is used to determine if the rend effect is applying a bleed that is stronger than any existing bleed effect already on the target. If it detects a bleed effect with a larger total than the one being applied, it doesn’t apply the state, or change the total.

 

State:

The state itself is pretty straightforward. Every turn, damage is dealt to the afflicted battler equal to 1/3 of the bleedValue parameter on that target. When the bleed turns hit zero, the state is removed. The apply effect has an extra check to make sure that a bleed effect that was applied by a skill that did zero damage is immediately removed.

<Custom Apply Effect>
if (target.bleedTurns == 0 || target.bleedValue == 0) {
 target.removeState(191)
 target.bleedValue = undefined
 target.bleedTurns = undefined
}
</Custom Apply Effect>
<Custom Turn End Effect>
var currentdmg = Math.floor(this.bleedValue / this.bleedTurns)
this.gainHp(-currentdmg)
this.startDamagePopup();
this.bleedValue = this.bleedValue - currentdmg
this.bleedTurns = this.bleedTurns -1
if (this.bleedTurns == 0 || this.bleedValue == 0) {
 this.removeState(191)
 this.bleedValue = undefined
 this.bleedTurns = undefined
}
if (this.isDead()){
 this.performCollapse();
}
</Custom Turn End Effect>

If the state detects that the battler is dead, it calls the collapse function, which kills it, and finishes the battle if this is the only enemy still alive.

 

Bonus State:

I will also provide a passive state, which can be used to apply bleeds to physical attacks. In my project, Axe Mastery provides a small bleed effect when using a physical skill while an axe is equipped. I have removed the axe requirement for this copy+paste to make it more accessible to everyone else.

<Custom Establish Effect>
if (this.isHpEffect() && this.isPhysical()) {
 target.addState(191)
 var bleed = Math.floor(value/3)
 if (target.bleedValue == 0 || target.bleedValue == undefined) {
  target.bleedValue = bleed
  target.bleedTurns = 3
 }else if (bleed > target.bleedValue) {
  target.bleedValue = bleed
  target.bleedTurns = 3
 }
}
</Custom Establish Effect>

The custom establish effect is only played if the attacker lands his attack, it then checks if the attack was a physical HP affecting attack, and proceeds to add the bleed effect. If there is already a stronger bleed effect present on the target, it is compared with the new one, and replaced if it is weaker.

That’s all for this update. see you next time.

Block Chance

Greetings.

For my first state copy paste, I figured I’d go for one of the first custom states I’d made, Block Chance. In my project, a hero who has a shield equipped has a chance to block when taking physical damage. This chance is different depending on what type of shield the actor has, with a buckler being the least effective, at a 1% chance, and a heavy shield offering a 15% chance to block.

When a block occurs, an animation is shown on the actor, and he takes no damage from the attack. This animation can also be different based on the type of shield, or, if you’re willing to put in some effort, the individual shield equipped can show different animations as well.

What do you need to set this up?

Setup Steps:

  • Create an animation to show on an actor that has blocked. I used a shield image from the RMVXA iconset, of which there are a large number of shield icons. You can do the same if you also own a copy of RMVXA.
  • Create a passive state for the block chance trait. We will go over what needs to be in the state’s note box shortly. For now, since this is passive, we won’t need an icon, or removal conditions. Make sure that all shields that can block in your project bestow this state passively using the below note tag note that text in red will need to have its value changed to work in your project):
    <Passive State: 37>  // where 37 is your state ID for the block state
  • As a bonus add-on we will include two ways to increase your actors block chance as well, I will explain them in the section near the end, so don’t panic when I don’t go over everything in the note tag right away.

The Code

This is the copy-paste text that needs to go in your note box for the block chance state.

<Custom React Effect>  
//this section occurs when the afflicted target is hit by an attack
if (value > 0 && this.isHpEffect() && this.isPhysical()) {
  // checking if this was a valid physical attack to block
  var rnd = (Math.floor(Math.random() * 99 + 1)) // random value from 1-100
  var imp = target.isStateAffected(36);          // see bonus section
  var sng = target.isStateAffected(179);         // see bonus section
  var shd = $dataArmors[$gameActors._data[target.actorId()]._equips[1]._itemId].atypeId
  // the above variable is storing what armor type the equipped shield is
  var per = 0 // the default chance to block
  if (shd == 1)  { // if the shield is type 1 (common) it is a buckler
    per = 1  // base block chance of buckler = 1%
  }
  if (shd == 5) { // type 5 for my project is light shield
    per = 10 // base block chance of light shield is 10%
  }
  if (shd == 6) { //type 6 for my project is heavy shield
    per = 15 // base block chance of heavy shield is 15%
  }
  per = per + (imp * 10) + (sng * 30) 
  // the above line is adding bonus for block chance based on other states
  // I will cover this below in more detail.
  if (rnd < per){  
  // if the random number we generated is within the value of 'per' a block has
  // occurred
    value -= value; // makes the attack do no damage
    if (target.equips()[1].baseItemId == 7){ 
  //this if statement is checking for a specific shield to be equipped
  //it then shows the specific animation for that shield.
      target.startAnimation(165, true, 0);
   }else if (shd == 6) {
  // if you have a heavy shield, show the heavy shield animation
      target.startAnimation(131, true, 0);
   }else if (shd == 5) {
  // if you have a light shield, show the light shield animation
      target.startAnimation(163, true, 0);
   }else{
  // if you don't have either heavy or light, you must be using a buckler show that
      target.startAnimation(161, true, 0);
   }
  }
}
</Custom React Effect>

Bonus

In the above code we have two states that increase the block chance by 10% and 30% respectively. The first is labeled ‘imp’, and is short for improved block, or shield mastery. My project makes use of an ‘equip skills’ system to allow a lot of depth in customizing the actors, one such skill learned from a shield bearing class increases their base chance to block by 10%. This was simple enough to put into the state, as seen. The second state, ‘sng’, is short for song, and is an active buff that my bard characters can place on allies, which increases block chance by 30%. You can add as many of these states as you like, to increase block chance more and more, but be sure you add in some extra math to make sure the value doesn’t exceed 100%, or the block may actually fail when the value rolls over.

You can also add in some extra if…else checks to look for specific shields to set the base block to be per shield, instead of per type. If you’re familiar with javascript, you can even add these values to shields themselves, and use this react effect to simply pull the values from the item directly, instead of manually in the note tag like we’ve done here.

How does it look?

See for yourself

 

That’s all for today.

~Ramza

 

Welcome, friends

Good morning/day/night and welcome to my blog. Content is a bit sparse for right now, but let me tell you what it’s all about here.

First, I’m Ramza, or rather, that’s my internet handle. I’ve been making rpgs on the internet since around Christmas 2003. For close to the last 13 years, I’ve been almost exclusively using RPGMaker 2000 and 2003, which I’d like to think I got pretty good at using, but during this time, only ever released one game, in 2005, which by today’s standard wasn’t a very good game.

I worked for a long time on the sequel to that game, but never enough to release anything longer than a demo that was only a few hours long, and without looking it up, that was probably 8 years ago.

But now I’ve discovered RPGMaker MV, and while I haven’t transitioned my old project over to it yet, I am definitely enjoying the flexibility a lot more, and will likely do so in the future. That brings me to my next point though, what am I doing here on this site?

Well, it turns out that I’m pretty good at using a few core plugins for RMMV and making odd things with them, particularly states. I’ve made a few unique states using a couple of Yanfly’s core plugins and I’d like to share them with you all, if possible. I’ve also made a couple of simple utility plugins, mostly by reverse engineering other plugins, which may or may not be neat to have.

So here’s a list of a couple of different states I’ve made and currently have working in my current project:

  • MP Absorb: – When hit by a single-target damaging or healing spell, the actor (or enemy) with this state will recover MP equal to the cost of the spell used on them.
  • Block Chance: – When wearing a shield, the actor (or enemy) that has this state has a % chance to block. The block chance can be further augmented by other states (passives or active states). When a block occurs, an animation is played on the actor, and the damage from that attack is completely negated.
  • Enflame: – When affected by this state, the target will cause extra fire damage after any physical action is performed. This damage plays a separate animation, and does a separate damage pop-up from the original action.
  • Hurricane: – The caster casts this spell, and then at the end of every one of the casters turns, the hurricane effect happens. A wind animation is played, damaging all enemies, with a chance for one of them to be randomly struck by lightning for extra damage.
  • Bleeding: – An effect that applies a bleed will cause damage over time to the target, based on the damage of the effect that caused the bleed. This damage is spread over multiple turns, and will not be overwritten by a similar effect that would cause it to do less damage per turn.
  • Second Chance: – When the actor with this state is killed, he is revived instantly with 50% HP. This effect is complete with action sequence and animation. The effect will only happen once per battle.
  • Overcharge: – When active, the MP cost of certain spells is doubled, and the damage from those same spells is also doubled.
  • Performance: – A bard selects a song from the skills menu, which replaces his ‘attack’ command with ‘Perform’ which plays the selected song. The song gives a passive buff to all other allies in the battle, so long as the bard continues to ‘perform’ on all of his subsequent turns. If he misses a turn, the effect is removed. There is also a small MP cost per turn for upkeep, which will cancel the effect if the actor is out of MP and cannot pay that cost.

Something else I still have on the drawing board but haven’t really started working on just yet:

  • Dark Aura: – Actors with this state on them will not take immediate damage, instead all damage taken will be staggered over the following three turns. If more damage is taken, the turn counter will reset back to three turns, and the total damage to be staggered will increase.
    • Bat hits Harold for 1000 damage. Harold takes 0 damage up front.
    • Harold attacks the bat, he then takes 1/3 of the damage queue, 333 damage.
    • Bat hits Harold again, and does 600 damage. Harold takes no damage up front again, but the state it reset to three turns.
    • Harold attacks the bat again, and kills it. He takes 1/3 of 1266 damage at the end of his turn, 422.

As you can see, I like the super technical details of mechanics based RPGs, and hope to make implementing some really neat states and skills more accessible to the average developer who maybe, doesn’t have as much of an eye for mechanics as I do.

Expect an update soon with my first state copy-paste, and more info on the dependency plugins needed to achieve it. Also, if there’s anyone reading this right now, feel free to leave a comment with some suggestions of the types of special states you’d like me to try my hand at.

 

-Ramza