Poison Flash on Damage Fix (Now with Customization!)

Discussion in 'JS Plugin Releases (RMMV)' started by wrigty12, Jun 24, 2016.

  1. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    TDW Poison Flash on Damage Fix - v 1.01


    wrigty12


    Intro - After installing plugins, I noticed that the typical red "flash" on a map when taking damage from states like Poison did not end up working. Upon research throughout the forums and internet, I could not find a fix. Thus, I created one. This works for my specific project, but it should work with most others.


    Later on, I decided to add in options to make the flash more customizable. 


    Features:


    - Creates a workaround to allow a "flash" upon taking regenerationHp damage on a map.


    - Allows you to alter the number of steps it takes for a state's "Turn" to pass while walking


    - Allows you to change the color and duration of the flash.


    - Allows you to have a Sound Effect play when the flash occurs.


    How To Use - Simply download, place in your js file, and install under most other plugins!


    Parameters:

    -Steps For Turn: This is how many steps it takes for one "Turn" to pass for a state when walking (I.e. Steps between flash). Default = 20


    -SE File Name: Provide the file name of the Sound Effect you want to play on flash. (Leave blank for none) Default = Poison


    -SE Volume: Provide the volume (0-100) of the Sound Effect on flash. Default = 80


    -SE Pitch: Provide the pitch (50-150) of the Sound Effect on flash. Default = 100


    -SE Pan: Provide the pan (-100-100) of the Sound Effect on flash. Default = 0


    -Flash Color Change: 4 Different parameters to change the Red, Green, Blue, and Duration of the RGB flash color.



    Note Tags - None.


    Future Plans - If any issues arise, I will try to fix them. Will take suggestions for any additional customizations.


    Change Log:

     Version 1.01:
     - Added in the option to change the color of the flash.
     - Added in the option to have a Sound Effect play with flash.
     - Added in the option to change the Step Count for a State's walking turn.
     


    Version 1.00:
     - Initial release



    Terms of Use - Free for commercial and non-commercial use. Feel free to credit: wrigty12 or Tyler Wright


    Download Link Here


    Note - I am a beginner in the ways of making plug-ins and in JavaScript. If there is anything you see wrong, could be improved, or bugs you find, just let me know.
     
    Last edited by a moderator: Jun 30, 2016
    #1
    Solis and DreamX like this.
  2. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    I'm not sure what it's conflicting with, but I'm getting a crash with the error "cannot read property 'refresh' of undefined" when the damage state tries to tick on the map.


    I'll do some more testing over the next day or two to see if I can figure out which plugins it doesn't like, since it does work on its own.


    My list of plugins is... very large, but nearly all of them are Yanfly's, if that helps. Let me know if you need something specific and I'll get back to you.
     
    #2
  3. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    Alright. If you can provide a screenshot of the console log for the error as well, I could look into it from my end
     
    #3
  4. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    I have good news and bad news. Good news is that turning off exactly one plugin made everything run fine. The bad news is that I kinda need the plugin (or something like it, if there's one out there).


    The only plugin this actually appears to conflict with is ellyesstatedamage, which allows the use of damage formulas for poison-like states. Rather important for making such states at all viable, since percent health damage is nigh impossible to work with for bosses and the like. Log should be attached.


    Also had an idea on how to improve this a bit. If possible, it would add to the effect if you could assign a sound effect to go with the flash.

    Poison Flash log.png
     
    #4
  5. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    Could you send me the file you have for the elleysstatedamage.js? Or point me to the right place to get the plugin? Ill look into if I can create work around to make it compatable.


    Also, I will look into a sound effect. I was also going to add in the option to change the flash color.
     
    #5
  6. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    I don't think the maker of it is working on it anymore, but the topic is still up and the download still seems to work.




    It may also be nice to be able to adjust the length/speed of the flash, but that's a very minor, personal preference on my part. Feels a bit too short.
     
    #6
  7. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    I looked over the code and compared the two and didn't see anything that would be an issue. Then I turned off my plugin (left all my others in my project on) and I got the same error. It seems as if Ellye's is conflicting with a different plugin other than mine (The only other one that shows up in the console is Yanfly's Core Engine). If that is that case, I recommend going through your project with Ellye's on in a way that produces the error, then turn off plugins in your project until you find the one that seems to be causing an issue.


    UPDATE:


    I have updated the plugin to version 1.01 to now include customization options. See original post for details.
     
    Last edited by a moderator: Jun 30, 2016
    #7
  8. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    That's odd, never had that error pop up before. Currently turning things off and on and will once again get back to you.

    Edit: Okay, it seems that the state damage plugin just conflicts with the current version of MV. Guess I'm going to need to find a new plugin for that purpose. The in-battle ticks work, but the on-map ticks cause the same crash. Yours works fine, however, so thank you for that. I'll ask to have the other thread closed.
     
    Last edited by a moderator: Jul 1, 2016
    #8
  9. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    Well I'm glad my plugin works, but Im sorry to hear about the MV conflict. Maybe try contacting the creator of the state plugin?
     
    #9
  10. Solis

    Solis Veteran Veteran

    Messages:
    366
    Likes Received:
    84
    First Language:
    English
    I could offer another solution; you can create simliar Damage over time effects with Yanfly's plugin (and using correct code)..it's more secure and has more support. 
     
    #10
  11. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    Unless I've missed something, they've all but abandoned that one. I'll see if I can get their attention though.

    Which plugin and can you give me an example of such a code? Something that would use the stats of the one who applied the state versus the stats of the one inflicted with the state.
     
    #11
  12. Solis

    Solis Veteran Veteran

    Messages:
    366
    Likes Received:
    84
    First Language:
    English
    Sure. I think it's just his collection of battle core plugins, buffs and state core, and action sequences. 


    Here is an example of code: 


    <Custom Regenerate Effect>
    // Get the Darkness element.
    var elementId = 6
    // Round down the damage, apply formula.
    var damage = Math.floor(origin.mat * 2.7 + 5 - user.mdf * 2);
    // Damage multiplier for weakness/resistance to Darkness element.
    damage *= user.elementRate(elementId);
    // Inflict damage to the user, caps at zero to prevent unintentional healing.
    user.gainHp(Math.min(-damage, 0));
    </Custom Regenerate Effect>


    I only offered this because I used to use elly's state damage core but I ran into A  LOT of comparability issues. Though, I do love the plugin you are using, it just doesn't' work with my games anymore. Note that the things listed as // are just descriptions of the code, not needed to be in the code. This way you can just change stuff more easily. After wards, see if this work the flash plugin from this guy here. :) Since that's what you want anyway. ***You would place this code in the state's notebox. 
     
    Last edited by a moderator: Jul 2, 2016
    #12
    wrigty12 likes this.
  13. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    Now that I see this, I may actually use this for my own Poison and Cold states for my project! Thanks for the code, Solis!
     
    #13
    Solis likes this.
  14. Solis

    Solis Veteran Veteran

    Messages:
    366
    Likes Received:
    84
    First Language:
    English
    No problem! Sorry for hijacking your topic! Just wanted to offer another solution to this guys plugin in problem so he could use yours lol
     
    #14
    wrigty12 likes this.
  15. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    The code string itself works, but the flash doesn't trigger. I suspect this has something to do with gainHP being the end function, but I'm no expert. Perhaps the flash plugin is reading it as "gaining" negative HP rather than actually losing HP.
     
    #15
  16. wrigty12

    wrigty12 Veteran Veteran

    Messages:
    533
    Likes Received:
    76
    First Language:
    English
    When I get home Ill look into it. If I recall I dont think gainHp will work with mine because it only adds my flash workaround when HpRegenration is triggered. Ill see if I can find a way to make it work


    EDIT:


    I simply added this bit of code into Solis's code to make it flash appropriately:


    After the line 


    user.gainHp(Math.min(-damage, 0));


    place the following code:


    user._mapDamageFlash = false;
    if (!$gameParty.inBattle()) {user._mapDamageFlash = true;}




    Full code lineup:

    Code:
    <Custom Regenerate Effect>
    // Get the Darkness element.
    var elementId = 6
    // Round down the damage, apply formula.
    var damage = Math.floor(origin.mat * 2.7 + 5 - user.mdf * 2);
    // Damage multiplier for weakness/resistance to Darkness element.
    damage *= user.elementRate(elementId);
    // Inflict damage to the user, caps at zero to prevent unintentional healing.
    user.gainHp(Math.min(-damage, 0));
    // Added for Flash Compatability
    user._mapDamageFlash = false;
    if (!$gameParty.inBattle()) {user._mapDamageFlash = true;}
    </Custom Regenerate Effect>
     
    Last edited by a moderator: Jul 3, 2016
    #16
  17. LonelyDragon

    LonelyDragon Wannabe dev Member

    Messages:
    12
    Likes Received:
    1
    Location:
    The Land of Bad Internet
    First Language:
    English
    Wonderful. Seems to all be working now. I have tested the poison both in and out of battle and have found no apparent bugs or issues. I might find some later, but for now, everything appears to be working as it's supposed to. 


    Thanks for the plugin and the patience. I'm still terrible at most of this =w=;
     
    #17
    wrigty12 likes this.
  18. Arthur França

    Arthur França Veteran Veteran

    Messages:
    40
    Likes Received:
    27
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I'm using Yanfly Plugin's, and this plugin isn't working. As if it were turned OFF.
     
    #18

Share This Page