Damage Sequence

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Lecode, Sep 5, 2015.

  1. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    Damage Sequence 1.1


    Lecode


    Introduction


    This script allows you to synchronize skills and items' damage with their animations.


    To put it simply, the player can now deal damage during an animation.


    Thus, you can decide to make real multiple-hits skills or to deal damage at a specific frame.


    Screenshot

    Spoiler



    [​IMG]



    Instructions


    Version 1.0

    Spoiler




    <dmg_sequence: a,b,c,d...>


    Specify the frame(s) where damages are dealt.
    Example: <dmg_sequence: 6,12>
     



    <effects_sequence: a,b,c,d...>


    Specify the frame(s) where effects are applied.


    By default, they are applied on the last hit.
     



    <effects_each_hit>


    This tag allows the skill/item to apply effects on each hit.



    Version 1.1


    (Don't bother with that version if you want a simple script/configuration)

    Spoiler




    <damage sequence>[frame,formula,effects?,crit?,never_miss?][frame,formula,effects?,crit?,never_miss?]ect...</damage sequence>


    Specify the frames where damages are dealt.
    You can also specify if you allow the skill/item to:
    - Apply effects (effects?)
    - Try to crit (crit?)
    - Certain hit (nerver_miss?)
    Also, you can set a custom damage formula for that specific frame.
    Replace "formula" with "" or nil to use the default formula.



    Demo + Script


    Here.


    Notes


    The script is compatible with the default battle system and with Yanfly's battle engine.


    Let me know if you face some compatibility issues. Perhaps I will solve them.
     
    Last edited by a moderator: Feb 23, 2016
    #1
    JosephSeraph, BCj, Kizami and 3 others like this.
  2.  Nova

     Nova Veteran Veteran

    Messages:
    163
    Likes Received:
    136
    amazing. I've been looking for something like this for a long time :D
     
    #2
    Lecode likes this.
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Oooh, a pretty nice idea.
     
    #3
    Lecode likes this.
  4. ArcaneEli

    ArcaneEli Mage of Thunder Veteran

    Messages:
    205
    Likes Received:
    35
    First Language:
    English
    If I bring a ring to your house will you marry me?
     
    #4
    Lecode likes this.
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Cool script, and it actually might work for something I planned to do long time ago! *-*


    Now to add a possibility to make a separate damage formula for each hit performed... Am I asking too much? :D
     
    #5
    Lecode likes this.
  6. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    I'm not ready for that, lol.

    Hey, why not ? :)

    I will think about that.

    Thanks, everyone.
     
    #6
  7. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    That will be easy to add now that he has this IMHO...
     
    #7
  8. ToastyCheese

    ToastyCheese Villager Member

    Messages:
    10
    Likes Received:
    4
    First Language:
    English
    I do have a question about this: How does the script handle accuracy? Is each frame counted as a separate accuracy roll, or is it "full move hits / full move misses." 

    It may also be a good idea to add an option to configure this, if it's not well integrated in already
     
    #8
  9. Probotector 200X

    Probotector 200X Probotect and Serve Veteran

    Messages:
    890
    Likes Received:
    146
    This is pretty cool.

    A separate damage formula (and/or different elemental) for each hit would be...amazing.
     
    #9
  10. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    Accuracy / Crit / Evade / Cover, ect... are handled on each hit.

    It's because I use the default way to deal damages. For compatibility sake.

    Added to the todo-list.
     
    #10
  11. ScoopJohn

    ScoopJohn The guy who asks too many questions Veteran

    Messages:
    254
    Likes Received:
    33
    Location:
    Nowhere
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    Amazing, it's centuries i've been waiting for it!
     
    #11
    Lecode likes this.
  12. Kizami

    Kizami Alejandro Veteran

    Messages:
    38
    Likes Received:
    12
    Location:
    Colombia
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    This adds a lot of realism to the game; I really wanted something like this since a while, thank you very much!!! :D
     
    #12
    Lecode likes this.
  13. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    Updated.

    Code:
    # Versions:#   1.0   - Initial release#   1.1   - Add the possibility to control critical#           and guaranted hits, and formula. Also, merge all tags into#           a unique one.
     
    Last edited by a moderator: Sep 20, 2015
    #13
  14. MHRob

    MHRob Card Master Veteran

    Messages:
    133
    Likes Received:
    24
    Location:
    Mirror World
    First Language:
    English
    Primarily Uses:
    RMVXA
    Maybe it's a script compatibility but I'll ask anyways. Is it supposed to hit the player as well? I'm using the first version of the script, because I don't really need all the other features, just the real time damage sequence, and when I used it with a skill that hit's all enemies, it hits the player as well. Is this normal?
     
    Last edited by a moderator: Sep 26, 2015
    #14
  15. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    No, it isn't normal at all :'o

    What battle system are you using ?
     
    #15
  16. MHRob

    MHRob Card Master Veteran

    Messages:
    133
    Likes Received:
    24
    Location:
    Mirror World
    First Language:
    English
    Primarily Uses:
    RMVXA
    #16
  17. omen613

    omen613 Veteran Veteran

    Messages:
    309
    Likes Received:
    106
    Location:
    USA - California
    First Language:
    English
    Nice script.

    I'm sure many people in the community will make very good use of it.

    ...now to take another look at my skill list lol
     
    #17
  18. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    543
    First Language:
    Chinese
    Primarily Uses:
    N/A
    I received a compatibility report between this script and DoubleX RMVXA Confusion Edit.

    The cause is that the battler instance variable @leds_sprite is a sprite, which has an instance variable @leds_battler, which is that battler.

    Whenever a deep copy is to be made for such battlers via Marshal(usually Marshal.load(Marshal.dump)), crashes will come as sprites can't be serialized and Marshal will crash whenever it tries to copy an unserializable object.

    As I've solved an extremely similar compatibility issue with my scripts before, I realized yours will also be incompatible with these scripts:

    Yanfly Engine Ace - Victory Aftermath

    Yami Engine Symphony - Equipment Learning

    Theolized Sideview Battle System

    Victor Engine - Custom Slip Effect

    And I've come up with this fix:

    if $imported[:TSBS]alias ledmgseq_copy copydef copy(obj, &argb) # Added to store then clear all battler's unserializables if is_battler = obj.is_a?(Game_Battler) unserializables = obj.ledmg_unserializables obj.clear_ledmg_unserializables end # clone = ledmgseq_copy(obj, &argb) # Rewritten # Added to restore all battler and his/her/its clone's unserializables if is_battler obj.restore_ledmg_unserializables(unserializables) clone.restore_ledmg_unserializables(unserializables) end clone #end # copyend # if $imported[:TSBS]if $imported["YEA-VictoryAftermath"] || $imported["YES-EquipmentLearning"]class << BattleManager # Edit alias ledmgseq_process_victory process_victory def process_victory(*argv, &argb) # Added to store then clear all party members' unserializables unserializables = {} $game_party.all_members.each { |mem| unserializables[mem] = mem.ledmg_unserializables mem.clear_ledmg_unserializables } ledmgseq_process_victory(*argv, &argb) # Added to restore all party members' unserializables $game_party.all_members.each { |mem| mem.restore_ledmg_unserializables(unserializables[mem]) } # end # process_victoryend # BattleManagerend # if $imported["YEA-VictoryAftermath"] || $imported["YES-EquipmentLearning"]if $imported["DoubleX RMVXA Confusion Edit"]class Game_Action # Edit def evaluate_item_with_target(target) # Rewrite target.result.clear # Added to store then clear all unserializables from subject and target subject_unserializables = subject.ledmg_unserializables target_unserializables = target.ledmg_unserializables subject.clear_ledmg_unserializables target.clear_ledmg_unserializables # eval_target = Marshal.load( Marshal.dump(target) ) eval_subject = Marshal.load( Marshal.dump(subject) ) # Added to restore all unserializables for subject, target and their clones subject.restore_ledmg_unserializables(subject_unserializables) eval_subject.restore_ledmg_unserializables(subject_unserializables) target.restore_ledmg_unserializables(target_unserializables) eval_target.restore_ledmg_unserializables(target_unserializables) # eval_target.make_damage_value(eval_subject, item) if item.for_opponent? return eval_target.result.hp_damage.to_f / [eval_target.hp, 1].max end recovery = [-eval_target.result.hp_damage, eval_target.mhp - eval_target.hp].min.to_f / eval_target.mhp end # evaluate_item_with_targetend # Game_Actionend # if $imported["DoubleX RMVXA Confusion Edit"]class Game_Battler # Edit def ledmg_unserializables # New unserializables = { leds_sprite: @leds_sprite } unserializables[:item_in_use] = @item_in_use if $imported[:TSBS] if $imported[:ve_custom_slip_effect] unserializables[:state_user] = @state_user end unserializables end # ledmg_unserializables def clear_ledmg_unserializables # New @leds_sprite = nil @item_in_use = nil if $imported[:TSBS] @state_user = {} if $imported[:ve_custom_slip_effect] end # clear_ledmg_unserializables def restore_ledmg_unserializables(unserializables) # New @leds_sprite = unserializables[:leds_sprite] @item_in_use = unserializables[:item_in_use] if $imported[:TSBS] return unless $imported[:ve_custom_slip_effect] @state_user = unserializables[:state_user] || {} end # restore_ledmg_unserializablesend # Game_Battler
    I wanted to solve the compatibility issue with yours on my side(as DoubleX RMVXA Confusion Edit Compatibiltiy Fix), but as I failed to find any way to detect yours' presence(like using $imported[:script_name]), I think it's better to give you the fix and let you decide(you don't have to credit nor even mention me if you decided to use this fix on your side) :)
     
    #18
    Lecode likes this.
  19. Lecode

    Lecode (─‿‿─) Veteran

    Messages:
    490
    Likes Received:
    646
    First Language:
    French
    Primarily Uses:
    N/A
    I see. Thanks for reporting this issue :)

    I'll look at your fix.
     
    #19
  20. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    543
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Almost forgot that your script will also crash, due to the same reason, when an actor tries to access his/her/its equips in the equip window:

    def update_help super if @actor && @status_window temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@slot_id, item) @status_window.set_temp_actor(temp_actor) end end
    So the fix should address this part as well:

    if $imported[:TSBS]alias ledmgseq_copy copydef copy(obj, &argb) # Added to store then clear all battler's unserializables if is_battler = obj.is_a?(Game_Battler) unserializables = obj.ledmg_unserializables obj.clear_ledmg_unserializables end # clone = ledmgseq_copy(obj, &argb) # Rewritten # Added to restore all battler and his/her/its clone's unserializables if is_battler obj.restore_ledmg_unserializables(unserializables) clone.restore_ledmg_unserializables(unserializables) end clone #end # copyend # if $imported[:TSBS]if $imported["YEA-VictoryAftermath"] || $imported["YES-EquipmentLearning"]class << BattleManager # Edit alias ledmgseq_process_victory process_victory def process_victory(*argv, &argb) # Added to store then clear all party members' unserializables unserializables = {} $game_party.all_members.each { |mem| unserializables[mem] = mem.ledmg_unserializables mem.clear_ledmg_unserializables } ledmgseq_process_victory(*argv, &argb) # Added to restore all party members' unserializables $game_party.all_members.each { |mem| mem.restore_ledmg_unserializables(unserializables[mem]) } # end # process_victoryend # BattleManagerend # if $imported["YEA-VictoryAftermath"] || $imported["YES-EquipmentLearning"]if $imported["DoubleX RMVXA Confusion Edit"]class Game_Action # Edit def evaluate_item_with_target(target) # Rewrite target.result.clear # Added to store then clear all unserializables from subject and target subject_unserializables = subject.ledmg_unserializables target_unserializables = target.ledmg_unserializables subject.clear_ledmg_unserializables target.clear_ledmg_unserializables # eval_target = Marshal.load( Marshal.dump(target) ) eval_subject = Marshal.load( Marshal.dump(subject) ) # Added to restore all unserializables for subject, target and their clones subject.restore_ledmg_unserializables(subject_unserializables) eval_subject.restore_ledmg_unserializables(subject_unserializables) target.restore_ledmg_unserializables(target_unserializables) eval_target.restore_ledmg_unserializables(target_unserializables) # eval_target.make_damage_value(eval_subject, item) if item.for_opponent? return eval_target.result.hp_damage.to_f / [eval_target.hp, 1].max end recovery = [-eval_target.result.hp_damage, eval_target.mhp - eval_target.hp].min.to_f / eval_target.mhp end # evaluate_item_with_targetend # Game_Actionend # if $imported["DoubleX RMVXA Confusion Edit"]class Game_Battler # Edit def ledmg_unserializables # New unserializables = { leds_sprite: @leds_sprite } unserializables[:item_in_use] = @item_in_use if $imported[:TSBS] if $imported[:ve_custom_slip_effect] unserializables[:state_user] = @state_user end unserializables end # ledmg_unserializables def clear_ledmg_unserializables # New @leds_sprite = nil @item_in_use = nil if $imported[:TSBS] @state_user = {} if $imported[:ve_custom_slip_effect] end # clear_ledmg_unserializables def restore_ledmg_unserializables(unserializables) # New @leds_sprite = unserializables[:leds_sprite] @item_in_use = unserializables[:item_in_use] if $imported[:TSBS] return unless $imported[:ve_custom_slip_effect] @state_user = unserializables[:state_user] || {} end # restore_ledmg_unserializablesend # Game_Battlerclass Window_EquipItem < Window_ItemList # Edit alias ledmgseq_update_help update_help def update_help(*argv, &argb) # Added if @actor unserializables = @actor.ledmg_unserializables @actor.clear_ledmg_unserializables end # ledmgseq_update_help(*argv, &argb) @actor.restore_ledmg_unserializables(unserializables) if @actor # Added end # update_helpend # Window_EquipItem
    If this compatibility fix will have to be placed above Yanfly Engine Ace - Ace Equip Engine, the below separate snippet will have to be placed below that script as well:

    class Window_EquipItem < Window_ItemList # Edit alias ledmgseq_update_help_compatibility update_help def update_help(*argv, &argb) # Added if @actor unserializables = @actor.ledmg_unserializables @actor.clear_ledmg_unserializables end # ledmgseq_update_help_compatibility(*argv, &argb) @actor.restore_ledmg_unserializables(unserializables) if @actor # Added end # update_helpend # Window_EquipItem
    It's because of the below part of that script:

    Code:
      #--------------------------------------------------------------------------  # overwrite method: update_help  #--------------------------------------------------------------------------  def update_help    super    return if @actor.nil?    return if @status_window.nil?    return if @last_item == item    @last_item = item    temp_actor = Marshal.load(Marshal.dump(@actor))    temp_actor.force_change_equip(@slot_id, item)    @status_window.set_temp_actor(temp_actor)  end
     
    #20
    Lecode likes this.

Share This Page