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

Discussion in 'Resource Workshops' started by ramza, Aug 2, 2016.

  1. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I appreciate the pokings and the likes and follows, but unfortunately I have decided to close down the workshop for several weeks. Real life commitments have me short on time for game design in general, let alone this workshop. I'll be back in December (hopefully with some of these suggestions already made).


    Thanks for all the support.
     
    #81
    waynee95, kovak and Michael Caiola like this.
  2. Michael Caiola

    Michael Caiola The Stone Bull Veteran

    Messages:
    392
    Likes Received:
    74
    Location:
    Albany/Saratoga, NY
    First Language:
    English
    No worries. Take care of yourself.
     
    #82
  3. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Good news everyone. I'm re-opening the state shop.

    I've got a couple more states to share, and a new plugin you can find kicking around, so for the first few days I'm going to be catching this thread up on some things I've done. Expect that early on, I will posting the updated version of the shield block state, which now makes use of my new Shield Block Plugin.

    Edit: The opening post has been changed to reflect the new shield block state

    The first thing I'd like to post is a request from @Iqus to change Prayer of Mending so that it only hops when the targets HP is full. I ran into a unique challenge doing this, in that with the default battle system, turn end effects happen in the order of the party members array. Meaning with the way I initially set this up, if this effect skipped down the line up (from position 0 to 1 for example), it would run multiple times. This isn't intended, so I had to make two different versions of the state. I give you Renewing Myst.

    What does it do?
    • An affected battler will recover a small amount of hp at the end of his turn.
    • If that battler's hp is full after the heal has gone through, the effect will skip to another injured ally.
    • If there are no other injured allies present, the effect will stay on the current battler.
    Code:
    <Custom Apply Effect>
    this._mystHeal = origin.mat * 4;
    this._mystOrigin = origin
    </Custom Apply Effect>
    
    <Custom Remove Effect>
    this._mystHeal = undefined;
    this._mystOrigin = undefined;
    </Custom Remove Effect>
    
    <Custom Turn End Effect>
      var heal = Math.floor(user._mystHeal * (((Math.random()*40)+80)/100)) * user.elementRate(11) || 1;
      user.startAnimation(193);
      user.gainHp(heal);
      user.startDamagePopup();
      user.clearResult();
      var caster = user._mystOrigin
    if (user.hp == user.mhp) {
    //  user.removeState(34);
        var members = [];
        for (var i = 0; i < user.friendsUnit().aliveMembers().length; ++i) {
          var potential = user.friendsUnit().aliveMembers()[i];
          if (!potential) continue;
          if (potential === user) continue;
          if (potential.isStateAffected(34)) continue;
          if (potential.hp <= 0) continue;
          if (potential.hp == potential.mhp) continue;
          members.push(potential);
        }
        if (members.length === 0) {
         members.push(user)
        }
        var member = members[Math.floor(Math.random() * members.length)];
        if (member) {
          member.addState(34);
          member._mystHeal = heal;
          member._mystOrigin = caster
          member._stateTurns[34] = user._stateTurns[34]
         if (user != member) {
           user.removeState(34);
         }
        }
    }
    </Custom Turn End Effect>
    DBS Version:
    What is the difference here?
    Because of the way the default battle system handles turns ending, turn end effects happen in the order of the party formation. The actor in position 0 will end his turn, followed by position 1 and so forth. With the above code, if actor 0 is affected by the state, and becomes fully healed from it, the mist will move like normal to another injured ally. If that ally is in a higher position than slot 0, that ally will then also set off the effect immediately following the first one. This has the unintended effect of causing the mist effect to keep healing allies down the line until there are no more injured battlers, it gets to the end of the line, or it heals an ally who doesn't fully heal from the effect.

    To correct this in the default battle system, I changed the effect to heal an ally after their action, instead of at turn end.

    Code:
    <Custom Apply Effect>
    this._mystHeal = origin.mat * 4;
    this._mystOrigin = origin
    </Custom Apply Effect>
    
    <Custom Remove Effect>
    this._mystHeal = undefined;
    this._mystOrigin = undefined;
    </Custom Remove Effect>
    
    <Custom Action End Effect>
      var heal = Math.floor(user._mystHeal * (((Math.random()*40)+80)/100)) * user.elementRate(11) || 1;
      user.startAnimation(193);
      user.gainHp(heal);
      user.startDamagePopup();
      user.clearResult();
      var caster = user._mystOrigin
    if (user.hp == user.mhp) {
        var members = [];
        for (var i = 0; i < user.friendsUnit().aliveMembers().length; ++i) {
          var potential = user.friendsUnit().aliveMembers()[i];
          if (!potential) continue;
          if (potential === user) continue;
          if (potential.isStateAffected(34)) continue;
          if (potential.hp <= 0) continue;
          if (potential.hp == potential.mhp) continue;
          members.push(potential);
        }
        if (members.length === 0) {
         members.push(user)
        }
        var member = members[Math.floor(Math.random() * members.length)];
        if (member) {
          member.addState(34);
          member._mystHeal = heal;
          member._mystOrigin = caster
          member._stateTurns[34] = user._stateTurns[34]
        if (user != member) {
           user.removeState(34);
        }
        }
    }
    </Custom Action End Effect>
     
    Last edited: Mar 16, 2017
    #83
    Past Midnight Gaming likes this.
  4. Past Midnight Gaming

    Past Midnight Gaming The Midnight Dragon Veteran

    Messages:
    93
    Likes Received:
    30
    Location:
    The Milky Way
    First Language:
    English
    Good to see you back! I'm looking forward to seeing what you come up with. Updates to previous skills are all the more better.:kaojoy::D
     
    #84
  5. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    It's high time I added another new state to this workshop. The next 'real' state I've got to add will come on Wednesday, but since I've got a bunch of smaller states to toss in here as well, I'll share one of them now. And with an added bonus - a skill that uses this state to cause massive damage.

    I bring you Infinity.

    What does it do?
    Loosely based on a skill of the same name from Maplestory, infinity grants the caster infinite Mp for the duration of the spell, at the end of which, all Mp is removed from the caster.
    In this particular iteration of it, it has a cooldown, so one can't cast it repeatedly during the effect, and a special requirement that the caster has more than 50% of his/her max mp before being allowed to cast it. I have also made it so that grants the bonus damage effect of my Overcharge state (which is further back in this topic) for its entire duration.
    This buff skill is useful to cast several powerful spells in quick succession without fear of running out of Mp during the few rounds that it is active. To get the most out of it, you'd need to use more Mp than your current mp when you first cast the spell on yourself, but that sort of strategy should be left up to your players.

    So, first things first, you'll need a skill to apply infinity on your actor.
    [​IMG]
    Of note here is our <Cooldown: 5> tag and the <Instant Cast> tag. You will need the YEP plugins that add these options to your skills.
    In our notebox for this skill we have the following:
    Code:
    <Instant Cast>
    <Cooldown: 5>
    <Skill 165 Cooldown: 5> // this puts our Overcharge skill on cooldown as well.
    <Custom Requirement>
       if (user._mp > user.mmp / 2) {
         value = true;
       } else {
         value = false;
       }
    </Custom Requirement>
    The custom requirement code prevents the skill from being usable if the user has less than 50% of his/her maximum Mp.

    Next we have our actual Infinity state:
    [​IMG]
    The most noteworthy things about this state are its expiration time (5 turns), which lines up with our cooldown on the skill (and the cooldown placed on overcharge as well). The Sp-Parameter in the traits box is what gives us infinite Mp - by making no skills cost Mp, Mp is effectively infinite. In our notebox we have the following code:
    Code:
    <Custom Apply Effect>
    target.addState(43)                 //This is our overcharge state
    target._stateTurns[43] = 5      //This makes overcharge last 5 turns intead of one turn
    target._infMp = target._mp   //Here we are storing the users current mp when the state was applied, for later use
    </Custom Apply Effect>
    <Custom Remove Effect>
    target.gainMp(-target.mmp) //this removes all mp from the user
    target.removeState(43)        //removes the overcharge state from the user
    </Custom Remove Effect>
    So while this state is active on your user, he has infinite Mp, and all spells will be overcharged (as per the custom state from a long time ago), but we can make this even more interesting. In the infinity state, we saved the number of Mp the user had when infinity was applied. We can use that value in the damage formula for a powerful skill that can only be used when infinity is active, that immediately cancels the effect to deal massive damage!

    [​IMG]
    So for this skill, we have the damage formula set a little weird, right? a._infMp is the value we saved on the infinity state when it was applied. So with this example damage formula, the user would do his MAT *4 + three times his current Mp when he cast infinity. Obviously, this skill could get a little overpowered, so its up to you to tweak the numbers to match with your project a little better.
    In our notebox for this skill we have the following:
    Code:
    <Custom MP Cost>
    cost = user.mmp                           //This will show an mp cost of all of the actors mp
    </Custom MP Cost>
    <Custom Requirement>              //With infinity active, the skill will be usable
       if (user.isStateAffected(261)) {
         value = true;
       } else {
         value = false;
       }
    </Custom Requirement>
    <After Eval>
    user.removeState(261)               //This removes the infinity state from the caster after the spell is used
    </After Eval>
    That's all for today, folks.
     
    Last edited: Mar 23, 2017
    #85
  6. Failivrin

    Failivrin Final Frontiersman Veteran

    Messages:
    189
    Likes Received:
    182
    First Language:
    English
    Primarily Uses:
    RMMV
    Very cool workshop! I can probably think up all kinds of crazy skill suggestions, and I'm excited to see what's coming.
     
    #86
  7. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Alright, as promised, here's Dark Aura.

    It was waaaay back in August of 2016, when I first made this state workshop, and the wordpress blog that goes with it. On the blog (but not in here) I teased the name of another state I was working on in August, Dark Aura. But what does it do? No one ever knew. Except me. It wasn't finished until mid-January, which was an odd timeline because the state itself wasn't that difficult to make, I just didn't have any time to make it.

    So what is it? Dark Aura, in my project, is a defensive/tank type passive effect that only works on the Blackguard class. This class is designed that the player can make an active choice between if they want the Blackguard to tank, or to be a damage dealer, and this state is for the former of those two options. As long as the Blackguard is wearing a shield, Dark Aura will be active.
    Dark Aura itself causes incoming active damage effects to deal no damage up front, instead, it staggers all damage taken over the next three turns. Every time the battler would take damage, the three turns are reset, and the new amount is split over them again, up to a maximum of 3x the battlers max Hp, where at the end of his next turn, he will surely die.

    While by itself, this effect doesn't really reduce damage, it does allow for your healing actors to have more time to take care of incoming damage, when needed. But our bonus this week is a usable skill that immediately clears all staggered damage from the Blackguard, but while this skill is on cooldown, the aura itself has no effect.

    I'll save some time by not getting into the strategic uses for both of these abilities, suffice to say, however, that this can really open up the doors to some massive damage reductions, using a taunt to absorb as much damage as possible and then clear it, for example.

    Anyways, let's get to the state, shall we?

    [​IMG]

    We've also got some length copy+paste code for this as well, so I will break it up a bit into it's separate tags.
    First, we have the enabler condition. This passive condition tag prevents the state from being active if all of it's requirements are not met.
    Code:
    <Custom Passive Condition>
    if (user._classId == 16 && user.equips()[1] != null && user.equips()[1].atypeId != undefined && user._cooldownTurns[318] <= 0) {
    condition = true
    }else{
    condition = false
    }
    </Custom Passive Condition>
    What we have listed for requirements, in order:
    1. If the user's class is 16 (Blackguard)
    2. AND the user's offhand item is not empty
    3. AND the user's offhand weapon is a piece of armor
    4. AND skillId 318 is not on cooldown
    Obviously, if you don't want some of those requirements on this trait, well, remove them from this section. Keep in mind that skill 318 is our bonus skill, and we're using its cooldown to disable the aura while it is on cooldown.

    Next, we have the react section, which covers when the battler is hit by an effect:
    Code:
    <Custom React Effect>
    if (value > 0 && this.isHpEffect()) {
     if (target.DADamage != undefined) {
      target.DADamage = target.DADamage + value
     }else{
      target.DADamage = value
     }
     if (target.DADamage > (target.mhp * 3)) {
      target.DADamage = target.mhp * 3
     }
     target.DATurns = 3
     target.setStateCounter(243, target.DATurns);
     value = 0
    }
    </Custom React Effect>
    This section checks to make sure that the incoming effect is going to deal Hp damage, and that it dealt at least 1 point of damage. When this check is successful, it adds the incoming damage value to a variable on the target (or defines that variable if it doesn't already exist). Next it makes a check to see if the effect is larger than your maxHp * 3, and if so, sets it to this amount. It then sets the number of turns this effect will last for to three, and shows the turns remaining on the state icon using the setStateCounter function.

    Lastly, we have the turn end effect, which handles dealing the staggered damage to the affected battler, reducing the turn count by 1, removing the state if there are no more turns remaining, and killing the affected battler (if needed).
    Code:
    <Custom Turn End Effect>
    if (this.DADamage != undefined && this.DADamage > 0) {
     auradmg = Math.floor(this.DADamage / this.DATurns)
     this.DADamage = this.DADamage - auradmg
     performStateAnimationDmg(187, this, auradmg, 9);
     this.DATurns = this.DATurns -1
     this.setStateCounter(243, this.DATurns);
     if (this.DATurns <= 0) {
      this.removeStateCounter(243)
     }
     if (this.isDead())
       {
          this.performCollapse();
       }
    }
    </Custom Turn End Effect>
    Where this state deals damage, we are using my State Animations plugin, which makes the damage phase a little bit more visually interesting.

    Lastly, we have the remove and victory effects, both of which clear all stored values for this state, and remove the state counter.
    Code:
    <Custom Remove Effect>
    this.DADamage = undefined
    this.DATurns = undefined
    this.removeStateCounter(243)
    </Custom Remove Effect>
    <Custom Victory Effect>
    this.DADamage = undefined
    this.DATurns = undefined
    this.removeStateCounter(243)
    </Custom Victory Effect>
    The remove effect code is needed for our bonus skill. The victory effect prevents the stored damage from remaining after a battle, to allow each new fight to start from a fresh slate.
    The final thing in our paste code is a simple tag to change the color of the stateCounter text on the icon:
    Code:
    <Counter Text Color: 6>
    So here is a total copy paste of all of the notetags for this state:
    Code:
    <Custom Passive Condition>
    if (user._classId == 16 && user.equips()[1] != null && user.equips()[1].atypeId != undefined && user._cooldownTurns[318] <= 0) {
    condition = true
    }else{
    condition = false
    }
    </Custom Passive Condition>
    <Custom React Effect>
    if (value > 0 && this.isHpEffect() && value > 0) {
     if (target.DADamage != undefined) {
      target.DADamage = target.DADamage + value
     }else{
      target.DADamage = value
     }
     if (target.DADamage > (target.mhp * 3)) {
      target.DADamage = target.mhp * 3
     }
     target.DATurns = 3
     target.setStateCounter(243, target.DATurns);
     value = 0
    }
    </Custom React Effect>
    <Custom Turn End Effect>
    if (this.DADamage != undefined && this.DADamage > 0) {
     auradmg = Math.floor(this.DADamage / this.DATurns)
     this.DADamage = this.DADamage - auradmg
     performStateAnimationDmg(187, this, auradmg, 9);
     this.DATurns = this.DATurns -1
     this.setStateCounter(243, this.DATurns);
     if (this.DATurns <= 0) {
      this.removeStateCounter(243)
     }
     if (this.isDead())
       {
          this.performCollapse();
       }
    }
    </Custom Turn End Effect>
    <Custom Remove Effect>
    this.DADamage = undefined
    this.DATurns = undefined
    this.removeStateCounter(243)
    </Custom Remove Effect>
    <Custom Victory Effect>
    this.DADamage = undefined
    this.DATurns = undefined
    this.removeStateCounter(243)
    </Custom Victory Effect>
    <Counter Text Color: 6>

    Now for our bonus, a skill that clears all staggered damage from the battler, and disables the Dark Aura passive effect while it is on cooldown.
    [​IMG]

    One of the most important features of this skill, is that it cannot be used when Dark Aura is no active on the user. While this won't prevent a player from 'cleansing' an aura that has no staggered damage in it, it will prevent them from using this skill at all when they don't have a shield equipped, for example.
    Here is the paste code for this skill. I have included the action sequence used, because the aura values are cleared by eval codes in the action sequence.
    Code:
    <Instant Cast>
    <Cooldown: 3>
    <setup action>
    camera clamp on
    display action
    immortal: targets, true
    perform start
    zoom: 300%
    camera focus: user
    wait for zoom
    motion chant: user
    cast animation
    wait for animation
    </setup action>
    <target action>
    motion spell: user
    camera focus: target
    zoom: 250%
    wait for camera
    action animation: target
    wait for animation
    action effect: target
    eval: target.DADamage = undefined
    eval: target.DATurns = undefined
    eval: target.removeStateCounter(243)
    </target action>
    <finish action>
    perform finish
    clear battle log
    immortal: targets, false
    reset camera
    reset zoom
    wait for camera
    camera clamp on
    </finish action>
    
    <Custom Requirement>
       if (user.isStateAffected(243)) {
         value = true;
       } else {
         value = false;
       }
    </Custom Requirement>
    Keep in mind that state 243 is our aura state, change that value to whatever your aura state is.

    Conclusion:
    So we have a passive state, that only happens if the user belongs to class 16, and only if he is wearing a shield in his offhand, which becomes inactive if the cleanse skill is on cooldown. This state banks damage taken while it is active, to deal it over the following three turns. As more damage is taken, the turn count is reset to three, and the staggered damage will never exceed 3x your max HP. When it deals damage to you, it shows a neato animation, and deals dark elemental damage to you. At any time, you can use the Cleanse skill to remove all remaining banked damage, but doing so prevents the passive effect from happening until the cleanse skill is off cooldown again.

    That's all for this update folks.
     
    #87
  8. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Alright, starting today, I will be back to posting one weekly state per week. Hopefully on Sunday, maybe Monday, depending on work schedule.

    This week's state is called Arcane Burn, and it's a basic idea that can be quite devastating when used the right way on a group of enemies.

    What does it do?
    When applied to a target, arcane burn is a powerful non-elemental damage over time effect which, on its own, is pretty powerful, but it also spreads to another target every time it deals damage, until all living targets have it. When it passes to a new target, its turn duration is the same as the target it came from. As you can imagine, this spreading could quickly become overwhelming to a large group of enemies.

    What do you need?

    No screenshot is necessary this week, as the state itself is pretty bland, with a 'remove on battle end' set and a turn duration of 6 turns. (adjust as necessary for yourself, of course). The main focus of this post is, as usual, the notebox:

    Code:
    <Reapply Ignore Turns>
    <Custom Apply Effect>
    if (target._burnDmg == undefined) {
     target._burnDmg = (200 + (origin.mat * 4)) * (1 + origin.isStateAffected(43))
    //state 43 is our overcharge state from months ago. This skill deals double damage when overcharged
    }
    </Custom Apply Effect>
    <Custom Turn Start Effect>
    //prevents the dot from triggering right after it is added to a second battler in the DTB
    user._burnOk = undefined
    </Custom Turn Start Effect>
    <Custom Turn End Effect>
    if (user._burnOk == undefined) {
    //damage effect
     var total = Math.floor(user._burnDmg * (0.8 + (Math.random()*0.4)))
    //the above line is adding 20% variance to the damage dealt
     performStateAnimationDmg(217, user, total, 0);
    //find new target
     var members = []
     var allies = user.friendsUnit().aliveMembers()
     for (i = 0; i < allies.length; i++){
      var potential = target.friendsUnit().aliveMembers()[i];
      if (!potential) continue;
      if (potential === target) continue;
      if (potential.isStateAffected(267)) continue;
      if (potential.hp <= 0) continue;
      members.push(potential);
     }
     if (members.length != 0) {
      var select = Math.floor((Math.random()*members.length))
    //grabbing a random members of the alive group
      members[select]._burnDmg = user._burnDmg
    //we set the damage value first, so the new target's burn effect is also overcharged if the first targets was
      members[select].addState(267)
    //add the state after, so that the damage isn't reset
      members[select]._burnOk = false
    //prevent the burn from dealing damage again until the targets next turn starts
      members[select]._stateTurns[267] = user._stateTurns[267]
    //set the duration of the new targets burn state to the duration of the old targets
     }
    }
    </Custom Turn End Effect>
    <Custom Remove Effect>
    target._burnDmg = undefined
    target._burnOk = undefined
    </Custom Remove Effect>
    This state also has a built in function to prevent it from skipping down an entire enemy troop at the end of a single turn of battle (using a turn based battle system), in that when it is added to a new battler, it remains inactive until that battler has started a turn. This should prevent the need for me to roll up two different states, like I had to do for Renewing Myst, earlier.

    That's all for this update. See you next week.
     
    #88
    bluebooth and Fernyfer775 like this.
  9. Fernyfer775

    Fernyfer775 Veteran Veteran

    Messages:
    1,299
    Likes Received:
    802
    First Language:
    English
    I just wanted to say that I absolutely LOVE this thread. I find myself coming here all the time to see what amazing new states you've created. Thank you so much for sharing this treasure trove with the community! :D
     
    #89
    ramza likes this.
  10. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    This week's state is a strategic doozy. Effigy turns an enemy target into an aoe machine. Anything that strikes the afflicted target also hits all of it's allies. And for our bonus, a special treat - an addon skill using a non-yanfly plugin (that totally works) to summon in an enemy with effigy on it, for you to smack around a bit, Soul Effigy.

    Turn your strong single target attacks into powerful non-elemental AOE attacks!

    What you need:
    Full description:
    The user places this state on an enemy. With our default set up, the next three actions that strike this enemy will have their damage effect duplicated to all other alive enemies. After three successful hp dealing attacks, the state is removed from the enemy. The best usage case for this is to have a weaker ally cast it at the start of a turn, and have your stronger characters smack the afflicted with strong single-target attacks, dealing massive aoe damage to all other foes.

    Our bonus skill changes this up substantially. Using the above mentioned himeworks plugin, our bonus skill SUMMONS in an enemy with this state already, and unsummons it when it's been hit three times. This adds another layer of possible player advantages:
    • The summoned enemy can have really low defensive stats, increasing total damage dealt to all targets
    • The summoned enemy can have no resistances to elemental damage, allowing an elemental attack to hit resistant enemies for full damage
    • The summoned enemy could be used for other player beneficial purposes, such as healing allies.
    • Note that states put on the effigy, or damage taken by states are not passed to its allies. In the case of summoning an effigy enemy, making it resist damaging states will serve to prevent the player from believing that states are effective.
    So first of all, the basic state:
    Code:
    <Custom Apply Effect>
    //This apply effect sets the number of hits that this state lasts for
    target._effHits = 3
    </Custom Apply Effect>
    <Custom React Effect>
    if (this.isHpEffect() && value > 0) {
    //The first step is to make sure this is a damaging attack
     target._effHits = target._effHits -1
    //Reduce the number of remaining hits by 1
     target._shareAmt = value
    //Determine the damage to be taken by all other enemies
     var allies = target.friendsUnit().aliveMembers()
    //this for sequence goes through all alive allies of the effigy target and damages them
     for (i=0; i < allies.length; i++){
      total = Math.floor(target._shareAmt * allies[i].elementRate(0))
    //elementRate(0) is non-elemental damage, change as needed.
      if (allies[i] != target){
    //this if condition prevents the effigy from damaging itself with the effect
       allies[i].gainHp(-total)
       allies[i].startDamagePopup()
       allies[i].clearResult()
       if (allies[i].isDead()){
        allies[i].performCollapse()
    //damage dealt, popup shown, target collapsed if dead, standard stuff here
       }
      }
     }
     if (target._effHits <= 0) {
    //This removes the state once three hits have been dealt this way
      target.removeState(269)
     }
    }
    </Custom React Effect>
    Since this state removes itself, it doesn't need to have a turn duration, although you could set one to be sure. Nothing else is needed for this to do its job.

    Bonus:
    Early set up:
    Straight off, this bonus skill won't work with the exact state we have above. The idea is that we're going to summon in an effigy target, instead of placing the state on an existing one. The effigy monster will already have the effigy state as a passive, which doesn't use apply or remove effects, so we can't easily set the ._effHits value. What we can do, however is put a state on the CASTER that summons the effigy, and then adds that value to the summoned monster.

    The modified state:

    Code:
    <Custom React Effect>
    if (this.isHpEffect() && value > 0) {
     target._effHits = target._effHits -1
     target._shareAmt = value
     var allies = target.friendsUnit().aliveMembers()
     for (i=0; i < allies.length; i++){
      total = Math.floor(target._shareAmt * allies[i].elementRate(12))
      if (allies[i] != target){
       allies[i].gainHp(-total)
       allies[i].startDamagePopup()
       allies[i].clearResult()
       if (allies[i].isDead()){
        allies[i].performCollapse()
       }
      }
     }
     if (target._effHits <= 0) {
      target._effOrigin.removeState(268)
     }
     if ($gameTroop.aliveMembers().length == 1 && $gameTroop.aliveMembers()[0] == target) {
      target._effOrigin.removeState(268)
     }
    }
    </Custom React Effect>
    <Custom Turn Start Effect>
     if ($gameTroop.aliveMembers().length == 1 && $gameTroop.aliveMembers()[0] == target) {
      target._effOrigin.removeState(268)
     }
    </Custom Turn Start Effect>
    The most notable differences between this version and the first version are:
    • The apply effect is gone (we'll get to that)
    • instead of removing the effigy state from the target when the ._effHits = 0, we are removing state 268 from ._effOrigin
    • We have two checks, one in the react effect, and one in the turn start effect that check to see if this effigy battler is the only surviving enemy, and then also remove state 268 from ._effOrigin
    • As you will find out later, removing state 268 from ._effOrigin unsummons the effigy monster.
    Next, we need the 'summoned' state. This is placed on the caster of the summon effigy spell, and sets the ._effHits and ._effOrigin values on the summoned enemy.
    Code:
    <Custom Apply Effect>
    //this if check is checking to see if an effigy has already been summoned
    if (!$gameTroop.isEnemyReinforcementAdded(50, 1, true)){
    //if the current enemy troop doesn't contain the effigy monster, it summons it in using the hime plugin
     $gameTroop.addEnemyReinforcement(50, 1)
    //this summons battler 1 of troop 50 (change to match your project)
     $gameTroop.members()[$gameTroop.members().length-1]._effHits = 3
     $gameTroop.members()[$gameTroop.members().length-1]._effOrigin = target
    //these two lines set up values we need to call back to when the effigy is finished
    }
    </Custom Apply Effect>
    <Custom Remove Effect>
    $gameTroop.removeEnemyReinforcement(50, 1)
    //when this state is removed from the caster, the effigy is unsummoned
    </Custom Remove Effect>
    So to recap:
    • Enemy 1 of gametroop 50 is setup to be the effigy and has <Passive State: 269> on it
    • Our caster casts 'Summon Effigy' which places state 268 on herself, which calls in the effigy enemy set up above
    • When the effigy has taken three hits, it removes state 268 from the caster
    • When the state is removed from the caster, the effigy is unsummoned.
    Enemy 1 in troop 50 should have a lot of HP, and low physical stats to facilitate harder hits on the enemies. Also, the summon effigy skill should have a cooldown to prevent the players from using it too often or quickly. The 'summoned effigy' state (268) should probably also have a turn counter removal set up, in case the player has multiple allies cast it at the same time, as only one effigy monster will be summoned, and one ally will permanently have the 'summoned effigy' state, otherwise.

    Please note that this summon effect does not work for enemies using it on the party, as enemy reinforcements cannot be summoned into the ally party.
     
    #90
    Fernyfer775 likes this.
  11. SergeX

    SergeX Veteran Veteran

    Messages:
    64
    Likes Received:
    14
    First Language:
    Portuguese
    Wonderful job here Ramza! Would be very hard to add some global effects to Hurricane like weather effects from Pokemon?

    My logic is: because it activates a storm, this state could boost wind and thunder damage by 10% and reduce earth damage by 20%. I know this effect can be easily done if it affects only the caster, but I am talking about triggering a global effect that affects both allies and enemies. If it's not hard and doesn't requer too much scripting knowledge, I would find somehow to do it.
     
    #91
  12. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    @SergeX You sure can.

    For the greatest ease of use, I recommend the following two plugins:

    With these plugins it's possible to inflict all active battlers, (allies and enemies) with an aura state when you use the hurricane spell, that changes the strength of their elemental skills. So you'll need a new state with the following note tags on it:

    Code:
    <Element Magnify x: -20%>
    <Element Magnify y: +10%>
    <Element Magnify z: +10%>
    (replacing those x,y and z values with the element Id of your earth, wind and lightning, respectively, of course).
    Next, on the hurricane state, just add the following note tag:
    Code:
    <Everybody Aura: x>
    Where x is the state Id of the state you just made above.

    If your new state doesn't have an icon, it won't be super obvious to the player that this is happening, either, which could be an advantage. The aura state is removed and applied automatically whenever the hurricane state becomes active, and will affect enemies and allies of the caster alike!
     
    #92
    SergeX likes this.
  13. SergeX

    SergeX Veteran Veteran

    Messages:
    64
    Likes Received:
    14
    First Language:
    Portuguese
    Whoa! You already came with a solution. This topic is pure gold and gives us always new tricks to play with. Thank you very much! I'll try this out.
     
    #93
  14. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    This week, we're continuing a trend I had going all along, but was only subconsciously aware of before, by covering a pretty simple state.

    This week, we're doing Shadow Word + Consuming Shadow!

    Shadow Word is a modified version of Prayer of Mending, in which a debuff sits on a an enemy target until it is struck by a damaging effect, at which time it deals some extra shadow damage, and hops to a different enemy. It will hop up to 6 times, or until there are no other valid enemies to hop to. Consuming Shadow is an active, instant cast skill that consumes the remaining Shadow Word stacks on a target to deal their remaining effect instantly, just like Quickmend does for Prayer of Mending.

    So without any other hold ups, here's our state!
    shadowword.PNG
    And the notebox for this state:
    Code:
    <Custom Apply Effect>
    this._shadowCharges = 6;
    this._shadowDmg = origin.mat * 4;
    this._origin = origin
    this.setStateCounter(280, 'x' + 6);
    </Custom Apply Effect>
    //this apply effect sets up our ShadowWord state to show a counter showing how 
    //many hops it has left. Change state Id 280 to whatever matches your project
    <Custom Remove Effect>
    this._shadowCharges = undefined;
    this._shadowDmg = undefined;
    this._origin = undefined;
    </Custom Remove Effect>
    //When removed it clears these values from the afflicted target to free up memory and whatnot
    <Custom React Effect>
    //when hit, it does a check to see if this was a valid attack
    if (this.isHpEffect() && this.isDamage() && target.hp > 0 && this.item().id != 355) {
    //if this was a skill that did HP damage, and wasn't skill 355 it will deal its effect
      var effect = Math.floor(target._shadowDmg * (((Math.random()*40)+80)/100)) * target.elementRate(9) || 1;
      target.startAnimation(230);
      target.gainHp(-effect);
      target.startDamagePopup();
      target.clearResult();
    //with damage complete, it's time to make the effect hop to another enemy
      var charges = target._shadowCharges - 1;
      var caster = target._origin
      target.removeState(280);
      if (charges > 0) {
        var members = [];
        for (var i = 0; i < target.friendsUnit().aliveMembers().length; ++i) {
          var potential = target.friendsUnit().aliveMembers()[i];
          if (!potential) continue;
          if (potential === target) continue;
          if (potential.isStateAffected(280)) continue;
          if (potential.hp <= 0) continue;
          members.push(potential);
        }
        var member = members[Math.floor(Math.random() * members.length)];
    //with a list of potential members found, randomly choose once of them to 
    //add the state on
        if (member) {
          member.addState(280);
    //once the state is added to the new target, the old values from the original target are 
    //transferred to the new target
          member._shadowCharges = charges;
          member._shadowDmg = effect;
          member._origin = caster
          member.setStateCounter(280, 'x' + charges);
        }
      }
    }
    </Custom React Effect>
    We added a little something extra in the if condition at the top of this state to check for skill Id 355, and not cause the effect to happen if this was found. Skill Id 355 is going to be our Consuming Shadows skill, and without this check, the state would end up dealing extra damage on top of the damage of Consuming Shadows, which we don't want. Change this number to whatever skill Id your Consuming Shadow skill ends up being, of course.
    Lastly, we have our skill:
    consuming shadow.PNG

    For this skill to work properly, you need to have YEP_InstantCast, and YEP_X_SelectionControl. We use instant cast to make this spell immediate, and selection control to make sure that the skill can only be used on a target that currently has the Shadow Word DoT effect on them. Remember to change the Select Conditions section to match the state Id of the Shadow Word state we just made.
    The important things about this skill are that it removes the Shadow Word state, and that it uses the targets shadowCharges in it's damage formula. In this case, I've used a pretty basic formula, where the attacker's mat is quadrupled, and the multiplied by the remaining charges of the state. Obviously, this will need to be balanced for your own project.

    That's all for this update folks, see ya next week.
     
    #94
    ashikai and Fernyfer775 like this.
  15. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Good afternoon folks. This week I've chosen to share the ultimate debuff state from my project Devil's Advocate.

    Here's a brief synopsis of what it does:
    • Once on a battler all foes of that battler take a damage over time effect at the end of their turn.
    • If a foe dies while this effect is active it is removed, placed on cooldown, and a powerful buff is added to the original caster
    For this effect, I used all the normal plugins, and also YEP_X_StateCategories. You will also need YEP_SkillCooldowns and YEP_X_ExtDoT.

    We will require three states for this effect to work. The Advocate state is placed on the caster when they use the skill. The Debuff effect is placed on all foes of the caster of the Advocate state. Lastly, the buff state is placed on the caster of the Advocate state when a foe is killed.

    So first, let's start with the Advocate state.
    advocatestate.PNG
    Code:
    <Custom Apply Effect>
    //check alive foes and add the debuff state to them
    var members = target.opponentsUnit().aliveMembers()
    for (i = 0; i < members.length; i++){
     members[i].addState(284)
    }
    </Custom Apply Effect>
    <Custom Turn Start Effect>
    var members = user.opponentsUnit().deadMembers()
    //this section is checking for any foes that died while
    //affected by the debuff
    for (i = 0; i < members.length; i++){
     if (members[i].isStateAffected(284)){
      //if there is a dead foe with the debuff state
      //the target died of a dot earlier
      user.addState(285)        //add the buff state to the caster
      user.removeState(283)     //remove the advocate state from the caster
      user.addCooldown(354, 8)    //add a cooldown to the skill for 8 turns
     }
    }
    </Custom Turn Start Effect>
    <Custom Remove Effect>
    //if the advocate state is removed, remove the debuff
    //state from all foes
    var members = target.opponentsUnit().allMembers()
    for (i = 0; i < members.length; i++){
     members[i].removeState(284)
    }
    </Custom Remove Effect>
    In the above code, we're working with three state Ids, and one skill Id. These need to be changed to work in your project. State 283 is the Advocate state. 284 is the debuff, and 285 is the buff state. Skill 354 is our skill that applies advocate to the caster, and is only put on cooldown when the effect is triggered. Note that the state itself expires after 8 turns, but this could also be removed entirely if one wanted.

    Next up, we have the debuff state:
    butts.JPG
    (side note, why can I only seem to attach one png file to a post?)
    And here is the paste code for this state:
    Code:
    <Category: Bypass Death Removal>
    //the above tag is necessary for the enemy death effect
    <Custom DoT Formula>
    variance = 20
    element = 9
    var baseDmg = (50 + (origin.mat * 4))
    value = Math.round(baseDmg)
    </Custom DoT Formula>
    <Custom Apply Effect>
    //this stores the origin of the state for later removal
    target._DAOrigin = origin
    </Custom Apply Effect>
    <Custom Turn Start Effect>
    //on turn start, checks if any allies are both dead,
    //and still affected by the debuff state
    var members = user.friendsUnit().deadMembers()
    for (i = 0; i < members.length; i++){
     if (members[i].isStateAffected(284)){
      //an ally died of a dot earlier
      user._DAOrigin.addState(285)
      user._DAOrigin.removeState(283)
      user._DAOrigin.addCooldown(354, 8)
     }
    }
    </Custom Turn Start Effect>
    <Custom Conclude Effect>
    //the conclude effect checks if the opponent party
    //still has a member with the advocate state
    var members = user.opponentsUnit().aliveMembers()
    for (i = 0 ; i < members.length; i++){
     if (members[i].isStateAffected(283)){
      var stillActive = true
     }
    }
    if (stillActive != true){
    //if no advocate exists in the enemy party, all allies
    //have the debuff state removed from them
     var allies = user.friendsUnit().allMembers()
     for (i = 0 ; i < allies.length; i++){
      allies[i].removeState(284)
     }
    }
    </Custom Conclude Effect>
    <Custom Deselect Effect>
    if (target.hp <= 0 && !target.isStateAffected(3)){
    //after being hit, checks to see if target is dead
     //he died give him the thing
     target._DAOrigin.addState(285)
     target._DAOrigin.removeState(283)
     target._DAOrigin.addCooldown(354, 8)
    }
    </Custom Deselect Effect>
    Because Damage over Time effects can't trigger a conclude effect, this state contains a bunch of extra checks to see if someone was killed by a damage over time effect (or other effect) between turns. Because this state bypasses death, and is only ever applied to living foes, no battler should be both dead AND affected by the debuff state, unless it was killed during the effect. When the check in the Turn Start of the advocate state, or the debuff state detects that there is a battler that is both dead, and afflicted with the debuff state, it proceeds to remove the advocate state (and the other debuff states), and gives the buff state to the original caster.

    Speaking of the buff state:
    soul eater.JPG
    There isn't much special going on in the buff state here. When a debuffed target dies, the caster gets +20% to all params for three turns. Simple as that.

    So to recap the whole process here:
    • Advocate buff is applied to the caster
    • All foes of the caster have the debuff state applied to them
      • Every turn end, the afflicted foes take a damage over time effect
    • If a foe is directly killed, or indirectly killed by another DoT effect, Advocate is removed from the caster
      • Removing Advocate from the caster also removes the debuff from all foes
      • The Soul Eater buff is added to the caster, for three turns
    Keep in mind, this effect was designed for use in Yanfly's CTB. In the DTB system, all turns end at the same time, so it's likely that the DTB will see all foes take one tick from the DoT effect at turn end, even if one of them died from it. In the CTB system, the first foe to take the DoT damage and die from it would instantly remove the effect from the others, preventing them from taking damage from it at all.

    That's all for this update folks.
     
    #95
    Fernyfer775 likes this.
  16. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    This week, following the pattern, we have a fairly simple reaction state, Static Charge! When static charge is placed on a battler, the next time it is hit by a physical attack, it discharges and blasts all of it's allies with lightning damage. As an effect added to one of your offensive lightning spells, this could be a pretty neat way to add some AoE damage to a single target spell effect.
    You could also have enemies who use this ability defensively, if they absorb lightning damage, the effect would heal them when they get hit! The possibilities are endless (not really though)!

    So what do we need for this?
    The state itself is nothing special. If you'd like, give it a turn end timing, if you want it to be able to dissipate harmlessly if not triggered within a certain amount of time, otherwise, make sure it's set to be removed after battle, give it an icon and you're all set.

    Here is the paste code for the note box:

    Code:
    <Custom Apply Effect>
    target._staticCharge = origin.mat * 2
    </Custom Apply Effect>
    <Custom React Effect>
    //check if the incoming attack was physical and did damage
    if (this.isPhysical() && this.isHpEffect() && value > 0) {
     //triggered
     var members = target.friendsUnit().aliveMembers()
    //get alive party members for incoming damage
     for (i = 0 ; i < members.length; i++){
    //loop through each alive party member and deal damage with animation
      performStateAnimationDmg2(76, members[i], (Math.floor((target._staticCharge) * ((Math.random()*40)+80)/100)), 4);
     }
    target.removeState(281)
    //clear the effect from our target
    }
    </Custom React Effect>
    <Custom Remove Effect>
    //when the effect is removed, clear the value from the variable
    target._staticCharge = undefined
    </Custom Remove Effect>
    That's all for this update folks. See ya next week.
     
    Last edited: Apr 24, 2017
    #96
  17. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Good afternoon folks.

    This week we have a little passive state I drafted up for use of my shinobi class in my own project. Expose Weakness causes the target to take increased damage from successive hits by the battler who applied it. It can be only on one target at a time, and is automatically stacked up as the attacker damages the defender. If multiple sources of this state exist, they do not stack, meaning that if you have two shinobi in your party, and they are both attacking the same enemy, the effect will not retain stacks between attackers.

    This state is actually two states, the first is a passive that goes on the attacking shinobi, the second is the 'debuff' state that goes onto the target of a successful physical hit. It is also probably important to note, that if the shinobi hits the target multiple times with one action, the state will stack up for each hit in that action.

    What you need:
    • The usual plugins
    Our first state is the passive state. While it is active on our attacker, they will apply the debuff state to the target. This passive is also where our bonus damage is added.

    upload_2017-4-30_15-56-10.png

    As you can see, this part of the effect is mostly invisible to the player. Our paste code for this is below:

    Code:
    <Custom Confirm Effect>
    if (this.isPhysical() && this.isHpEffect() && value > 0){
    //if this was a physical skill, and did at least 1 damage
     target.addState(298)
    //give the target the debuff state
     var bonus = target.getStateCounter(298) * 0.02
     value = Math.round(value + (value * bonus))
    //we get 2% bonus damage per stack of the debuff state
    }
    </Custom Confirm Effect>
    Next, we have our debuff state, which is applied when a physical attack connects by a battler affected by the passive above:
    upload_2017-4-30_15-59-46.png

    Our state code for this one is a tiny bit more complicated.
    Code:
    <Custom Apply Effect>
    //this is checking if the target already has the state or not
    //if this value is undefined, the target hasn't been afflicted before
    if (target._EWOrigin == undefined){
     target._EWOrigin = origin
    }
    //adds counters based on number of stacks, up to 5
    //this starts at 0 stacks on the first application
    if (target.getStateCounter(298) == undefined || target._EWOrigin != origin) {
     target.setStateCounter(298, 0)
     target._EWOrigin = origin
    }else{
    target.addStateCounter(298, 1);
    if (target.getStateCounter(298) > 5) {
     target.setStateCounter(298, 5);
    }
    var allies = target.friendsUnit().aliveMembers()
    //get a list of alive allies
    for (i = 0; i < allies.length; i++) {
     if (allies[i] != target){
    //if any alive allies also have the debuff
    //remove it from them
      allies[i].removeState(298)
     }
    }
    }
    </Custom Apply Effect>
    <Custom Remove Effect>
     target._EWOrigin = undefined
    </Custom Remove Effect>
    In depth description:
    • Battler with passive state connects with a physical skill on a target
    • Target is given the debuff state
      • Adds a stack of the counter, starting from 0
      • if the origin of the debuff was not the original origin of the state, reset stacks to 0
      • if any other allies of the target have the debuff state, remove it from them
    • Damage is calculated, and a bonus 2% is given for each stack of the state counter, starting at 0% for the first application of the debuff.
    • The debuff has a maximum stacks limit of 5 stacks, for 10% bonus damage
    The effect stacks up every time a physical hit occurs, a double or triple attack skill will put two or three stacks on the target, for example.

    That's all for this update. See ya next week.
     
    #97
    ashikai and SergeX like this.
  18. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Greetings and salutations fellow state-makers.
    Tonight I bring to you a fairly simple state, that can have very complex uses. I present Void Effect.

    Void Effect is a state that is added to an offensive spell (as a feature of the spell, actually), which takes the damage dealt by that spell, and restores the HP of the target by that much on the start of it's next turn. But why would you want to do this? This could be an effective boss mechanic to make the player panic, by dealing a large chunk of their HP (maybe 99% of it?), only to restore it back the next turn.
    In my project, Void element spells deal a percentage of the target's current Hp (like gravity spells in final fantasy games), this could be effectively used to cut an enemy's effective health in half, so your allies can kill it a round earlier than they could have without. The possibilities are quite vast, actually.

    Anyways, here is the state itself:
    upload_2017-5-8_2-38-9.png

    And the paste code:
    Code:
    <Custom Apply Effect>
    if (target._voidDmg != undefined){
    //make sure a void effect was set by the skill
     if (target._voidEffects == undefined) {
     //if this is the first void effect on the target, we need set up
     //we're defining an array to keep track of multiple applications
      target._voidEffects = []
      target._voidOrigins = []
    //since this is the first application, we start at element 0
      target._voidEffects[0] = target._voidDmg
    //we're also tracking the origin of the application for something else
      target._voidOrigins[0] = origin
     } else {
    //if this else case happens, that means this isn't the first void effect currently on the target
      target._voidEffects[target._voidEffects.length] = target._voidDmg
      target._voidOrigins[target._voidOrigins.length] = origin
    //so we add a new element to both arrays
     }
     target._voidDmg = undefined
    //then we undefine the voidDmg variable for future use
    }
    </Custom Apply Effect>
    <Custom Turn Start Effect>
    var totalRecovery = 0
    //on turn start we loop through all applied void effects and total up the total of them all
    for (i = 0; i < user._voidEffects.length ; i++){
     /*if (user._voidOrigins[i].isStateAffected(287)){
      var healamt = Math.floor(user._voidEffects[i] / 10)
      user._voidOrigins[i].gainHp(healamt)
      user._voidOrigins[i].startDamagePopup()
      user._voidOrigins[i].clearResult()
     }*/ //we'll come back to this section in a moment
     totalRecovery += user._voidEffects[i]
     
    }
    //after looping through all void effects, the total is restored to the target
    user.gainHp(totalRecovery)
    user.startDamagePopup()
    user.clearResult()
    user.removeState(286)
    user._voidEffects = undefined
    user._voidOrigins = undefined
    //then the state is removed, and the arrays cleared
    </Custom Turn Start Effect>
    Our paste code is kind of complicated, for what should be a pretty simple state, right? Also, what's with the block in the middle bit there? Well that's our bonus effect (I haven't done one of these in a while, right?) We'll get to that in a bit though. One very important thing about this state, is that it does nothing of target._voidDmg doesn't exist. We never define that variable in the state, right? So that means it needs to be defined on the skill that applied the state somewhere. The easiest way is to put it in an action sequence, but in the spirit of changing it up sometimes, you can instead put this note tag on ANY skill, with or without an action sequence, and it should do the job:
    Code:
    <Pre-Damage Eval>
    target._voidDmg = value
    </Pre-Damage Eval>
    Alright, so with all that in your project, you've got a skill that applies a state, that restores the Hp dealt by the skill back to the target at the start of their next turn, pretty sweet, eh? Well let's add a little bonus to that. A passive state that causes about 10% of the Hp restored by the void effect to also be restored to the original caster of that void effect! Take a look back up there in that state paste code at the part between the asterisks:
    Code:
    if (user._voidOrigins[i].isStateAffected(287)){
      var healamt = Math.floor(user._voidEffects[i] / 10)
      user._voidOrigins[i].gainHp(healamt)
      user._voidOrigins[i].startDamagePopup()
      user._voidOrigins[i].clearResult()
     }
    This section of the loop is checking the origin of each void effect, in order, for stateId 287 - and if it's found it's restoring 10% of the amount of that void effect to the origin (state 287 doesn't actually have any code on it, this part of this state handles all of that). But why would we want that? Well in one of the examples I gave at the start, the boss fight that makes the player panic with his high HP skills, only to have the hp given back the next round is neat, but it's kind of a one-trick pony. What if that same boss also restored his own Hp when he gave back the party's? Well then , my friends, you create strategy. The player would need to strike a balance between being low hp, and being high enough to survive, because being full hp might restore too much to the boss. (don't forget to take the /* */ out of the paste code for the extra state if you use it).

    That's all for this update. See ya next week.
     
    #98
    feckyeslife likes this.
  19. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Happy Monday everybody!

    Today I bring a state that has a very simple concept, but winds up with a real complex execution. Zealotry is a spell that spreads certain beneficial spell effects from the caster to all of his allies. Of course, you know where you're reading this from, so it does that using a custom state!

    What you need:
    So first of all, how does this work? Well, we're using the YEP_X_StateCategories plugin to assign every single state we want to transfer to a category, this makes finding them all much, much easier. In this case, each of my transferable states are labeled with the note tag <Category: ZEALOTRY>, which tells the script that they can be transferred with this skill. Secondly, any state transferred in this was has the following done to it on the new target:
    • The origin is set to the correct origin of the initial state on the caster
    • The turn duration of the state is set to be the same as that of the same state on the caster
    • Any extra values needed for the state to work correctly are also transferred to the target, on a case by case basis.
    upload_2017-5-15_14-35-6.png

    As you can see, the state itself doesn't have anything special on it. After doing it's job, when applied, it is removed immediately from the user.

    Here is our note tag paste code:
    Code:
    <Custom Apply Effect>
    var list = []
    //our first for loop is getting an array of all of the states tagged with ZEALOTRY
    for (i = 1; i < $dataStates.length; i++) {
     if ($dataStates[i].category.contains('ZEALOTRY')) {
      list.push($dataStates[i].id)
     }
    }
    var passed = []
    var total = target._states.clone()
    //This section is making a new array, which contains states that are both in
    //the list of transferable states, AND are currently applied to the caster
    var allies = target.friendsUnit().aliveMembers()
    for (i = 0; i < total.length; i++){
     if (list.contains(total[i])) {
      passed.push(total[i])
     }
    }
    //the below for loop is adding each state from the array of states that passed the
    //first two checks, to each alive ally.
    for (i = 0; i < allies.length; i++) {
     if (allies[i] != target){
      for (count = 0; count < passed.length;  count++){
       allies[i].addState(passed[count])
       for (lc = 0; lc < list.length; lc++) {
        if (passed[count] == list[lc]){
    //this section is making the _stateTurns and _stateOrigins arrays for the new skill
    //equal on the new target as it was on the original target
         allies[i]._stateOrigin[list[lc]][0] = user._stateOrigin[list[lc]][0]
         allies[i]._stateOrigin[list[lc]][1] = user._stateOrigin[list[lc]][1]
         allies[i]._stateTurns[list[lc]] = user._stateTurns[list[lc]]
    //this section is adding values and variables specific to specific states
    //for this example, we are defining the damage variables, and mending
    //charges for my enflame and Prayer of Mending states.
      if (passed[count] == (209)){
           allies[i].enflameDmg = user.enflameDmg
           $gameVariables.enflameDmg[allies[i].actorId()] = allies[i].enflameDmg
      }
      if (passed[count] == (236)){
          allies[i]._mendingCharges = target._mendingCharges;
          allies[i]._mendingHeal = target._mendingHeal;
          allies[i]._origin = target._origin;
          allies[i].setStateCounter(236, 'x' + allies[i]._mendingCharges);
      }
        }
       }
      }
     }
    }
    //after the application work is complete, remove zealotry from the caster
    target.removeState(stateId)
    </Custom Apply Effect>
    So, what we have here is a state that will dynamically grab a list of all states marked with <Category: ZEALOTRY>, check the caster to see if he has any of them, and then apply those states to all of the caster's allies. It sets the origin of the new applications of these states to be the original origin of the state on the caster, so we won't run into problems with damage formulas tracking the params of the caster of Zealotry, rather than the params of the actual caster of the state. It also sets the remaining turns on the applied states to be equal to the number of turns for that same state on the caster.
    While it has support for more customized states, as seen above, with the enflame and Prayer of Mending states, there is some extra setup required by these states to work properly, namely the adding of custom variables defined in those states (or in the skill that applies those states). Enflame, for example, required the damage for the state to be assigned to user._enflameDmg, in order to pull that info back later to deal damage. While the actual state will create this info on its own, it does this when the state is applied, and therefore will grab the wrong origin to check for the damage formula, so it must be overwritten.

    This skill can also easily be rewritten to affect an enemy of the caster, to spread a variety of negative states to all of the target's allies. We might come back to that a little later, though.

    That's all for today.
     
    #99
    feckyeslife likes this.
  20. ramza

    ramza Lunatic Coder Veteran

    Messages:
    540
    Likes Received:
    295
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Greetings state workshop patrons. This week I bring a much simpler state to the table, Water Shield. Water Shield is one of four elemental spellshield skills I have in my own project, and the third of which I've posted in this thread. Water Shield restores Mp to the afflicted battler when they are hit by a physical attack. This effect will only happen once per action, so a target that is hit multiple times in a row by a multi-hit skill will only recover Mp once. The Mp restored is equal to 10% of the damage of the attack that triggered it.

    upload_2017-5-21_14-16-30.png
    Here is our paste code:
    Code:
    <Custom React Effect>
    if (this.isHpEffect() && this.isPhysical() && !user.isStateAffected(224)){
     user.addState(224)
     target.startAnimation(190, false, 0)
     target.gainMp(Math.max(Math.floor(value/10), 1))
    }
    </Custom React Effect>
    As you can see, in a departure from the usual, our state is actually quite simple this time around. To make up for this, I will share the fourth of the elemental shield spells from my project, Ice Shield, which debuffs the attacker's agility when they hit the afflicted with a physical attack:
    upload_2017-5-21_14-22-48.png
    Code:
    <stateDescription:The air around you is chilled.>
    <Category: Positive>
    <Custom React Effect>
    if (this.isHpEffect() && this.isPhysical() && !user.isStateAffected(224)){
     user.addState(224)
      user.addDebuff(6, 2)
      user.addDebuff(6, 2)
     target.startAnimation(189, false, 0)
    }
    </Custom React Effect>
    Keep in mind that both of these states are using state Id 224 as a lockout, to prevent the state effect from happening more than once on a single action. There is nothing fancy about the state, except that it is automatically removed after 1 turn end. This effectively stops the effect from triggering more than once per turn of the attacker, which makes balancing easier. As state 224 is placed on the attacker, and is checked on the reaction effect, it will make it so that the effect can only trigger one per attacker, per turn, resetting at the end of their turn. In a time based battle system like the CTB, if an enemy can hit you multiple times in between your actions, it will trigger the shield effect multiple times.


    That's all for this update, folks. See ya next week.
     
    Last edited: May 22, 2017
    feckyeslife likes this.

Share This Page