Help Creating Trap Battle Skills [Partially Solved]

Discussion in 'Javascript/Plugin Support' started by thebootknifer, Nov 22, 2018.

  1. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Hello,

    I'm trying to create a class that lays down traps during battle, and then the trap activates X turns later. After the trap is placed, the character can still use other skills, attack, etc on the following turns.

    Eg: Flame Trap.
    After X turns the trap will trigger, deal damage and inflict the burning state on the enemy that was affected by it.

    It would be cool if a random enemy in the battle hits the trap, but that might be way to complicated. If I could target someone with the trap and have it pop after a few turns, that would be cool too.

    I'm trying to create something using Yanfly's BuffsStatesCore plugin, but I'm not sure if this is the solution for me.

    Maybe this damage stagger code would work? I'm not sure how to edit it to my needs. I would have the targeted enemy take 0 dmg on the turn flame trap was cast, and then 0 damage for the following turns until the trap goes off dealing 100% of the damage and adding the required states.

    http://yanfly.moe/2016/09/19/tips-tricks-stagger-rpg-maker-mv/


    I'm honestly hoping this is easily achievable with a plugin I don't know of, even if it required a billion note tags, plugin commands or anything. I'll put the work in, I just need a push in the right direction.

    Maybe someone has a better idea? Thank you for all your help!
     
    #1
  2. Boonty

    Boonty Veteran Veteran

    Messages:
    38
    Likes Received:
    14
    First Language:
    French
    Primarily Uses:
    RMMV
    I dont know how to do this but I am also very interested !
     
    #2
  3. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    My brain was super fried last night. I think I'm going to take an another stab at it tonight.
     
    #3
  4. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm thinking its along the lines of using YAnfly's Statebuff plugin and inserting the following in the note of a state.
    Essentially I would make two skills per skill I want to create.
    Create two skills called Wire Trap.
    One of them will Apply an invisible state to the enemy.
    The other is the actual trap skill.

    When the trap state is removed by waiting two turns, the trap skill will trigger with the following code below.

    <Custom Remove Effect>
    $gameParty.members()[index].forceAction(skillId, targetIndex);
    BattleManager.forceAction($gameParty.members()[index]);
    </Custom Remove Effect>

    TargetIndex= "-1" for random and "-2" for last target.

    I have no idea what [index] is though. Do I put a number "$gameParty.members(1)" here?

    This is what I've come up with so far, but I don't know what values to insert to make it functional.
     
    #4
  5. Boonty

    Boonty Veteran Veteran

    Messages:
    38
    Likes Received:
    14
    First Language:
    French
    Primarily Uses:
    RMMV
    I think that a skill and a state should be enough.

    And removing the state will do the wanted damage !
     
    #5
  6. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I've made some progress finally!
    I will be replicating this for all of my trap skills, but this is what I have so far.

    1. Create a state called Flame Trap. This essentially marks an enemy with a trap. Set this to expire after X turns.
    2. Create a skill called Flame Trap. All it does is apply the above Flame Trap state to the enemy.
    3. Create a second skill called Flame Trap, which has the damage formulas, etc.

    Place this in the note box of the state.
    <Custom Remove Effect>
    $gameParty.members()[0].forceAction(46, 1);
    BattleManager.forceAction($gameParty.members()[0]);
    </Custom Remove Effect>
    0=Party member 1
    46=second skill called Flame Trap.
    1 = Hit random enemy
    2 = Enemy with trap marked on it

    A more sophisticated way would be to create a variable that checks to see which party member knows flame trap (IE Actor ID), and then insert that variable where the 0's are sitting. If I make it the actor ID, I suppose that would be different from battler ID?
    I don't know enough JS to complete this part.


    So now my trap states will expire after X turns and hit a random enemy.
    If the marked enemy dies, then the trap will never activate, which may be a problem unless I make a work around.
    I might have to notify the player that if an enemy that was 'lured' dies prematurely, then the other enemies know not to walk into that trap.

    My ultimate goal would have the trap go off after X turns no matter what on a random enemy. I will have to work on that at a much later date. I really need to get my game going.
     
    Last edited: Nov 25, 2018
    #6
  7. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Total brain fart! I woke up and this thought popped into my head. My brain must have been working on this in my sleep.
    Have the state placed on the user, not the enemy! This way the traps will trigger as long as the user remains alive instead of the enemy.

    This way your traps don't go to waste in group fights.

    Or! Select an ally to be a 'lure' for the trap. I can make up an explanation for this in game for flavor and to make sense of it all.

    Make sure to add this note tag so you don't reset a trap state when you apply it.
    <Reapply Ignore Turns>
     
    Last edited: Nov 25, 2018
    #7
  8. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Last post/Bump from me.

    This is what I need for the states notebox.

    <Reapply Ignore Turns>
    <Custom Remove Effect>
    $gameActors.actor(2).forceAction(46, 1);
    BattleManager.forceAction($gameActors.actor(2));
    </Custom Remove Effect>

    This forces actor 2, my hunter/trap person to execute the trap skill once the state wears off. In game, it looks like I set a trap, and then when the state wears off, the enemy bumps into the trap!

    I'm happy it works!
     
    #8
  9. Boonty

    Boonty Veteran Veteran

    Messages:
    38
    Likes Received:
    14
    First Language:
    French
    Primarily Uses:
    RMMV
    Wow, nice work dude !

    I will try this on my side ! Sorry to be useless, I didn't find the time to solve this problem in the last days but I am glad that you come with a solution.

    Question : if the defense of the target is lowered (or increased) during the moment of the setting of the trap and its activation, would it be taken into account ?
     
    #9
  10. thebootknifer

    thebootknifer Villager Member

    Messages:
    13
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes it will. The skill that deals the damage is forced after the state is removed, so all buffs and debuffs will be taken into account at the point in which the skill is going to deal its damage.
     
    #10

Share This Page