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

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

  1. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV


    Maybe there's an easier way if you add a state check to all Resurrecting spells (in case you don't have many).



    Yeah I just realised that Yanfly's Target Core doesn't apply to states, so it's probably complicated without further programming.



    Back in RPG Maker XP when it was easier to modify the code I remember that I had this state working. I just had to go to the part where states where applied or removed and add a simple line where it checked if this state was on. Right now with MV I don't know if that would be as easier.



    The main idea was having this as an ailment, the name was just improvised right now :p  But the power-up thing might be an interesting add-on and would make the classic Turbo MP more dynamic.



    I am familiar with the Invisibility state from FF6, but I think that it would be better to make the battler non-targetable (which wouldn't be too hard since Yanfly already did a Tips & Tricks on the Jump ability, which does exactly that) than making the enemy miss since this way they wouldn't lose their action but target another ally. Having skills only usable during Stealth is a good add-on which has been always used in a variety of games (Back Stabbing for example)





    Thanks again for your kind attention and hard-work for this community :)
     
    #41
  2. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    @Iqus


    Mental Charge is, as I thought, really easy to implement.


    You require the skillcore plugin to use this. Skill core includes the ability to set custom Mp costs for spells. You add the following tag to every spell that should be affected by this effect:



    Code:
    <Custom Mp Cost>
    if (user.isStateAffected(19)){
    cost = cost * (1+(0.05 * user._stateTurns[19]))
    }
    </Custom Mp Cost>

    This increases the base cost of the spell by 5% * the number of turns remaining on state Id 19. State Id 19 has nothing fancy on it, just an icon and a 'remove after x turns' setting.



    Dizzy is a bit more complex than I thought, since target core/selection control can't be used on states in that way. I made an attempt at an action sequence to set the scope of the skill to '1 random enemy' if it detected the state, but it appears that even during the setup action, the target is already known, so the scope being changed doesn't have an effect. I think we'd need some sort of plugin to force a state to cause single target attacks to switch to '1 random enemy' scope when used by someone affected by them. I'm not sure how to go about doing that.


    I'll update with the stealth state in a little bit.
     
    Last edited: Mar 20, 2017
    #42
  3. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    @ramza Isn't that a bit overcomplicated to use that for every spell in the game? Isn't there a way to make it a state which increases all MP cost by N*5%?
     
    #43
  4. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I can get that to work, but it has a slight disadvantage over the other method in that I have to modify the state in the database at runtime, which causes multiple applications of the state with different turn counters to go haywire. Nevertheless, if you'd prefer that method:

    mentalcharge.PNG



    Code:
    <Custom Apply Effect>
    var bonus = target._stateTurns[21]
    $dataStates[21].traits[0].value = (1 + (0.05 * bonus))
    </Custom Apply Effect>
    <Custom Turn End Effect>
    var bonus = target._stateTurns[21]
    $dataStates[21].traits[0].value = (1 + (0.05 * bonus))
    </Custom Turn End Effect>

    Unfortunately, it doesn't look like there's a way to make AoE attacks hit a battler that is affected by stealth. The closest I can do with that is to make only magical attacks able to target him, but that allows single target attacks to do so as well. A slight workaround to this might be to make the actors TGR really low, and hope the battler AI doesn't target him at all.

    Stealth.PNG



    Code:
    <Cannot Select: Physical Hit>
    <Cannot Select: Certain Hit>
    <Custom Apply Effect>
    target.spriteOpacity(60,20)
    </Custom Apply Effect>
    <Custom Confirm Effect>
    if (this.isHpEffect() && this.isPhysical()) {
     value = (value * 2)
     user.removeState(22)
    }
    </Custom Confirm Effect>
    <Custom Remove Effect>
    this.spriteOpacity(255,20)
    </Custom Remove Effect>

    Note that I also made it so that the stealth effect makes the battler partially transparent until it is removed. It also only removes itself if a physical action is performed, and it causes that action to do double damage. Modify as needed.
     
    Last edited: Mar 20, 2017
    #44
  5. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    @ramza I tested both states and one of them seem to run into an error.


    With Mental Charge, after the state is applied all skills appear with a NaNMP, the affected cannot even Attack or Guard, maybe it is adding MP cost even to skills that have no cost?


    Stealth works good, however, I find that if the battler know any magical spells it might be overpowered since you can spam magic from the shadows without any consecuences. With my little knowladge I made slight modifications to make it disappear if the action was hurtful, that means however that the battler can safely use certain hits and maybe healing spells while in Stealth


    <Cannot Select: Physical Hit>
    <Cannot Select: Certain Hit>
    <Custom Apply Effect>
    target.spriteOpacity(60,20)
    </Custom Apply Effect>
    <Custom Confirm Effect>
    if (this.isHpEffect()) {
    if (this.isPhysical()) {
     value = (value * 2)
    }
     user.removeState(stateId)
    }
    </Custom Confirm Effect>
    <Custom Remove Effect>
    this.spriteOpacity(255,20)
    </Custom Remove Effect>


     Any better ideas on how to bypass this?


    Edit: also, the Stealth effect needs a 'Remove by damage' so when hit by a magic attack the state will go away.
     
    Last edited by a moderator: Sep 18, 2016
    #45
  6. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm not having that problem. My thoughts on how you are experiencing this are that one of the $dataStates[21].traits[0].value = (1 + (0.05 * bonus)) lines has an incorrect state ID causing the state to try to change it's value to something that is undefined.


    If you want to remove stealth on any type of action, the easiest way to do this is to just remove that if condition entirely, and only deal increased damage if the attack was physical. That would look something like this:


    Code:
    <Custom Confirm Effect>
    user.removeState(22)
    if (this.isPhysical()) {
     value = (value * 2)
    }
    </Custom Confirm Effect>

    To remove it after being hit, add in the following tag:


    Code:
    <Custom React Effect>
    target.removeState(22)
    </Custom React Effect>

    You can also use some conditionals to make sure it isn't removed by a healing spell or a debuff:


    Code:
    <Custom React Effect>
    if (this.isHpEffect() && value > 0){
      target.removeState(22)
    }
    </Custom React Effect>



    Now, let's get to this week's workshop state.


    This week I am showcasing a special type of states, the added effect. These states are special in that they cause an effect to happen after another action has taken place. The state this week is enflame, a single target buff spell that causes extra fire damage on a foe after being attacked.


    This state is surprisingly technical, and I've already found a non-yanfly plugin that broke compatibility with it (an outdated plugin that I'm still using in my project), so it's possible it might not entirely work for you. Let me know if there are any issues on your end.


    How Does it Work?



    This particular skill can be cast by one actor to affect another actor. When the affected actor makes a physical attack, the conditions for this state become true, and some extra fire elemental damage is dealt to the target. This has a separate animation, and a separate damage popup.


    What you Need:
    • The usual plugins
    • A skill to apply the state
    • One state
    Bonus:

    I will include a more in depth explanation of the spaghetti code I've used and what each part of it does, to facilitate more easily using it for your own states.


    The skill:


    For this effect, I have a single target buff spell that can be used on the caster's allies. It doesn't really have anything special in it, aside from giving the state to the ally.


    [​IMG]


    Next we need to make our state.


    [​IMG]


    This state expires after a number of turns, like a lot of my states. Otherwise, the state itself does basically nothing. All of the effect is held in the note tags below:


    Code:
    <Custom Apply Effect>
    target.enflameDmg = (origin.mat * 4)
    // The above line sets the damage of the added effect
    // origin is the caster of the spell, in this way the spell can have its
    // damage be based on the casting stats of the actor who applied it
    if (target._name == origin._name){
     target._stateTurns[209] = target._stateTurns[209] + 1
    // For this skill, I have made it so that if the caster uses it on himself
    // its duration increases by one turn.
    // In the CTB battle system, the actor's turn ends as soon as his action is
    // over, causing the effect to last one less action than if he'd put it on
    // someone else
    }
    </Custom Apply Effect>
    <Custom Conclude Effect>
    if (target.result().isHit() && this.isHpEffect() && this.isPhysical() && target.hp > 0) {
     user.enfOn = true
     user.enfTarget = target
    // This if statement is checking to see if the requirements for enflame have
    // been met. Because we can't interrupt the action just yet, this local variable
    // is set on the user to denote that the effect will be triggered.
    // This also doubles in preventing the effect from happening multiple times on
    // multi-hit skills
    }else if (user.enfOn != true){
     user.enfOn = false
     user.enfTarget = null
    // This else statement is preventing the added effect from not being applied,
    // if multiple actions had been taken, but the last one didn't meet the requirements
    // eg. if a three hit attack had the third hit miss.
    }
    </Custom Conclude Effect>
    <Custom Action End Effect>
    if (user.enfOn == true && !user.enfTarget.isDead()) {
    // If the effect was triggered, and the intended target isn't dead
      var extraFramesToWaitFor = 15;
      var animFrames = ($dataAnimations[66].frames.length * 4) + 1 + extraFramesToWaitFor;
      var waitSeconds = (animFrames/60) * 1000;
    // These variables set up our wait time, which allows the animation to play before
    //  the damage popup shows up.
      user.enfTarget.startAnimation(66, false, 0);
    //Show the battle animation Id 178
      setTimeout(function () {
    // everything below this line happens on a delay equal to waitSeconds above
        var total = Math.floor(user.enflameDmg * target.elementRate(2))
    // the above line adjusts the damage for elemental resistances
        user.enfTarget.gainHp(-total); // deal damage
        user.enfTarget.startDamagePopup(); // show the damage being dealt
        user.enfTarget.performDamage(); // makes the affected battler do its damage pose
        if (user.enfTarget.isDead()) {
            user.enfTarget.performCollapse(); // kill the battler if it is now dead
        }
        BattleManager.checkBattleEnd(); // end the fight if this was the last unit alive
           setTimeout(function () {
    // this second timeout waits 3 seconds after the damage popup and moves the
    // affected battler back into position after having been hit
            user.enfTarget.performActionEnd()
        }, 180);
      }, waitSeconds);
      BattleManager._logWindow._waitCount += (animFrames + 30);
    // the above line makes the entire battle system wait for the specified time
    // in this case, we add 30 frames to it, to ensure an enemy doesn't take an action
    // while the damage popup is still on screen
      user.enfOn = false
    // after the effect is complete, turn the local variable off, so it won't
    // trigger again on the same action.
    }
    </Custom Action End Effect>

    Also, here is an action sequence for the skill, as mine is fancy and I don't mind sharing it :)


    Code:
    <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
    motion attack: target
    action animation: target
    wait for animation
    action effect: target
    </target action>
    <finish action>
    perform finish
    clear battle log
    immortal: targets, false
    reset camera
    reset zoom
    wait for camera
    camera clamp on
    </finish action>
    How it looks:
    See for yourself

    That's all for this update.


    ~Ramza
     
    Last edited: Mar 20, 2017
    #46
  7. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    @ramza Mental Charge: Yeah, I made an amateur mistake there, just copy and pastying. I usually put stateId instead of the number to avoid this kinda problems 'cause the plugin recognizes stateId as the ID of the state the code is in. It works perfectly now, thanks :)


    Stealth: Also working to perfection, although the state is not removed when using Certain Hits, which for now it's not a problem.


    Enflame: This new state looks awesome, I'm getting an 'Unexpected end of input' when applying the state though, could something have been lost when posting it?



    I just remembered that by default, RPG Maker can make a state give you immunities to states.... That sould be the easiest way to do it I guess.
     
    #47
  8. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    You're right, I pasted the code into a different project and got the same error. I missed a bracket somewhere, but when I pasted it right out of the project again into the new one, it worked fine, so it must've been lost in the formatted somehow. When I post the state on sundays on the blog, I tend to copy paste the text right into here on mondays, and the plain text format goes weird and loses line breaks.


    I also corrected a different issue with it, where I used 'target' instead of 'user.enfTarget' which caused the added effect to always happen to the user instead of the target. XD The paste code has been updated.


    Edit: about lock, if you make an actor immune to states, it also removes any of those same states they have on them. I think there's a different way to set this up.
     
    Last edited by a moderator: Sep 20, 2016
    #48
  9. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Works perfectly now :)  Love how the effect is added to all atacking skills!


    Didn't thought about that with the Lock state, I don't have much experience with MV.
     
    #49
  10. Past Midnight Gaming

    Past Midnight Gaming The Midnight Dragon Veteran

    Messages:
    93
    Likes Received:
    30
    Location:
    The Milky Way
    First Language:
    English
    Love that action sequence it looks great. Question, one of my characters uses a summon skill as his main skill I had made a rather sloppy and common event filled way of using a state to put the summon on a timer. Is there a way to one summon another actor using only a spell and state and can you gain an additional buff (like one of the bard skills)?
     
    #50
  11. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I'd say that depends on how the summon skill works in the first place. I think you can eval some code into an action sequence to add an actor to the party, but that probably only works if there's an empty space in the battle party. From there it'd be pretty easy to add a state to the 'summoned' actor, and modify that state so that it gives an aura-type buff to all the other party members similar (but different) thajn the bard song abilities.


    I'd say it's also possible for that state on the summoned actor to 'unsummon' him after it expires, if that's what you were going for, too.
     
    #51
  12. Past Midnight Gaming

    Past Midnight Gaming The Midnight Dragon Veteran

    Messages:
    93
    Likes Received:
    30
    Location:
    The Milky Way
    First Language:
    English
    That's exactly what I'm looking to do. My problem is that I have no idea how to code that. The battle party isn't a problem since he is a one man party (the reason he uses summons)
     
    #52
  13. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I have a summon skill that calls an actor into the party. The actor is given a timed state that, once expired, removes him from the group. The actor also gives an aura buff, which is also removed when they are removed from the group. In the event of the summon dying, They are removed from the group at the end of the turn they died in. The state and aura are removed as well.


    The skill:


    summon elf skill.PNG


    The action sequence for the skill:


    Code:
    <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
    eval: $gameParty.addActor(5);
    wait: 15
    camera focus: character 5, 20
    wait: 20
    action animation: character 5
    animation wait: 10
    eval: $gameActors.actor(5).setBattlerImage('Actor2_6');
    wait for animation
    action effect: character 5
    </target action>
    <finish action>
    perform finish
    clear battle log
    immortal: targets, false
    reset camera
    reset zoom
    wait for camera
    camera clamp on
    </finish action>

    During this sequence, we change the battler graphic of actor 5, our summon. By default, this actor will have no battler graphic, to make the summon animation more... pretty.


    We are also going to prevent the caster from trying to summon the same summon more than once, so while the summon's aura state is active on the caster, we will prevent the use of that skill using the following tags:


    Code:
    <Custom Requirement>
     if (user.isStateAffected(25)) {
      value = false
     }else{
      value = true
     }
    </Custom Requirement>

    The summoned elf actor:


    summoned minion.PNG


    Note that the battler graphic is blank.


    Here's our timer state, applied to the battler as soon as it is summoned:


    timedsummonstate.PNG


    And here is the notetag code for this state:


    EDIT: I forgot to mention that this state requires yanfly's state categories plugin to function.


    Code:
    <Category: Bypass Death Removal>
    <Custom Apply Effect>
    for (i = 0; i < $gameParty.members().length; i++){
     $gameParty.members()[i].addState(25)
    }
    target.removeState(25)
    </Custom Apply Effect>
    <Custom Remove Effect>
    for (i = 0; i < $gameParty.members().length; i++){
     $gameParty.members()[i].removeState(25)
    }
      var extraFramesToWaitFor = 15;
      var animFrames = ($dataAnimations[102].frames.length * 4) + 1 + extraFramesToWaitFor;
      var waitSeconds = (animFrames/45) * 1000;
      target.startAnimation(102, false, 0);
      setTimeout(function () {
      $gameActors.actor(5).setBattlerImage('');
      }, waitSeconds);
      BattleManager._logWindow._waitCount += (animFrames + 30);
    $gameParty.removeActor(5);
    target.removeState(24)
    target.recoverAll()
    </Custom Remove Effect>
    <Custom Turn End Effect>
    if (this.isDead()) {
     this.removeState(24)
    }
    </Custom Turn End Effect>

    And lastly, here is our aura state - the buff provided to all other battlers when this summon is out:


    summoned aura state.PNG


    How does it look?


    See for yourself :)
     
    Last edited: Mar 20, 2017
    #53
    Past Midnight Gaming likes this.
  14. Past Midnight Gaming

    Past Midnight Gaming The Midnight Dragon Veteran

    Messages:
    93
    Likes Received:
    30
    Location:
    The Milky Way
    First Language:
    English
    Perfect! Thanks a ton! time to put together some crazy summons.
     
    #54
  15. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    I'm just gonna throw some more ideas here if you allow me :)


    Shadow Form: This state comes from Warcraft. The healer enters shadow form, while in this form, curative spell cause harm to the target. I guess this would be as easier as adding all healing spells from the user to have a state check that multiplies the damage output by -1, but maybe you can come with a better idea. As a bonus, this could make healing spells actually heal the undead or those under the Zombie state.


    Virus: Everytime the affected suffers damage, maxHP turns into current HP, making it imposible to heal the target. This comes from Final Fantasy 4 if I'm not mistaken. Really interesting, could be cool as an MP version as well.


    Clumsiness: The affected cannot use items. This should be easy but by default I think the item command cannot be sealed.


    Magic Blindness: A blind effect that reduces magic success rate.


    Blade Stop: This is a state from Ragnarok on-line. When used, both the user and the target become immovilized for the same ammount of turns. For balancing purpouses, I would make the duration something similar as Cyclone from Yanfly's Tips & Tricks, that the more you use it the less it lasts.


    Kidnap: That's an idea of mine. You select a target and it will disappear until all other enemies are defeated. Could be useful to separate a healer from it's party.


    Opportunism: This is a complex one and works in a similar way to a counter. Every time an ally performs an attack, the user has a chance of tagging along and attacking after him/her.


    That's all I have to offer :)  I won't demand any other states for a while now, don't want to overwhelm you :D  
     
    #55
  16. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm actually working on making a very similar state for my own project. The best way I have found to implement this is to have some skills that are already known, but only become active when the state is active, while disabling the healing skills.

    This sounds pretty simple to implement. Of course, I'd need to save the removed MHp as a temporary variable in order to restore the missing Hp when the state is removed, but that shouldn't be too hard.

    I think I can lock items using another addon, I'm not sure which one particularly, but I'm sure I can figure it out.

    I don't think I can change the failure rate of spells. Magic attacks don't use the accuracy stat.

    Making this effect probably isn't too hard, but animating it in a way that would make it look decent would be a challenge I think.

    I have an idea of how to do this, but preventing a gameover/battle end when the kidnapped ally/enemy is the only remaining battler on that side might be weird.


    I think the smart thing would be to make the target untargetable, and opacity to 0% so they look like they're gone entirely, and then remove the state after so many turns, or when they are the only battler left.

    Normally I'd say that this could be doable as an added effect type state, but I know from previous experiences that forced actions on states don't work very well in the engine, so compatibility with the ATB and CTB systems might be impossible to keep. Unfortunately, forcing an action is the only way to get another battler involved in the action sequence of another.
     
    #56
  17. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV


    The HIT and EVASION rate plugin had some option about Magic success rate, not certain of what can be done with that though.



    So a bit like Stealth but with complete opacity and action restriction. Is it possible to make it go away when all other allies are defeated?



    So the only way to attain this effect would be adding to every attack a random number checker and a condition that checks that the battler is in the party and alive and force it to attack the same target, right?


    I think I might have run into a bug with your Bleed state. An enemy died by it but was still selectable as an enemy and still acting, so it's like it never died and became invencible. I checked the code and changed this


    if (this.isDead()) //collapses the target if it is dead after damage
    {
    this.performCollapse();




     into this


    if (target.isDead()) //collapses the target if it is dead after damage
    {
    target.performCollapse();




    and now it seems to work perfectly. 
     
    #57
  18. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for finding that bug. I'm not sure how I haven;t noticed that before, what with all the thorough testing the state has been getting in my own project. I updated the copy+paste code for that state to reflect your change.


    Magic Blindness:


    This can be made by changing the magical accuracy formula in the plugin you mentioned. By changing it from 1.00 to something like the following, it would change accuracy if the state were applied:


    1.00 - (0.30 * user.isStateAffected(201))


    This would give a 30% miss chance to magic spells when affected by state 201.


    Kidnap:


    The answer to this I'm not so sure about just yet. If I set the state to check every turn if the affected battler is the only creature on it's side of combat, and remove the state if it finds that to be true, it might work this way. But I foresee problems where the other living enemy dies and three actors have actions queued up that don't do anything while this dude is still kidnapped.


    Opportunism:


    I think forcing actions in non-time based battle systems might work normally, though I hadn't tried it. What I can say for sure is that the original method I was using for added effect states was forcing actions, and it had the added bonus that I could use an action sequence on the forced skill ( to make it look pretty), but it would interfere with the turns of the following battlers in weird ways. Since Yanfly discontinued support for the CTB and ATB plugins, I could try without them to see if the same sort of thing happens again. Worst case is that it won't work with those plugins, which is already true. Otherwise, you basically have to do what you said, in the action sequence of basically every skill, you'd need to do checks for who's in the party, if they're dead or not, and if the opportunism state is up. That's a lot of work.


    Now, this week I'm doing something small. I've cleared off the list of 'promised states' from the OP, and I'm not really sure which of my myriad states I should share, so I'll go with something basic that most people can use. Overload!



    Overload is a state that makes skills belonging to a certain skilltype deal massive extra damage, at the cost of dealing some of that damage back to the caster. While it was designed as a passive effect, it could easily be rolled into a buff skill as well. For this skill, I have specified that skills belonging to skilltype 12 will be overloaded. You can change this to match your own projects better, of course.


    Here is the paste code for our state:


    Code:
    <Custom Confirm Effect>
    if (this.isMagical() && this._item.isSkill() && $dataSkills[this._item._itemId].stypeId == 12 && value !== 0) {
    value = Math.ceil(value * 1.8)
    user.gainHp(-Math.floor(Math.abs(value * 0.15)))
    }
    </Custom Confirm Effect>

    The if condition at the start is checking to make sure the action our affected actor took met the requirements for overload.

    • Was it magical?
    • Was it a skill?
    • Was it stypeId 12?
    • Did it deal more damage/healing than 0?

    When it passes these checks, the value of the effect is multiplied by 1.8, and 15% of the effect is dealt as damage to the caster. Note that in the case of a healing spell, the caster still takes damage due to the Math.abs function being used. You can tweak these values to tune this effect for your game more specifically, as well. Maybe 15% is too much, or 1.8 times damage is too much, it's up to you.


    That's all for today.
     
    Last edited: Mar 20, 2017
    #58
  19. Iqus

    Iqus inVictor Member

    Messages:
    27
    Likes Received:
    11
    Location:
    England
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    I already got Opportunism just by using a common event call. Since no scripting was required, it wasn't actually that hard!


    Let me do a recap of states, since I demanded you so many (sorry!) I just want to get things sorted.

    • Hell Power: Might require an extra script. 
    • Dizziness: Might require an extra script. However, Yanfly released today a script that attacks one enemy and then a random enemy on the back row. I am REALLY bad at scripting but I think this piece of code might be holding the key to it, what do you think?:

    <Custom Target Eval>
    // Get the target's current row.
    var row = target.row();
    // Get the target's allies.
    var group = target.friendsUnit();
    // Loop through each of the rows in your game.
    for (var i = row; i <= Yanfly.Param.RowMaximum; ++i) {
    // Get the members of the row's alive members.
    var members = group.rowAliveMembers(i);
    // Check if the member group is larger than 0.
    if (members.length > 0) {
    // Add a random target from that group.
    targets.push(members[Math.floor(Math.random() * members.length)]);
    }
    }
    </Custom Target Eval>


    • Lock: Turn resetting achievable. Blocking new states could be an issue. Again, not really an expert on coding, but could this work? (original was blockedskills; taken from Spell Shield Tips & Tricks)
    Code:
      blockedstates.push(249, 250, 251, 252);
      blockedstates.push(253, 254, 255, 256);
    • Mental Charge: Done! Works perfectly!
    • Stealth: Done! Works perfectly! Better version that what I initially demanded ^^
    • Shadow Form: Might be as easier as adding a if.stateId(x) then value *= -1 on healing skills. Could be another way though.
    • Virus: Definetely doable.
    • Clumsiness: Definetely doable. 
    • Magic Blindness: Done! Works perfectly! 
    • Blade Stop: Definetely doable.
    • Kidnap: Could be challenging.
    • Opportunism: Done through common events.



    I saw your new Overload last night on your blog, it's a really nice feature. I'm curious though because you added a skill type restriction despite also having a magical and skill check, is there any particular reason for this? Because I think that if there were no such restriction the state could be usable by any character/enemy.


    Amazing as always though! ^^
     
    #59
  20. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    The magical check might not be necessary, but I needed to check if it was a skill before checking for it's stype, as if it was an item that had been used, it wouldn't have an stype, and in my experience that usually caused the game to crash. Although maybe that's not true in this case.


    Dizziness:


    That custom target eval might work to set this up, but it can only be placed on a skill, so it'd have to be on EVERY skill. That's obviously not very ideal.


    Lock:


    That bit of code is pushing values to an array, I'd need to look at the rest of the code to see what the array is being used for.
     
    #60

Share This Page