Ramza's State Workshop OPEN (current states: 26 LATEST: Overpower + Darkness Burst)

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
Hey folks, it's Monday, and that means it's time for my next state to be released.


This week, I've chosen Bleed, a state which causes damage every turn to the afflicted battler, but whose damage is based on the amount of damage the ability that applied it dealt to the target.


The default damaging state, poison, deals damage based on the max hp of the target. This creates a game balancing issue, namely that boss monsters shouldn't be able to be affected by damaging states, because they would cause a massive amount of damage to a bosses' large HP pool, making fights last much less time. On the other hand, if you balance poison so that it doesn't give a huge advantage on boss fights, by lowering the % damage of the state, it becomes next to useless against non-boss monsters.


The solution to this balance issue is states that don't deal HP% damage, but deal damage based on the parameters of the attacker. In this case, bleed deals damage to the target based on the damage dealt by the attack that applied it. Today I will share how this state is applied, and how it deals damage. Feel free to adapt it to your needs.


Bleed is an effect that deals a bleedValue to the target split over a number of turns equal to bleedTurns, by default my bleed effects last three turns, but this can also be modified as necessary. For our first usage scenario, I have created the skill 'rend', a strong physical attack that causes a bleed amount equal to the damage the skill does. With the default turn duration of three, this means the attack deals 1/3 of it's initial damage at the end of each turn the afflicted takes.


For this skill, I make use of action sequences, specifically to use an eval tag to set the bleedValue and bleedTurns parameters on the target. You will need to have all three action sequence packs to use this skill.


Create a skill in your database, set the damage and icon how you like, or like it is in my sample image:


rend.png


For our action sequence, I have the following:

Code:
<Setup Action>
display action
camera focus: user
zoom: 200%
wait for camera
cast animation: user
wait for animation
</Setup Action>
<Target Action>
if user.attackMotion() !== 'missile'
  face user: target
  move user: target, front base, 20
  face user: forward
  wait for move
end
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
</Target Action>
<Finish Action>
clear battle log
reset zoom
reset camera
perform finish
wait: 10
</Finish Action>


This is a fairly basic action sequence. The eval codes in the action section are setting up our bleed effect, which will need those values to work.

The stateId 191 is our bleed state, which we will make next. Please note that you will need to change that Id to fit your project. The skill will only apply bleed effect if it is going to do more damage than one that currently exists on the target. This is to prevent a situation where a particularly strong bleed is overwritten by a very weak one. This check is not performed on the state, but rather on the skill that applies the bleed in the first place.


Next we will make our bleed state. I have several skills in my project that add this state, but they do so in the same way, and make use of the bleedValue and bleedTurns parameters we set up in the above action sequence.


bleed.png


The state itself doesn't contain much information aside from the note box. The lunatic code will handle removing it, so we don't need a turn end effect. I left the 'Remove at Battle End' box unticked, as I wanted the effect to persist after battle, but you can change that if you'd like.


Here is the copy+paste code for the bleed state:

Code:
<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>

Our bleed effect deals 1/3 of it's total damage each turn for three turns (because we set bleedTurns to three on our rend skill). You can make more skills that add different amounts of bleed damage, and longer or shorter intervals, by changing those values on the skill.


This was a pretty basic effect, so I will also share a passive state that adds the bleed effect to all physical actions you take. In my project, this effect is limited to only those actors who are using an axe as their weapon, but I will provide the state without this requirement so it's easier to adapt to your own project.


This state is passive meaning the actor need only know it for it to be active, via the <passive state: x> tag.

Code:
<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>


When a physical attack that dealt HP damage lands, applies a bleed effect. This effect will not be applied if the target already had a stronger effect on it.



That's all for this update folks. Feel free to keep posting states you wanna see, or anything you might need help with, state wise.
 
Last edited:

Crysillion

Veteran
Veteran
Joined
Sep 25, 2014
Messages
138
Reaction score
20
Primarily Uses
I tested this out copying and pasting the code you provided. It applies the Bleed State. I changed this:


var currentdmg = Math.floor(this.bleedValue * 0.7) // how much this effect will do this turn


and also changed all states to 126 (the one I'm using for this example). The application is fine. It works. Turn 1 looks good. If I hit the enemy for 11 damage, it ticks for 7, which is pretty much 70%, so that's good.


But then turn 2 rolls around. It ticks for 2. Turn 3, it ticks for 0.


Any idea what's happening there? This is the case whether I continue to inflict damage or not.
 

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
@Crysillion I think it's because it is actually multiplied by 0.7% each turn, meaning it will actually reduce the total value each turn. If you try 1% does the value reduce each turns?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
@Crysillion The problem is that when the effect is applied, it already knows how much damage it's doing (this is applied in the action sequence). If you make it do 70% of it's total effect per turn, it's definitely going to run out of effect before it finishes three turns. This is because the bleed state subtracts the damage it has done from the total remaining every turn it deals damage.


On the first turn it removes ~70% of 11 from 11, leaving you with 4. On the second turn, it takes ~70 of that and rounds down to 2. on the third turn, what you're left with is 70% of 2, but I assume an interaction with having rounded down each time makes this less than 1, somehow,. and rounds it down to 0, causing the effect to deal no damage.


If you want to change the amount of damage the bleed effect does, change the line in the action sequence that applies the bleedValue to the target.

if (target.bleedValue == undefined || (target.result().hpDamage * 2.1) > target.bleedDamage)
eval: target.bleedValue = (target.result().hpDamage * 2.1)
eval: target.bleedTurns = 3
add state 191: target
end

The above change will make the effect 2.1 times stronger, which will increase the damage every round from 33% to 70% (roughly) of the damage of the rend attack.


After thinking about it for a while longer (read: going back to sleep for four hours), the real problem here is that you've changed how the damage formula worked in the first place. currentdmg was used to divide bleedValue by bleedTurns, to insure that it does equal damage on all three turns. What you did was remove bleedTurns, so each time it is doing a Math.floor'd 70% of the total bleedValue, and then removing that 70% from the bleedValue.


As I said above, leave that part of the state alone, and change the bleedValue when it is added to the battler, in the case of Rend, as above in this post, if you want to change the passive, it (by default) causes a bleedValue of 1/3 of the damage of the attack that applied it, so each bleed tick will deal 1/6 of the damage dealt. (attack does 180 damage, bleedValue is 60, bleed ticks for 20 per turn for three turns).
 
Last edited by a moderator:

Crysillion

Veteran
Veteran
Joined
Sep 25, 2014
Messages
138
Reaction score
20
Primarily Uses
I want the turn display to show, so I go in and set it to last 3~3 Action End's (I tried Turn End's as well). What happens is that it ends on time, but I cannot apply the bleed to that target ever again. I'm guessing that the program, then, made the state end before the bleedValue actually reached 0.


So, if I set it to 4~4, it ends when it has 1 tick left, like it goes from 2, to instantly disappearing after it ends its action/turn. With this, I CAN reapply the state without issue.


Any idea how I can resolve this so that it lasts for 3 turns, displays the counter, and can be reapplied properly?


EDIT: Forgot to say thanks for the help above. That makes a lot of sense, so the change from 0.7 to 2.1 took care of the issue. Didn't know it quite worked that way.
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
Because I was expecting the state to only be removed when it's turn counter value hit 0, I didn't add a <Custom Remove Effect> tag to it.


To get what you're going for, you can set the 'remove after' turn end to 3-3, and then add the following tags to the bleed state note box:


<Custom Remove Effect>
this.bleedValue = undefined
this.bleedTurns = undefined
</Custom Remove Effect>


This ensures that if the state leaves due to turn decay, or is cured by a restorative effect, that the bleedValue and bleedTurns values are reset, to allow reapplication.
 

Crysillion

Veteran
Veteran
Joined
Sep 25, 2014
Messages
138
Reaction score
20
Primarily Uses
Because I was expecting the state to only be removed when it's turn counter value hit 0, I didn't add a <Custom Remove Effect> tag to it.


To get what you're going for, you can set the 'remove after' turn end to 3-3, and then add the following tags to the bleed state note box:



<Custom Remove Effect>
this.bleedValue = undefined
this.bleedTurns = undefined
</Custom Remove Effect>


This ensures that if the state leaves due to turn decay, or is cured by a restorative effect, that the bleedValue and bleedTurns values are reset, to allow reapplication.



Thanks, man. Super cool how-to. I was just wondering how I could go about making Bleed different from Poison, and your timing on releasing this could not have been any better.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
Alright, it's Monday my dudes, and that means it's time for a new state.


This week, I've chosen to share, what the bard does: Perform. This state is a lot more involved than any of the other ones I've shared up to this point, so let me know if anything needs more explanation.


What does it do:


In my project, bards perform songs to buff allies. Selecting a song to play is an instant cast action, while playing the song costs the bard's turn. Every turn, the bard must continue to play the song, or the effect will expire, removing the buff effect from his allies.The bard can switch songs mid-performance, by using a hidden 'cancel performance' skill. Additionally, while performing, an upkeep cost is charged to the bard, if he runs out of MP, and cannot pay this cost, the performance is halted.


What do we need to set this up?

  • The usual plugin requirements

  • YEP_X_ActionSequence packs 1 2 and 3

  • YEP_InstantCast

  • YEP_WeaponAnimation

  • YEP_WeaponUnleash

  • A skill to select the song, one to play the song, and one to stop playing the song

  • Six states:

    A state that uses weapon animation plugin to temporarily force the actor to use an instrument as a weapon

  • A passive state that we will use to show engine that the actor has an instrument equipped.

  • Two states for the song, one state for the 'use' and one state for the 'effect'.

  • A state applied when the 'play' skill is used, so the engine knows the song has been extended.

  • Bonus: A passive state for our Lingering Song state, which will extend the duration of songs by one turn.


[*]This weaponsprite sheet (RMVXA license required):


  • Weapons3.png

Let's begin by creating our Play skill. This skill replaces the actor's default attack skill whenever they have the 'use' state from the song active.


Play.png


The state that this skill applies is our play state, for which, I have used stateId 167. Note that this Id must be changed to match your project. Here is the action sequence for this skill:

Code:
<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 //this is a music effect to play, skip if you don't have one
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>

This action sequence is adding state 107 to the user, which is our weapon sprite state that I mentioned above. This state changes the actor's weaponsprite and attack motion to be our harp sprite and missile animation. After performing the sequence, this state is removed, to prevent the actor from wielding a harp afterward. The sequence also does a check to see if the user is affected by state 168, which is the 'Song Use' state we will make shortly. If it detects the presence of this state, it adds the state to the user again. This is modular, because the same play skill would be used for multiple songs, so for each new song you create, add a new check to see if the use state for the new song is present.


Next step, let's make state 107 the weaponsprite changing state.

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

The weapon image value is 30. If you used my spritesheet above, without renaming it, this is the id it would use. If you have other spritesheets, or renamed mine, this value would be different. The entire purpose of this state is to change the weapon sprite of the user to a harp, and then back again when the state is removed. We do this with the Weapon Animation plugin listed above.


For the next step, we're going to make our song skill. For this skill I have chosen Aria of Might, a buff that increases ATK for all allies by 30% for as long as it is active.


ariaofmight.PNG


This skill adds our 'song use' state to the user. It is instant cast, and has virtually no action sequence to speed up combat for the player as much as possible. The notetags for this skill also hide it, if the user is under the effect of any song use state, to prevent them from casting it multiple times in the same turn. (you can see in the screenshot that I have more song states checked for, but this example will only contain one song). It also has a 'custom requirement' that state 171 be active on the user before allowing the skill to be used. State 171 is our passive state that shows that the actor has an instrument equipped. By itself it doesn't do anything, but is passively applied by instrument items you can equip, in the same way a shield must be equipped in order for the block chance effect from two weeks ago to work.


Here is the skill notebox paste code:

Code:
<Instant Cast>
<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>
<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>

Next, we'll make the 'Aria Use' state, Id, 168, which is applied when this skill is used, and is also re-applied when the 'play' skill is used.


ariaofmightstate.PNG


Here is the notebox code for this state:

Code:
<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>




Now we'll make the effect state. There isn't much to this state, as removal is handled by the use state.


mightariaeffectstate.PNG


It is important that this state be removed after battle, and not have a set duration. If you later decide to make your own songs, this is the state where you'd change their effect.


Next let's make our 'stop' skill. This skill is only visible if the actor is affected by the song use state. Using this skill refunds some MP to the actor, because the upkeep is charged at the beginning of his turn. It also immediately removes the song use state from him, which removes the effect state from all allies. The purpose of this skill is so that the player can cancel a song they selected in error, or cancel a song in progress if they want to use the attack skill.


stopperformskill.PNG


You will note two things about the above screenshot.



    • It removes more than just state 168

    • The MP recover cost uses a function you've probably never seen before
This skill, like the play skill is used for all songs, and I have many more than just one song in my project, so it removes all of them.


Also, in my project, MP cost increases on an exponential scale based on level, so it was necessary to use that function in my MP return formula to insure MP returned remained consistent with the upkeep cost of the skill. In your prject, putting the cost of the song in there will suffice, of course.


Here is the copy-paste code for this skill:

Code:
<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>

Up to this point we have a working skill, but I haven't covered what's on state 167 yet, only when to apply it. the reason for this is that without our bonus code below, this state would also be blank. It's basic purpose is to tell the song use state that it is being re-applied, so it can apply the 'song effect' state. But we also make use of it for Lingering Song.


Before I get to the bonus, though, let me to a recap of how this state works, as this is quite a lengthy read.


  • 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

Bonus: Lingering Song


For our bonus this week, I have included a passive trait that increase the duration of a song skill used by the bard. We already have the building blocks for how this effect will be applied, in that when the use state is re-applied, it's duration increases by 1 turn. We use a passive state, which can be applied per actor, or by skills or equipment, to make the use state get re-applied a second time, increasing the duration to 3 turns. And we do this using our 'continue perform' state, 167, which is applied when you use the 'play' skill.


continueperformstate.PNG


This state has no icon, so as to make it invisible to the player. It is important that it lasts only one turn, and is removed after battle end. Here is the notebox code:

Code:
<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>

State 170, our lingering song passive has no code in it at all. It's entire purpose is to increase the duration of our songs, which we handle from the other states. As long as an actor has state 170 on them, a song use state will remain on the user for three turns after playing it, instead of two. This allows the bard to alternate between keeping his song playing, and performing another action.


How does it look in action?


See for yourself


That's all for this week, folks. Feel free to ask questions, or make suggestions for any other states you'd like to see.
 
Last edited:

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
I expected more people to enjoy what this topic is about :/


Anyway, I'm a bit late to the party, but Perform is super neat as it can be used for other similar purposes, which I kind of like, thank you
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
I expected more people to enjoy what this topic is about :/


Anyway, I'm a bit late to the party, but Perform is super neat as it can be used for other similar purposes, which I kind of like, thank you

I choose to believe that last week's state was a little too bloated for the average developer to make proper use of, without some heavy modification for their own projects, of course.


It did have some building blocks that could be used to make some other kinds of useful states out of it, mind you, particularly the 'effect' state, and how it was applied to all allies except the user could also be used to make an 'aura' type skill, where the user has an aura state on himself, and it puts an effect state on his allies.


But, I digress, this week I bring a much more basic state to the table, MP Absorb.


What does it do?


MP Absorb is a state that causes the battler affected by it to gain MP equal to the cost of a single target spell that hit them. This works nicely as a passive effect on mage-type characters to help them keep their MP reserves high. This also opens up some strategic choices for the player, especially if you're using an equip skill system of some kind for passives, as the player may be able to choose between passive Mp regen effects like this one, or actively conserving Mp.


The Code:

Code:
<Custom Respond Effect>
if (this.isHpEffect() && this.isMagical()) {     
  //the skill used must be magical and affect HP for it to work
  var scope = $dataSkills[a._actions[0]._item._itemId].scope
  //This pulls the scope of the skill, to make sure it was a single target effect
  if (scope != 2 && scope != 8) {
    var cost = $dataSkills[a._actions[0]._item._itemId].mpCost
    //pulls the mp cost fo the ability
    if (b.hp != 0){
      //if target of the spell isn't dead, restore mp
      b.gainMp(cost)
    }
  }
}
</Custom Respond Effect>
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
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-skill.png



Above, 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.png



And here is the copy paste code for this state:

Code:
<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.


I mentioned earlier that the skill can be modified so that it damages allies when cast by an enemy. This would be as simple as checking if the caster has an actorId, and setting a flag value, to change any check for $gameTroop.members() to $gameParty.members(). I choose not to spell this out here to make the effect not as complicated, but the tools are there for anyone that wants to use them.


How does it look?



Check it Out!


That’s all for this update folks.


-Ramza
 
Last edited:

Lnik3500

Master Troll
Veteran
Joined
Feb 26, 2015
Messages
307
Reaction score
48
First Language
French
Primarily Uses
RMMV
Nice! Keep up the good work :)  
 

Crysillion

Veteran
Veteran
Joined
Sep 25, 2014
Messages
138
Reaction score
20
Primarily Uses
I keep up with the topic!


Anyway, if you're looking for requests, I'm trying to wrap my head around a way to do a state that removes you from the battle. If you've played Final Fantasy games, you know that some bosses, usually the side-bosses, tend to have a skill that, when used on your party member, just completely evicts them from the fight. Their gauge disappears, they simply don't exist in the fight anymore. After the fight is over, they're still in your party, but they got nothing from that fight.


I'd be interested to know how to go about recreating such an effect in RPG Maker MV. Perhaps, though, that is not necessarily a state.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
I appreciate you guys making it so that I don't have to double post XD.


This week’s state is a lot more simple. Overcharge is a special ability of the wizard class in my project, which allows them to cast a magic spell that deals twice as much damage as normal, while costing double the normal MP cost. This effect is instant cast, and only lasts for the following turn, and also makes use of a skill cooldown to prevent abuse.


Naturally, for the instant cast and cooldown, you will need the YEP Instant Cast and YEP Skill Cooldown plugins.


For this effect, we need a state, and a skill. The skill is used to apply the state to the caster.


overchargeskill.png



To complete the skill, we also need the following note tags in the note box.


Code:
<Instant Cast>
<Cooldown: 2>


Next we need the state:


overchargedstate.png



The state itself doesn’t really do anything, aside from expire after 1 turn. To get the desired effect, we need to add a few things to affected skills.


First, in order to double the MP cost of an overcharged skill, we need to add the following note tag to ANY skill that will be affected by Overcharged:


Code:
<Custom MP Cost>
  cost = cost * (1+ user.isStateAffected(43))
</Custom MP Cost>


Note that StateId 43 is our overcharged state. What this does is double the cost of the spell, but only if Overcharged is active.


Next, the easiest way to double the damage of the affected skill is to change its damage formula. We need to add the following bit to the end of the damage formula for our spell.


Code:
* (1 + a.isStateAffected(43));


This will double the damage of the skill, only if the user is affected by the overcharged state.
If your damage formula looked like this before:


Code:
a.atk * 4 - b.def * 2

It should look like this after:

Code:
(a.atk * 4 - b.def * 2) * (1 + a.isStateAffected(43));


Because the state expires after one turn, generally the actor will only be able to use it once before it expires. This will not be the case when using instant cast skills, so keep that in mind when you’re balancing your battles around this mechanic.


@Crysillion I know that there is a special effect 'escape' that you can put on a skill to cause someone affected by it to run, but the engine itself doesn't handle it properly in an event where all actors are forced to flee in this way. So it would work on a few actors, but if it causes the only actor remaining in the party to flee, the game hangs. I had reported this as a bug in version 1.2, and as far as I know it hasn't been fixed. I was using it for a skill to cause a 100% escape chance for the party.


If you built in some sort of fail safe to prevent enemies from using it when only one party member is left, this would work pretty well.


whirlwind.png
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
Guess I spoke too soon about the double posting, eh?


This week’s state is a little favorite of mine, Second Chance, which allows a fallen actor to be resurrected at 50% HP, but only once per battle. This effect will trigger even if the actor who is affected by it is the only actor left alive in the battle, no instant game overs here.


What do we need?
  • The usual plugins
  • The action sequence plugins
  • YEP_X_StateCategories
  • Two passive states, one for the effect and one for the cooldown
  • A skill that will be used on the affected actor when he dies.
  • An animation for the skill to use
We also need to modify your death state to accommodate the second chance ability. You will need a way to apply the passive state to the affected actor as well. You could alternatively not use a passive state, and instead make this effect an active buff with a turn duration.


First, let’s change our death state. We will need to add the following notetags to the death state to make it check for the presence of the second chance state:


Code:
<Custom Apply Effect>
if (target.isStateAffected(186)) {
BattleManager.queueForceAction(target, 210, 0);
}
</Custom Apply Effect>


The actor is checked for state 186 when he dies, if found, an action is forced to use skill 210 on that same actor. Skill 210 will be our second chance effect.


resurrection.png



Note that this skill needs to have its scope set to affect a dead ally, otherwise it will have no effect on the actor. The effects of this skill remove the death trait, and restore a flat 50% HP to the affected actor, as well as add our second state. Here is the action sequence code for this skill:


Code:
<setup action>
camera clamp on
display action
zoom: 300%
camera focus: user
wait for zoom
</setup action>
<target action>
camera focus: user
zoom: 250%
wait for camera
action animation: user
animation wait: 20
motion dying: user
wait for animation
action effect: target
motion standby: user
wait: 20
motion spell: user
wait: 25
</target action>
<finish action>
perform finish
clear battle log
reset camera
reset zoom
wait for camera
camera clamp on
</finish action>


Next we will cover the two states we need. The first is the enabler state, which causes the affected actor to resurrect after being afflicted with the death state. There is nothing too special on this state, only the following note tags:


Code:
<Category: Bypass Death Removal>
<Custom Passive Condition>
if (user.isStateAffected(187)) {
  condition = false;
} else {
  condition = true;
}
</Custom Passive Condition>


The above code prevents this passive state from becoming active if state 187 is detected. State 187 is the cooldown state, applied when the resurrection happens to the battler. This prevents the effect from happening more than once during a battle. The bypass death removal tag makes it so that this state is not removed upon death, without this tag, or some other way to make states remain on a battler even through death, the state has no effect.


The second state is the cooldown state, which is applied after an actor is resurrected. This state needs to be removed at battle end, but you could also modify it to last a number of turns as well, if you’d like your auto-resurrection to happen more than once. Without this cooldown state, the effect will happen every time the actor dies, making him functionally immortal. The only note tag for this state is below:


Code:
<Category: Bypass Death Removal>


This prevents the state from being removed if the actor dies, which prevents the auto-resurrection from happening every time the actor dies as well.


As said above, this works best as a passive ability, but can be easily modified to be a temporary buff spell as well. That’s all for this update, thanks.


~Ramza
 
Last edited:

Past Midnight Gaming

The Midnight Dragon
Veteran
Joined
Jan 20, 2015
Messages
93
Reaction score
30
First Language
English
Primarily Uses
Well this is a cool thread. personally skill making baffles me so this will help a ton. If you don't mind i would love to see how to make a skill sorta like second chance but instead of the 50% rebirth the actor would gain a temporary boost (atk, def, and the like) for a few turns after which the actor dies (sorta like Yusuke does during victory burst in the game J-Stars Victory VS+) Thanks for the states ^.^
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
Well this is a cool thread. personally skill making baffles me so this will help a ton. If you don't mind i would love to see how to make a skill sorta like second chance but instead of the 50% rebirth the actor would gain a temporary boost (atk, def, and the like) for a few turns after which the actor dies (sorta like Yusuke does during victory burst in the game J-Stars Victory VS+) Thanks for the states ^.^

For this modification, we would make a couple of changes.


First, the 'cooldown skill' would be the one that grants the buffs, so you'd change that to expire after a number of turns, and set it's effects to add, say, a 20% buff to each parameter.


Second, you'd need to add the immortal state to the 'resurrection' skill, which while on the actor would prevent him from dying again.


Third, you'd need to make it so that when the cooldown state is removed, it removes the immortal state, and also adds the death state to the actor. That would be achieved using a custom remove effect tag.


Code:
<Custom Remove Effect>
  target.removeState(2)        //this is the immortal state
  target.addState(1)        //this is the knocout state
</Custom Remove Effect>


That code would go on the cooldown state. If you give it an icon, and a turn duration, the player will see it active, and know how long until the actor dies.
 
Last edited:

Past Midnight Gaming

The Midnight Dragon
Veteran
Joined
Jan 20, 2015
Messages
93
Reaction score
30
First Language
English
Primarily Uses
Cool, thanks! Keep up the good work. all these states will definitely help when i start working on the battle aspects of my game
 

Iqus

Veteran
Veteran
Joined
Oct 17, 2013
Messages
44
Reaction score
45
First Language
Spanish
Primarily Uses
RMMZ
Hi Ramza!


I just ran into this post of yours and first of all, I have to thank you for the work you're doing.


I would like to request some states I have been thinking of adding to my game. I know it's quite a lot but since no one else is requesting and some of them are quite simple (compared to what you already did!) I will just write down this list of interesting states.


Request


State Name:


Hell Power


State Description:


Hell Power is a state from Ragnarok On-line. When a battler is affected by Hell Power and it's eventually killed by the enemy, the state will remain and the battler cannot be resurrected. However, Hell Power will eventually dissipate after some turns even if the target is dead. This state is very interesting and gives you a real fear of death even if you have plenty of Phoenix Down and Resurrection Spells. Obviously this state should nullify states like Auto-Life and Second Chance.


Interesting Add-on:


It would be quite interesting if the effect was reversed when the target is on Zombie state, for example; becoming an Auto-Life state for Zombies.


State Name:


Dizziness


State Description:


This is an idea of mine and it can be considered as a kind of 'soft confusion'. The idea is that the one affected by this state will be unable to chose the target for his actions, all spells will have a random target and will bypass Taunt effects. Can be quite strategical when you have an enemy focused on attacking your healer or an ally with a high TRG rate.


State Name:


Lock
 


State Description:


I think that this state comes from a variant from a Final Fantasy state and can be quite powerful. The affected battler cannot receive any more states if affected by Lock AND all previous states the battler was suffering will be locked, meaning that their duration will be frozen until Lock is removed. Additionally, if someone casts Dispel on the battler, only Lock will be removed and another Dispel would be necessary to remove the previously locked states (because they were 'protected'). There should be the option to make some states non-lockeable to avoid an excesive abuse (like forever-Guard, endless Immortality or any other special effect brought by skills).


State Name:


Mental Charge


State Description:


Spells/Skills have an increased cost of N*5%, being n the number of turns left.


State Name:


Stealth
 


State Description:


Cannot be targeted by single or random target skills (but can still receive damage from spells that affect all enemies, which would also remove the effect). The effect is lost when performing an action. Enables use of shadow


That's all the interesting effects I can think of right now. Any suggestion or variation would be much appreciated :)


Thanks again for your amazing work!
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
871
Reaction score
554
First Language
English
Primarily Uses
RMMV
@Iqus Lemme see what I can do with some of those.

State Name:


Hell Power


State Description:


Hell Power is a state from Ragnarok On-line. When a battler is affected by Hell Power and it's eventually killed by the enemy, the state will remain and the battler cannot be resurrected. However, Hell Power will eventually dissipate after some turns even if the target is dead. This state is very interesting and gives you a real fear of death even if you have plenty of Phoenix Down and Resurrection Spells. Obviously this state should nullify states like Auto-Life and Second Chance.


Interesting Add-on:


It would be quite interesting if the effect was reversed when the target is on Zombie state, for example; becoming an Auto-Life state for Zombies.

The first part is definitely possible, although I suspect in order to make someone immune to being resurrected, I'd have to modify the death state to check if this state is active before being removed. I don't think there's an existing script way to achieve this, so it might result in the resurrection going through and then the afflicted actor dying again. I'm not sure how the engine would handle this, TBH.


The second part is probably doable, by simply turning this state into my second chance state posted above, but only if it detects a different state (zombie? undead?) that would denote the target as an undead.

State Name:


Dizziness


State Description:


This is an idea of mine and it can be considered as a kind of 'soft confusion'. The idea is that the one affected by this state will be unable to chose the target for his actions, all spells will have a random target and will bypass Taunt effects. Can be quite strategical when you have an enemy focused on attacking your healer or an ally with a high TRG rate.

I'm not sure there is a way to affect targeting in this way. I'd have to look into it a little more, to be sure, but I'm not sure I can change the target of an attack with a state on the user. Any of the state effect tags that happen when an action is chosen begin when the target was already picked. I'm not sure if there's a way to change that during the action or not. I think the best chance of this working would be to change the target during an action sequence, but this would require every skill to have an if condition in it's action sequence to check for this state before deciding on it's target. That seems like a lot of work.

State Name:


Lock
 


State Description:


I think that this state comes from a variant from a Final Fantasy state and can be quite powerful. The affected battler cannot receive any more states if affected by Lock AND all previous states the battler was suffering will be locked, meaning that their duration will be frozen until Lock is removed. Additionally, if someone casts Dispel on the battler, only Lock will be removed and another Dispel would be necessary to remove the previously locked states (because they were 'protected'). There should be the option to make some states non-lockeable to avoid an excesive abuse (like forever-Guard, endless Immortality or any other special effect brought by skills).

I'm pretty sure to create the illusion of states having their turn duration locked, I'd need to make a turn end effect that checks for every times state, and adds one turn to it, at the end of every turn. In theory, this part isn't too hard to make. To make the second part happen, the dispel spell would be designed to check for lock first, and remove it if found, and if not found, remove all status effects instead. To make some states not lockable, I would have to manually do if...then checks for each state that could be locked, rather than use a for...loop. Again, definitely possible though.


I'm not entirely sure how to implement not being able to gain more states during the lock. Each state when applied would have to check for the lock state, and then remove itself if it detects a lock. I could probably also do this using an action sequence in the same way.

State Name:


Mental Charge


State Description:


Spells/Skills have an increased cost of N*5%, being n the number of turns left.

This is probably pretty simple to do, if what I'm thinking is correct. Based on the name, I suspect you also wanted it to increase the damage of those spells, which is also fairly easy to implement. Using the state turn duration in a formula is no problem, and if I save it as a battler variable (like with my bleed state a few weeks ago), it can also be called in a custom Mp cost tag.

State Name:


Stealth
 


State Description:


Cannot be targeted by single or random target skills (but can still receive damage from spells that affect all enemies, which would also remove the effect). The effect is lost when performing an action. Enables use of shadow

I actually have a state similar to this already made in my own project. With my variation, physical attacks will always miss the target, while magical attacks will always hit, similar to invisibility in final fantasy 6. Being stealthed also causes your next physical attack to deal double damage, also removing the effect.


I already know it's possible to have a state only be affected by certain scoped skills, as my Mp Absorb state from a couple of weeks ago makes use of this to only absorb Mp from single target spells, so a modification of this stealth state I already have wouldn't be too difficult.


I'll put some work into these over the next few days and see what I can do with them. I'll give them all a shot, and see if I can't get them at least partially working.
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

energy drinks have made this week SUPER productive so far lol. I finished one of my overworld maps, along with 2 other maps and a way to traverse to said overworld map.
i am absolutely DRAGGING MYSELF RIGHT NOW, i bought a commission ($35) back in october, got the art back, it was great, only to NOW realize i never DOWNLOADED it to my computer, and the site i used auto-deletes uploads after 3 months. Now i'm panicking cuz she closed all her commissions on that site & deleted her IG and Facebook, luckily I found her g-mail but who knows if she'll respond :kaocry: pray for me ya'll
Sigh...I can do everything I need for this game but make actual sprites and tile maps for it. Guess I'll look into hiring someone for that
Goes looking for assets, ends up creating memes. I have priorities?
i'm working on finishing an old game in vx ace (the first game i tried to make in vx ace), and it's making me realize how many things i've come to take for granted in mv (like the additional BCDE tile layer and the plugin manager).

Forum statistics

Threads
109,027
Messages
1,041,360
Members
141,499
Latest member
kanyatanishande
Top