State that restores MP when hit

● ARCHIVED · READ-ONLY
Started by dinhbat3 7 posts View original ↗
  1. Howdy folks

    I use Yanfly's Convert Damage script to make states that allow for a player to absorb hp/mp when using an attack and dealing damage, but I was wondering if there were any scripts around that did a similar function except that it activates when damage is taken.

    Example:

    Actor gets hit by enemy and takes 100HP damage.

    If the damage occurs when the Actor has "MP Restore State" He can get some MP back. Maybe a % based on damage or a static amount.

    (This is not an absorb damage effect, namely the actor will take 100% of the HP damage still)

    I have looked around and all drain like effects only work when dealing damage, not taking it.

    An added bonus would be if the solution were compatible to allow for a pop up message. I am using Yanfly's ACE Battle Engine for pop ups.

    Thanks in advance folks =D

    ~ Dinhbat
  2. It's probably easy to implement if you do this in hardcoded way. Yeah, I mean you make a change inside default script than making a lot of unecessary configurations. Since you don't plan to release script for public.

    Here is the little script snippet. Well, never tried it yet :p

    class Game_Battler alias mp_absorb_exe_damage execute_damage def execute_damage(user) mp_absorb_exe_damage(user) if state?(id) # <-- Your MP absorb state id # Make absorbing value absorb_mp = @result.hp_damage * 0.5 # <-- percentage from HP damage # Added MP self.mp += absorb_mp # For Yanfly popup create_popup(absorb_mp, "MP_DMG") end endendLuckily, I recently played around Yanfly's popup from his(?) Battle Engine. It's actually pretty neat and easy to use for scripters once you understand how to use it.

    Edit :

    I guess you're in a wrong forum section
  3. Thanks TheoAllen.

    Functionally everything works great. I added an extra .to_i to get integers out of the recovery rate. My only question is about the pop up. With your current code it does show the MP returned, but without the vocab.

    Usually when MP is recovered the pop up will be +100 MP, with the code above the output is just 100.

    Is there any way to import the vocab from Yanfly's too?

    ~ Dinhbat
  4. Actually, you just need to put this line

    create_popup("MP Absorbed", rules) # <-- You can change the vocab as you wish.On before create_popup(absorb_mp, "MP_DMG")

    'rules' parameter can be replace by anything in POPUP_RULES ={ in Yanfly Battle Engine configs

    Here ...

    t9KxBKQ.png

    For example :

    create_popup("MP Absorbed", "MP_HEAL")Hope you understand
  5. Hmm.. Not sure I am doing it right.

    Here is what I have in Yanfly's at the moment:



    POPUP_SETTINGS ={ :offset => -24, # Height offset of a popup. :fade => 12, # Fade rate for each popup. :full => 60, # Frames before a popup fades. :hp_dmg => "-%s ", # SprintF for HP damage. :hp_heal => "+%s ", # SprintF for HP healing. :mp_dmg => "-%s SP", # SprintF for MP damage. :mp_heal => "+%s SP", # SprintF for MP healing.
    Code:
       POPUP_RULES ={      # Type     => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]      "DEFAULT"  => [   2.0,   1.0, 24, true,  false, 255, 255, 255, DEFAULT],      "CRITICAL" => [   2.0,   1.0, 24, true,  false, 255,  80,  80, DEFAULT],       "HP_DMG"   => [   2.0,   1.0, 36, true,  false, 255, 255, 255, DEFAULT],       "HP_HEAL"  => [   2.0,   1.0, 36, true,  false, 130, 250, 130, DEFAULT],       "MP_DMG"   => [   2.0,   1.0, 36, true,  false, 220, 180, 255, DEFAULT],       "MP_HEAL"  => [   2.0,   1.0, 36, true,  false, 160, 230, 255, DEFAULT],  


    Usually when I heal MP any other way with Yanfly's it looks like this:

    "+100 SP"

    Any way I can get the "+100 SP" format that I usually get with Yanfly's? 

    **Edit**

    I decided to do this to your code to fix my problem:

    create_popup("+#{absorb_mp} SP", "MP_HEAL")

    And it works =D

    Thanks again TheoAllen. I need to duplicate and shrink you so I can always ask you to help me when needed! Hehe

    ~ Dinhbat
  6. I tried Yanfly's MPconvert script and it isn't working for me. Any ideas why, or any other scripts i could use?

    I want to have a weapon that 'absorbs' MP from an enemy. Ideally I'd like to set the value of the MP absorbed to an integer (I want a weapon that gives 1MP per hit to the player), but Yanfly's script converts a %age (which is OK too, if it worked).

    I have no idea why Yanfly's doesn't work as I've installed it correctly and have used various other scripts in my game which work fine.

    It's annoying that you can set spells/abilities that absorb MP but not being able to apply this to weapons. If anyone can suggest something, that'd be great.

    G
  7. gsuk, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.



    Also your post is about something completely different, so those on this thread would have no idea how to fix it most of the time. Please start a new thread under RGSSx Script Support for your question.