Problem with Self-Destruct skill.

Discussion in 'RPG Maker MV' started by Hungry Moogle, Dec 7, 2017.

    Tags:
  1. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    I was wondering if anyone could help with a apparent bug I've encountered with the Self-Destruct skill I've made. The skill itself works perfectly, but the problem is that when an enemy uses the skill, afterwards the enemy will remain in replace, not moving or able to act. The enemy for all intents and purposes will be considered to be "dead" as the player is unable to target the affected enemy and the battle will come to an end if every enemy falls into this state.

    Is there anyway that I can fix this bug? Any help with this matter would be greatly appreciated.

    EDIT:
    I guess I should include the skill formula as well, just in case it is needed to help the diagnose the bug.

    Formula:
    Code:
    a.die(); (a.atk * 3) * (100/(100 + b.def))
     
    Last edited: Dec 7, 2017
    #1
  2. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    332
    Likes Received:
    118
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    I wouldn't use a.die() for this. Instead use:

    a.addState(1);

    Assuming that State 1 is still Knockout or Death (as it should be), this will kill the user also.
     
    #2
    Hungry Moogle likes this.
  3. Solwern

    Solwern Dead person. Veteran

    Messages:
    129
    Likes Received:
    68
    First Language:
    English
    Primarily Uses:
    RMMV
    #3
    Hungry Moogle likes this.
  4. HannahSmith

    HannahSmith Happy Little Fairy Member

    Messages:
    11
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah, definitely use
    Code:
    a.addState(1)
    .
     
    #4
    Hungry Moogle likes this.
  5. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for the suggestions, but unfortunately changing
    Code:
    a.die()
    to
    Code:
    a.addState(1)
    doesn't seem to have changed anything. The enemy still remains on the screen after killing itself, just as it did before.
     
    #5
  6. Solwern

    Solwern Dead person. Veteran

    Messages:
    129
    Likes Received:
    68
    First Language:
    English
    Primarily Uses:
    RMMV
    What about setting HP to 0?
     
    #6
    Hungry Moogle likes this.
  7. Wavelength

    Wavelength The Indictables Veteran

    Messages:
    3,264
    Likes Received:
    2,408
    Location:
    Florida, USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    I think the issue is that RPG Maker doesn't know that it needs to check whether to perform the collapse effect on the user, since it doesn't expect anyone except the targets to possibly die.

    The method call you'd need to trigger is performCollapse() but I'm not sure whether you can safely call that from the formula in the sense of a.performCollapse(); though you could certainly try! If that doesn't work (I suspect it won't), you could set a variable for the actor or enemy number that is using it, and set a switch that calls a Troop Event which immediately performs the collapse for the actor/enemy set in the variable (before turning its own switch off). If you need help with how to reference the correct actor/enemy, that's probably a question to ask in the Learning JavaScript subforum.
     
    #7
    Hungry Moogle likes this.
  8. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm exactly not sure how to set HP to 0, I tried "a.hp 0", but that ended up producing an error message, while "a.hp-0", doesn't seem to do anything at all.

    Setting up a Self-Destruct is a lot more complicated than I thought it would be... is there a plugin that I can use to apply the state to the enemy via Note tag instead of trying to apply it via Damage formula? In the past I've used some of Yanfly's plugins to create custom skills such as one that can sacrifice half of the user's HP to recover their allies' HP by the amount, so I was wondering if a plugin could possibly circumvent the problems of trying apply the death state through the Damage formula altogether.
     
    #8
  9. Wavelength

    Wavelength The Indictables Veteran

    Messages:
    3,264
    Likes Received:
    2,408
    Location:
    Florida, USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    No idea whether there's a "self-destruct" plugin out there or not, but if you want to do it with States, just apply a dummy state to the self-destructed battler that doesn't do anything, and have the self-destruct skill run a common event that looks at each battler to see if they have the state and if so add the KO state to them (doing it as part of the troop event should make the collapse work properly). I think that would work.
     
    #9
    Hungry Moogle and ArielSystem like this.
  10. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,385
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    It LOOKS like the way the game would handle killing a battler is to perform the following:
    a.setHp(0); a.performCollapse();

    Give that a go and see if it works out.
     
    #10
    Hungry Moogle likes this.
  11. ArielSystem

    ArielSystem Villager Member

    Messages:
    23
    Likes Received:
    41
    First Language:
    Indonesian
    Primarily Uses:
    N/A
    Self Destruction?

    You can Make it with combination of Common Events.

    First on the Skill :
    Add a 100% chance DEATH in that skill.
    Then add Common Event
    Change State : [Actor] + [DEATH]
    (Optional but it'll work) Change HP for Allies -99999 (Don't use Allow Knockout)

    Look at this :
    Simple even Without Plugin.
     

    Attached Files:

    #11
    Hungry Moogle likes this.
  12. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    This doesn't really work for what I want, while I appreciate the suggestion, I want the Self-Destruct skill to be able deal heavy damage to targets, with the capability of being able to KO them. There's also the issue of that you would have set Change State to affect a specific target and not whoever is using the skill. So for example, if the Common Event is set to inflict the KO state on Enemy A and Enemy B uses the Self-Destruct skill, wouldn't the skill cause Enemy A to die instead of Enemy B despite Enemy B using the skill?

    This skill setup I think would be useful for a boss fight where the boss, when their HP is low, would begin a self-destruct sequence and the player would then have to defeat the boss in the next couple of turns, otherwise the boss will blowup and KO the entire party. I currently don't have any plans for a boss like that, but someone else might. Personally, I just wanted to make a type of enemy that when damaged, would become "armed" and then would self-destruct on its following turn, dealing heavy damage to the entire party. Sort of like the Bomb enemies from the Final Fantasy series, but functionally more similar to the Bob-Omb enemies from the Super Mario games. Regardless of my intentions, thanks again for the suggestion.
     
    #12
    ArielSystem likes this.
  13. Hungry Moogle

    Hungry Moogle A Rat in the Wall Veteran

    Messages:
    34
    Likes Received:
    5
    Location:
    Hiding under your bed, drooling & very hungry
    First Language:
    English
    Primarily Uses:
    RMMV
    This actually worked perfectly! The enemy now disappears after self-destructing rather than sticking around and becoming completely unresponsive.

    The only thing now missing from the skill would be how to make it so that the self-destructed enemy would not drop any items afterwards, and possibly not award Experience Points or Gold either. However, I assume this would require some custom programming to pull this off, and would be well beyond the original scope of this topic.

    Well anyways, thanks for all the help from everyone who pitched in with suggestions on how to fix this problem.
     
    #13
    Solwern, ArielSystem and Llareian like this.

Share This Page