[ANSWERED] Healing/Damage Calculation

Discussion in 'RGSSx Script Support' started by Bonkers, Jun 19, 2014.

Thread Status:
Not open for further replies.
  1. Bonkers

    Bonkers Lacking Sleep Restaff

    Messages:
    2,917
    Likes Received:
    2,764
    Location:
    New York
    First Language:
    English
    Primarily Uses:
    RMMV
    I am starting to think using a parallel event to show the amount of healing/damage a skill can do was not a wise move to make.  I'd like to have it in script form instead, but I don't know how to translate.  Here is a screen shot of the parallel event running in the background of the game:

    [​IMG]

    Basically I have a variable for each skill to use in it's display.  The event uses the Actor 2's mat stat times a number plus a base, with a variance of  about 1~20 to calculate the amount.

    [​IMG]

    About how much work would this take to do, and if someone is willing to do the first for me I am certain I could pick up the pattern and make the rest.

    I think it would look something like: EDIT: [​IMG]
     
    Last edited by a moderator: Jun 19, 2014
    #1
  2. mundywoof

    mundywoof Warper Member

    Messages:
    2
    Likes Received:
    3
    First Language:
    English
    Gwah..  I made an account finally.

    Here's a script snippet that will create a "Damage View" variable you can call with \V[] in a message:

    class Window_SkillList < Window_Selectable def update_help if item if item.is_a?(RPG::Skill) && item.damage.none? != 0 then $game_variables[120] = (item.damage.eval(@actor, @actor, $game_variables).to_i).abs end end @help_window.set_item(item) endendI defaulted to variable #120 for testing, but you could use any of course, changing the 120 to reflect it.

    This is a universal snippet, and will give you the damage/healing/drain (with variance) for any skill (on any actor) with a damage type.
     
    Last edited by a moderator: Jun 20, 2014
    #2
    Bonkers and Archeia like this.
  3. Bonkers

    Bonkers Lacking Sleep Restaff

    Messages:
    2,917
    Likes Received:
    2,764
    Location:
    New York
    First Language:
    English
    Primarily Uses:
    RMMV
    Works perfectly, thank you Mundy.  

    Quick question, can this snippet be expanded upon to show element type of damage along with the numerical value possibly color coded text?  Like Fire in red, Ice in White, etc.
     
    #3
  4. mundywoof

    mundywoof Warper Member

    Messages:
    2
    Likes Received:
    3
    First Language:
    English
    class Window_Help < Window_Base def set_item(item) damage_type = ["none", "HP damage", "MP damage", "HP recovery", "MP recovery", "HP drain", "MP drain"] damage_color = [ "", "1", #Physical "2", #Absorb "3", #Fire "4", #Ice "5", #Thunder "6", #Water "7", #Earth "8", #Wind "9", #Holy "10", #Dark "11", #Law "12", #Chaos "13", #Good "14", #Evil "15", #Neutral "16"] #Sonic if item then if item.is_a?(RPG::Skill) && item.damage.none? != 0 then result = item.description.to_s.clone result.gsub!(/\$DT/i) { damage_type[item.damage.type] } if item.damage.element_id != 0 then result.gsub!(/\$DC/i) { "\\C["+damage_color[item.damage.element_id]+"]" } result.gsub!(/\$DN/i) { $data_system.elements[item.damage.element_id] } end set_text(result) else set_text(item.description) end else set_text("") end endendclass Window_SkillList < Window_Selectable def update_help if item if item.damage.none? != 0 then $game_variables[120] = (item.damage.eval(@actor, @actor, $game_variables).to_i).abs end end @help_window.set_item(item) endendSnippet update. \o/

    Generic Usage in a Description:

    $DT returns the damage type of the skill (HP damage, MP drain, etc)

    $DN returns the name of the damage element (Physical, Fire, Holy)

    $DC applies a pre-defined color to the following text, based on damage type.

    Four things to note:

    1) $DC adds in the listed color for the damage type.  Whatever is colored needs to be followed by \C[0] to return the text to normal color. The script can never do this magically.

    2) $DN will apply the name of the damage element. (this entire code block is skipped if "none" is set)

    3) The array of colors (damage_colors) isn't properly set (generic 1-16), and is based on the number of elements in Silver Town. (Meaning if someone else wishes to use this snippet, they may need to edit the length of this array, as well as which colors each uses.)

    4) If the damage type of the skill is set to "none", none of this will work. :)

    (I used $D's in this since \D is a reserved escape character used in regexp. In case anyone was wondering.)

    Edit: Oops. Made a boo-boo, need to check if the item is actually a skill before checking damage and such. x.x
     
    Last edited by a moderator: Jun 20, 2014
    #4
    Bonkers likes this.
  5. Bonkers

    Bonkers Lacking Sleep Restaff

    Messages:
    2,917
    Likes Received:
    2,764
    Location:
    New York
    First Language:
    English
    Primarily Uses:
    RMMV
    [​IMG]

    Seems to work fantastic thank you!
     
    #5
Thread Status:
Not open for further replies.

Share This Page