AJNR 156 Posted August 27, 2013 (edited) I want to create a Script that archives specifically Custom Damage Formulae for Skills that have the Script Call within their Damage box. This is because a bunch of ideas I have exceed the Character Limit of 100, I googled for Scripts made for this specific reason and found none. I just want to know the template for creating a Custom Skill Formula within the script. i.e., is the template go as follows? module Custom_Damage_Formulae class Game_Battler < Game_BattlerBase #======================================================================================= # Antipode Tempest Skill Formula # 'b.xstat.Arm' is a custom term from Nelderon's N.A.S.T.Y Stats #======================================================================================= def Antipode_Tempest(a, basedamage = ((a.mat * 8) * (v[150]/100.to_f)) - b.xstat.Arm * (a.mat / b.mdf.to_f) actualdamage = basedamage actualdamage end #======================================================================================= # Reverent Defense Skill Formula # #======================================================================================= def Reverent_Defense(a, c = ($game_party.alive_members.count / $game_troop.alive_members.count.to_f) basedamage = if c>=3; a.add_state(40); elseif c==2; a.add_state(41); else; a.add_state(42);end actualdamage = basedamage actualdamage end #======================================================================================= # Example Skill 03 # #======================================================================================= def Example_Skill_03(a, basedamage = (a.atk * 4) - (b.def * 2) actualdamage = basedamage actualdamage end #======================================================================================= # Example Skill 04 # #======================================================================================= def Example_Skill_04(a, basedamage = (a.atk ** 3) - (b.def ** 2) actualdamage = basedamage actualdamage end end end Then the Custom Formulae would be called by: b.antipode_tempest a.reverent_defense Would this be an example of a correct template? Is there anything I can do to make it more tidy or improvise it? You don't need to re-write this whole code into the correct format - I just would a single template that would help me make more. Thank you for your assistance and spectatorship Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Xypher 176 Posted August 27, 2013 there isnt really a right nor wrong way you can do this just how you are comfortable writing them. you can even just write it as you would in the formula box using semicolons for line breaks. however v[x] wont work so you'll have to type out $game_variables[x] i added the usage in the comments above the formula class Game_Battler < Game_BattlerBase #======================================================================================= # Antipode Tempest Skill Formula # 'b.xstat.Arm' is a custom term from Nelderon's N.A.S.T.Y Stats # a.Antipode_Tempest(a, #======================================================================================= def Antipode_Tempest(a, (a.mat * 8) * ($game_variables[150]/100.to_f) - b.xstat.Arm * (a.mat / b.mdf.to_f) end #======================================================================================= # Reverent Defense Skill Formula # a.Reverent_Defense(a, #======================================================================================= def Reverent_Defense(a, c = ($game_party.alive_members.count / $game_troop.alive_members.count.to_f) if c >= 3 a.add_state(40) elsif c==2 a.add_state(41) else a.add_state(42) end end #======================================================================================= # Example Skill 03 # a.Example_Skill_03(a, #======================================================================================= def Example_Skill_03(a, a.atk * 4 - b.def * 2 end #======================================================================================= # Example Skill 04 # a.Example_Skill_04(a, #======================================================================================= def Example_Skill_04(a, a.atk ** 3 - b.def ** 2 end end 1 Share this post Link to post Share on other sites
Wren 179 Posted August 27, 2013 Holy cow. Any chance of this becoming a full fledged script with a library of super awesome custom formulae skills with descriptions for people to use? 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) @Xypher Thanks! Is it strange that I need an additional "end" at the end? Because I had to put another one in for it to start without error @Wren Thanks But there's only one real skill in those 4. "Antipode Tempest" is a fake and used as an example, but if you request such a thing, I could try. I'm not at all good at making scripts from scratch. Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Wren 179 Posted August 27, 2013 I think if you take the stuff from the custom formulae thread and made a script that set them up as options to use, I could find it very useful, especially if more could be added later. It would help me create the skills database much faster on my project if I could use a library of cool and different custom formulae. 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 Okay, I'll start off with basic effects from Yanfly's Lunatic Scripts. I'm pretty sure I can get it done. I would add stuff from my Project, but it's mechanics are different from other projects. PM what type of effects you want and I'll have a go. Share this post Link to post Share on other sites
Xypher 176 Posted August 27, 2013 (edited) heres something to get started not sure if i tested them all so if one doesnt work reply here. class Game_Battler < Game_BattlerBase #a.recoil_attack(a,b,0.5) #Attacks with the default attack formula but user takes recoil% of the damage too #Does not account for variance nor criticals def recoil_attack(a,b,recoil) c = a.atk * 4 - b.def * 2 a.hp -= (c * recoil).to_i c end #a.recoil_attack(a,b,0.2,"hp") #Attacks with the default attack formula and transfers leech% of damage to user's hp/mp #Does not account for variance nor criticals def leech_attack(a,b,leech,type) c = a.atk * 4 - b.def * 2 case type when "hp"; a.hp += (c * leech).to_i when "mp"; a.hp += (c * leech).to_i end c end #a.buff_attack(a,b,"atk",5) #Attacks with the default attack formula and adds param buff for x turns def buff_attack(a,b,param,turns) case param when "mhp"; a.add_buff(0, turns) when "mmp"; a.add_buff(1, turns) when "atk"; a.add_buff(2, turns) when "def"; a.add_buff(3, turns) when "mat"; a.add_buff(4, turns) when "mdf"; a.add_buff(5, turns) when "agi"; a.add_buff(6, turns) when "luk"; a.add_buff(7, turns) end a.atk * 4 - b.def * 2 end #a.crit_attack(a, #Guaranteed critical attack def crit_attack(a, b.result.critical = true a.atk * 4 - b.def * 2 end #a.demi(a, #Deals half the target's current hp as damage #Set variance to 0 #This skill cannot kill #Damage is truncated in the event of a float def demi(a, b.guard? ? (b.hp / 2) * ignore_guard(b.grd) : b.hp / 2 end #a.revenge_attack(a, #Skill deals more damage depending on how much hp the user is missing def revenge_attack(a, (a.atk * 4 - b.def * 2) * (2 - a.hp_rate) end #a.consume_tp(a, #Consumes all tp and does extra damage depending on how much consumed def consume_tp(a, mod = 1 + (3 * a.tp_rate) a.tp = 0 (a.atk * 4 - b.def * 2) * mod end #a.state_strike(a, #Cycles through states each time the skill is used def state_strike(a, s = [nil,2,3,3,4,5,6,7,8,1] @use_count = 0 if @use_count == s.size || @use_count.nil? @use_count += 1 b.add_state(s[@use_count]) a.atk * 4 - b.def * 2 end #a.antimage(a, #Deal damage to mp as well as hp def antimage(a, c = a.atk * 4 - b.mdf * 2 b.mp -= c c end #a.switch_hp(a, #Switches the user's hp ratio with the targets def switch_hp(a, c = a.hp_rate d = b.hp_rate a.hp = a.mhp * d b.hp = b.mhp * c 0 end #a.weapon_strike(a,b,2) #Deals damage based on the weapon's atk def weapon_strike(a,b,multiplier = 1) a.wa * multiplier - b.def * 2 end #a.leveldeath(a,b,5) #Inflicts the death state on the target if their level is a multiple of factor def leveldeath(a,b,factor = 5) if b.level % factor == 0 b.add_state(b.death_state_id) end 0 end #a.party_syphon(a,b,"hp",true) #Heals the user's party's hp/mp for the damage dealt #Does not account for variance nor criticals def party_syphon(a,b,type,split = true) c = a.atk * 4 - b.def * 2 case type when "hp" a.alive.each do |i| split ? i.hp += (c / a.alive).to_i : i.hp += c end when "mp" a.alive.each do |i| split ? i.mp += (c / a.alive).to_i : i.hp += c end end c end #usage scope: All Allies #a.whitewind(a, #Heals all allies for the caster's current hp def whitewind(a, @lc = 1 if @lc.nil? @thp = a.hp if @thp.nil? if @lc == a.alive @lc = 1 @thp2 = @thp @thp = nil else @lc += 1 end @thp.nil? ? @thp2 : @thp end def alive actor? ? $game_party.alive_members.size : $game_troop.alive_members.size end def ignore_guard(iguard) 2 * iguard end end class Game_BattlerBase #Total param of battler def param_total m = 0 6.times do |i| m += param(i+2) end return m end end class Game_Actor < Game_Battler #Total Attack of Actor's Weapons def wa if dual_wield? && weapons[1] != nil weapons[0].params[2] + weapons[1].params[2] else weapons[0].params[2] end end #Total Params of Actor's Weapons def wp(param_id) if dual_wield? && weapons[1] != nil weapons[0].params[param_id] + weapons[1].params[param_id] else weapons[0].params[param_id] end end #Total Params of Actor's Armors def ap(param_id) m = 0 armors.size.times do |i| m += armors[i].params[param_id] end return m end end Edited August 27, 2013 by Xypher 1 Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 (edited) I actually use a lot of custom damage formulas for abilities in my project (in fact, they're set up almost the same way here). The only thing I see that's incorrect there is, I think in the Damage Formula box, you'd have to include the (a, part of it. As in, "b.antipode_tempest(a, b)" would be the Damage Formula call in the skill's database tab. Here's a few special skills I was working on. First up is Goblin Punch (a skill that deals damage, but increases it if the user's level matches the enemy's "level" (since enemies don't have levels, I used Luck) #-------------------------------------------------------------------------- # * Determine default Goblin Punch formula [allies] #-------------------------------------------------------------------------- def goblin_punch(a, basedamage = a.level if a.level == b.luk # Feel free to swap Luck for any other stat actualdamage = (basedamage.to_i + a.level) * a.level else actualdamage = basedamage.to_i + a.level end actualdamage.to_i end Next is Shatter, a magic spell that deals damage, but increases the damage if the enemy is affected by Reflect status. #-------------------------------------------------------------------------- # * Determine damage formula for "Shatter" Black Magic #-------------------------------------------------------------------------- def bm_shatter(a, b, powerlevel, multiplier) if b.state?(32) # Change 32 to whatever ID you're using for Reflect basedamage = 6 * (a.level + a.mat) maxdamage = ((powerlevel.to_i * (512 - b.mdf) * basedamage.to_i) / (16 * 512)) finaldamage = (maxdamage.to_i * multiplier.to_f) * 1.5 else basedamage = 6 * (a.level + a.mat) maxdamage = ((powerlevel.to_i * (512 - b.mdf) * basedamage.to_i) / (16 * 512)) finaldamage = maxdamage.to_i * multiplier.to_f end finaldamage.to_i end In the skill's database, you'd input the damage formula as "b.bm_shatter(a, b, powerlevel, multiplier)" where powerlevel and multiplier are user-defined. It could be something like... b.bm_shatter(a, b, 24, 1.345) Finally, here's Fixed Dice, an ability that determines damage based on the outcome of rolling three die. #-------------------------------------------------------------------------- # * Determine damage formula for "Fixed Dice" Limit Break #-------------------------------------------------------------------------- def fixed_dice(a, # Randomize dice variables $game_variables[51] = 1 + rand(6).to_i # 6 represents the no. of sides on die $game_variables[52] = 1 + rand(6).to_i # Change if you wish $game_variables[53] = 1 + rand(6).to_i # Remember to set variable IDs # Set dice variables die1 = $game_variables[51] die2 = $game_variables[52] die3 = $game_variables[52] # Determine final damage formula finaldamage = die1 * die2 * die3 * a.level * 2 # Execute damage formula finaldamage.to_i end Basically, you're using three in-game variables to set the damage when the skill is used. 1 + rand(6) is giving you a result of 1-6 (the sides on the dice) and then the damage formula takes over from there. I think the minimum damage on this is 2 and the max damage on this is somewhere around 42,000. And here's Gil Toss. It deals damage based on the amount of gold you have and the number of remaining enemy targets, making it more deadly when used against a single enemy. I used Yanfly's Skill Cost Manager to set this ability's cost at 10% of the party's current gold, so the damage always matches. #-------------------------------------------------------------------------- # * Determine damage formula for "Gil Toss" Command Ability #-------------------------------------------------------------------------- def gil_toss(a, gil = $game_party.gold numtargets = $game_troop.alive_members.size finaldamage = ((gil + gil / 10) / 10) / numtargets finaldamage.to_i end Since you lose 10% of your gold when you use the skill, it gets added back into the damage formula to keep the damage honest. Without Yanfly's script, you could also just use a script call in the damage formula to subtract 10% of the party's gold after dealing damage. I'll post a few more later on. Hope that helps! Edited August 27, 2013 by William C 1 Share this post Link to post Share on other sites
Xypher 176 Posted August 27, 2013 (edited) class Game_Battler < Game_BattlerBase #a.recoil_attack(a,b,0.5) #Attacks with the default attack formula but user takes recoil% of the damage too #Does not account for variance nor criticals def recoil_attack(a,b,recoil) c = a.atk * 4 - b.def * 2 a.hp -= (c * recoil).to_i c end #a.recoil_attack(a,b,0.2,"hp") #Attacks with the default attack formula and transfers leech% of damage to user's hp/mp #Does not account for variance nor criticals def leech_attack(a,b,leech,type) c = a.atk * 4 - b.def * 2 case type when "hp"; a.hp += (c * leech).to_i when "mp"; a.hp += (c * leech).to_i end c end #a.buff_attack(a,b,"atk",5) #Attacks with the default attack formula and adds param buff for x turns def buff_attack(a,b,param,turns) case param when "mhp"; a.add_buff(0, turns) when "mmp"; a.add_buff(1, turns) when "atk"; a.add_buff(2, turns) when "def"; a.add_buff(3, turns) when "mat"; a.add_buff(4, turns) when "mdf"; a.add_buff(5, turns) when "agi"; a.add_buff(6, turns) when "luk"; a.add_buff(7, turns) end a.atk * 4 - b.def * 2 end #a.crit_attack(a, #Guaranteed critical attack def crit_attack(a, b.result.critical = true a.atk * 4 - b.def * 2 end #a.demi(a, #Deals half the target's current hp as damage #Set variance to 0 #This skill cannot kill #Damage is truncated in the event of a float def demi(a, b.guard? ? (b.hp / 2) * b.ignore_guard : b.hp / 2 end #a.revenge_attack(a, #Skill deals more damage depending on how much hp the user is missing def revenge_attack(a, (a.atk * 4 - b.def * 2) * (2 - a.hp_rate) end #a.consume_tp(a, #Consumes all tp and does extra damage depending on how much consumed def consume_tp(a, mod = 1 + (3 * a.tp_rate) a.tp = 0 (a.atk * 4 - b.def * 2) * mod end #a.state_strike(a, #Cycles through states each time the skill is used def state_strike(a, s = [nil,2,3,3,4,5,6,7,8,1] @use_count = 0 if @use_count == s.size || @use_count.nil? @use_count += 1 b.add_state(s[@use_count]) a.atk * 4 - b.def * 2 end #a.antimage(a, #Deal damage to mp as well as hp def antimage(a, c = a.atk * 4 - b.mdf * 2 b.mp -= c c end #a.switch_hp(a, #Switches the user's hp ratio with the targets def switch_hp(a, c = a.hp_rate d = b.hp_rate a.hp = a.mhp * d b.hp = b.mhp * c 0 end #a.weapon_strike(a,b,2) #Deals damage based on the weapon's atk def weapon_strike(a,b,multiplier) a.wa * multiplier - b.def * 2 end #a.leveldeath(a,b,5) #Inflicts the death state on the target if their level is a multiple of factor def leveldeath(a,b,factor) if b.level % factor == 0 b.add_state(death_state) end 0 end #a.party_syphon(a,b,"hp",true) #Heals the user's party's hp/mp for the damage dealt #Does not account for variance nor criticals def party_syphon(a,b,type,split) c = a.atk * 4 - b.def * 2 case type when "hp" a.alive.each do |i| split ? i.hp += (c / a.alive).to_i : i.hp += c end when "mp" a.alive.each do |i| split ? i.mp += (c / a.alive).to_i : i.hp += c end end c end #usage scope: All Allies #a.whitewind(a, #Heals all allies for the caster's current hp def whitewind(a, @lc = 1 if @lc.nil? @thp = a.hp if @thp.nil? if @lc == a.alive.size @lc = 1 @thp2 = @thp @thp = nil else @lc += 1 end @thp.nil? ? @thp2 : @thp end #a.dispel(a,b,14,15,16,17,18,19,21,22,23,24,25) #removes all buffs and selected states from the target def dispel(a,b,*args) args.each do |i| b.remove_state(i) end end #a.fullcure(a,b,2,3,4,5,6,7) #fully heals the target and removes selected states #damage type: hp recover def fullcure(a,b,*args) args.each do |i| b.remove_state(i) end b.mhp end #a.cleave(a,b,0.5) #does full damage to the target and percentage damage to the rest def cleave(a,b,percentage) c = a.atk * 4 - b.def * 2 p "1" p b.alive b.alive.each do |i| next if b == i p i i.hp -= (c * percentage).to_i end p c c end #a.random_strike(a,b,2,3,4,5,6,7) #adds a random state to the attack def random_strike(a,b,*args) b.add_state(args.sample) a.atk * 4 - b.def * 2 end end class Game_BattlerBase #Total param of battler def param_total m = 0 6.times do |i| m += param(i+2) end return m end def alive actor? ? $game_party.alive_members : $game_troop.alive_members end def ignore_guard 2 * grd end end class Game_Actor < Game_Battler #Total Attack of Actor's Weapons def wa if dual_wield? && weapons[1] != nil weapons[0].params[2] + weapons[1].params[2] else weapons[0].params[2] end end #Total Params of Actor's Weapons def wp(param_id) if dual_wield? && weapons[1] != nil weapons[0].params[param_id] + weapons[1].params[param_id] else weapons[0].params[param_id] end end #Total Params of Actor's Armors def ap(param_id) m = 0 armors.size.times do |i| m += armors[i].params[param_id] end return m end end added a few more and fixed party_syphon Edited August 27, 2013 by Xypher 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) Woah, these posts are friggin' awesome (and I hate that word) Thanks for the advice and help. A lot of reference I can get here so I'm going to favorite it. I haven't read everything so far since I can't (as of right now) but I'm sure with these two posts I can find myself a solution to the following problem. The Reverent Defense Skill doesn't execute as planned, I tested and checked the numbers and looked over states. I rewrote the first formula since it was wrong: Right Version (Enemy Variant) ($game_troop.members.count - $game_troop.alive_members.count) Wrong Version ($game_party.alive_members.count / $game_troop.alive_members.count.to_f) Once I get to read the whole posts I might be able to find out what's wrong. The Skill is to apply State A if the User has equal to or more than 3 Allies KO'd, State B if 2 Allies KO'd, State C if 1 Ally KO'd and nothing if everyone's alive. I tried it on both Enemy and Actor (both to their respective variants) and it seems to come back with "Failed". Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 (edited) Try $game_party.alive_members.size for that. Use a case statement. living_allies = $game_party.alive_members.size case living_allies when 1 # 3 Dead Allies a.add_state(n) when 2 # 2 Dead Allies a.add_state(n) when 3 # 1 Dead Ally a.add_state(n) end Change n to the State ID you want to use for each result. I am unsure whether this will reference the number of battle members alive or total party members alive. Try it out. Edited August 27, 2013 by William C Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) I believe that the function you're using will account for all Actors in and out of the Battle Party. The correct term for Battle Members would be: $game_party.battle_members.count But I don't know how to catch "Alive" Battle Members But I seem to be doing wrong on my side. I changed the function to your example: #======================================================================================= # Sg_Reverent Defense Skill Formula # a.Sg_Reverent_Defense(a, #======================================================================================= def Sg_Reverent_Defense(a, living_allies = $game_troop.alive_members.count case living_allies when 1 # 3 Dead Allies a.add_state(40) when 2 # 2 Dead Allies a.add_state(41) when 3 # 1 Dead Ally a.add_state(42) end When the User (Enemy) is casting it after a Ally is KO'd, it still returns failed. I set a Variable to get the number for: $game_troop.alive_members.count And it returns the correct number: 3, 2, 1. But for some reason it fails on the User. The function in the Skillbox is: a.Sg_Reverent_Defense(a, The Skill is Certain Hit, Type is HP Damage, and is "Cast-able" Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Riff 62 Posted August 27, 2013 I believe that the function you're using will account for all Actors in and out of the Battle Party. The correct term for Battle Members would be: $game_party.battle_members.count But I don't know how to catch "Alive" Battle Members living_allies = [] $game_party.battle_members.each{|actor| living_allies << actor if actor.alive? } number_living_allies = living_allies.count This should work 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) Thanks for the help, inserted it into the Actor Variant of the Skill. I'll try testing it out again with this. It seems to catch the right number, but fails to add the state. All of you are great, the help is beyond what I expected. Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 (edited) Because that snippet is incomplete. That's how you'd get the number of living battle members. You'd still need to add the case afterwards to determine what to do with that result. Here's what I did with it while testing in my project. I had it add 1 state for 1 dead ally, 2 states for two, etc. I also added a line for what to do if everyone is alive (0 dead allies). I then tested it with 7 total party members, everything worked like a charm. #-------------------------------------------------------------------------- # * Determine functionality for "Desperate Defense" ability #-------------------------------------------------------------------------- def desperate_defense(a, living_allies = [] $game_party.battle_members.each{|actor| living_allies << actor if actor.alive? } number_living_allies = living_allies.count case number_living_allies when 0 # No Dead Allies nil # Do nothing when 1 # 3 Dead Allies a.add_state(57) # Apply Protect a.add_state(64) # Apply Shell a.add_state(61) # Apply Regen when 2 # 2 Dead Allies a.add_state(57) # Apply Protect a.add_state(64) # Apply Shell when 3 # 1 Dead Ally a.add_state(57) # Apply Protect end end If this skill is one that affects a party member like I have it set, set it up as HP Recover, put "b.reverent_defense(a, b)" in the damage formula box and give it 0 variance and no critical or element. If it deals damage to an enemy and adds these states based on the number of living party members, change a.add_state(n) in the code to b.add_state(n) and throw in your damage formula between the two end calls. Edited August 27, 2013 by William C Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 Jeez, I set the Scope and Variance to what you said, and it still doesn't apply. Should I post the Project for a better inspection? (ie. Image, .rvproj2) I tested it in the Troop Manager and Debug Test. I also tested this in a seperate Project and still returns nothing. I wonder what the issue is because the formula seems flawless to me. Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 I just edited my last post. Try it with that. It works flawlessly for me. Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) Ok, I'm doing something wrong. Is it the function I put in the skillbox? I tested it in a Vanilla Project. I also tested a simple skill in the script that returns: def Antipode_Tempest(a, (a.mat * 8) + 100 end I used this to call it in the Skillbox b.Antipode_Tempest(a, This also returned nothing. This was in a Vanilla Project. EDIT: Could it be the ending of my script that's disrupting it? Script module Custom_Damage_Formulae class Game_Battler < Game_BattlerBase #======================================================================================= # Antipode Tempest Skill Formula # 'b.xstat.Arm' is a custom term from Nelderon's N.A.S.T.Y Stats # a.Antipode_Tempest(a, #======================================================================================= def Antipode_Tempest(a, (a.mat * 8) + 100 end #======================================================================================= # Sg_Reverent Defense Skill Formula # a.Reverent_Defense(a) #======================================================================================= def Sg_Reverent_Defense(a, living_allies = $game_troop.alive_members.count case living_allies when 1 # 3 Dead Allies b.add_state(1) when 2 # 2 Dead Allies b.add_state(1) when 3 # 1 Dead Ally b.add_state(1) end #-------------------------------------------------------------------------- # * Determine functionality for "Desperate Defense" ability #-------------------------------------------------------------------------- def desperate_defense(a, living_allies = [] $game_party.battle_members.each{|actor| living_allies << actor if actor.alive? } number_living_allies = living_allies.count case number_living_allies when 0 # No Dead Allies nil # Do nothing when 1 # 3 Dead Allies a.add_state(1) # Apply Protect a.add_state(2) # Apply Shell a.add_state(3) # Apply Regen when 2 # 2 Dead Allies a.add_state(1) # Apply Protect a.add_state(2) # Apply Shell when 3 # 1 Dead Ally a.add_state(1) # Apply Protect end end end end end Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 (edited) Is there a reason there's a module being made at the top there? There's no reason to make a module for custom damage formulas. You only need to add code to Game_BattlerBase. EDIT: Also, just use lowercase method names. Make your life easier. EDIT2: Your Reverent Defense method is missing an end call on the bottom of it. Edited August 27, 2013 by William C 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 Is there a reason there's a module being made at the top there? There's no reason to make a module for custom damage formulas. You only need to add code to Game_BattlerBase. EDIT: Also, just use lowercase method names. Make your life easier. Ehhhhhhh - FIXED The State Applied when I removed it Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 Here's another one I just finished up. Anyone familiar with the Curasa spell from Final Fantasy will understand this one. It's a healing spell that restores HP based on the amount of damage the target has taken. If the target is almost fully healed, the spell will not restore a lot of HP, so it is best used on party members who are near-death. #-------------------------------------------------------------------------- # * Determine default formula for "Curasa" Essence Ability [allies] #-------------------------------------------------------------------------- def curasa(a, basedamage = b.mhp - b.hp actualdamage = basedamage.to_i / 100 damagemod = b.mhp * actualdamage.to_f finaldamage = (damagemod.to_i / 3) + 1 finaldamage.to_i end Enjoy. Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) Should we create a Topic with contributions of custom skills? And, I have something similar. I created "Universal" Med-Kits / Healing Potions that have a base that increases with lower Health: #-------------------------------------------------------------------------- # * Healing Kit (ie. b.healing_kit(a,b,250,0.75)) #-------------------------------------------------------------------------- def healing_kit(a, b, base_amount, handicap_value) baseheal = base_amount rate = 2 - (a.hp / a.mhp.to_f).to_f handicap = handicap_value heal = baseheal * rate * handicap_value heal.to_i end Healing Kits in my Project require some several turns and have a higher base, higher starting rate and lower fluctuation Then I have Healing Potions that are immediate use but have a lower base, lower starting rate and higher fluctation #-------------------------------------------------------------------------- # * Healing Potion (ie. b.healing_kit(a,b,50,1.25)) #-------------------------------------------------------------------------- def healing_potion(a, b, base_amount, handicap_value) baseheal = base_amount rate = 1 - (a.hp / a.mhp.to_f).to_f handicap = handicap_value heal = baseheal * rate * handicap_value heal.to_i end 84/225 HP using a Healing Kit restores 305 HP at Base of 250 and 0.75 Handicap (Function: b.healing_kit(a,b,250,0.75) ) 84/225 HP using a Healing Kit restores 63 HP at Base of 50 and 1.25 Handicap (Function: b.healing_kit(a,b,50,1.25) ) I edited my formula to be User Friendly, recommended settings are: Healing Kit's Base should be about 1/2 of Average Actor's MHP; Healing Kit's Handicap is 3/4 (0.75) Healing Potion Base is 1/5 of Healing Kit Base; Healing Potion's Handicap is 4/3 (1.25) Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 Here's another unique healing ability, Bolster. It heals HP, and the HP healed is increased for every positive status condition on the target. I have a similar skill in place that deals damage and increases the damage for every negative status condition affecting the target. #-------------------------------------------------------------------------- # * Determine damage formula for "Bolster" Red Magic #-------------------------------------------------------------------------- def bolster(a, b, powerlevel, multiplier) basedamage = 6 * (a.mat + a.level) for i in [45,46,47,48,49,50,51,52,53,54,55,56,56,57,58,59,60,61,62,63,64,65,66,67] # Input positive State IDs here if b.state?(i) powerlevel += 0.5 # Increases powerlevel half a point for each state returned else powerlevel += 0 end end actualdamage = basedamage.to_i + 22 * powerlevel.to_f actualdamage.to_i end 1 Share this post Link to post Share on other sites
AJNR 156 Posted August 27, 2013 (edited) So - Custom Skill Formulas is a go? Community Contribution Topic? Would it go into Completed Ace Scripts or General RM Discussion? Edited August 27, 2013 by AJNR Share this post Link to post Share on other sites
Coolie 148 Posted August 27, 2013 The only problem is that people use different base formulas for their damage and healing and whatnot. People would have to be careful to let users know where to input their regular damage formulas within these unique effect formulas. Share this post Link to post Share on other sites