Is it possible (through a script or a program feature I'm not seeing) to put formulas into skill/item descriptions?
For example, lets say I have a Fireball spell that deals 2 times the player's M.Atk damage, and that actor's M.Atk happens to be 17. When the player highlights the Fireball spell in battle or the menu screen, the description would read "Deals 34 fire damage" (2 times 17 being 34, obviously).
For clarity: my game only uses a single actor and enemy actor stats aren't figured into the damage, as everyone uses percentage based damage reduction.
Damage formula in description box?
● ARCHIVED · READ-ONLY
-
-
I think this post belongs to script request.
First of, I don't see a point for a script here, because you can set up for a skill, that it causes fire damage.
Then you add 17 to the damage formula line, if it shouldn't be influenced by any enemy stat and you're done for the first.
Then you chose repetitions 2 and you done it without a script. ;)
If you want the damage only influenced by enemies def or whatever, then use it like "17 - b.def" for example. (\s/)
But I think, I thought a script that does what you want here. ;) (\s/) -
I'm not sure that cheeky Moon's reply is quite what you were asking for, insofar as 17 happens to be the result in one particular case, not all possible cases, as enemies will vary, and the actor's stats will increase over time.
As far as I know, there is no script or program feature which will dynamically convert a formula to actual numbers in the skill description. That description is static and consists entirely of what you have put into the data base. All you have is the actual amount of damage dealt when the action is completed in the battle screen. But that is after the action, not before it. You could put the actual formula into the skill description, but that will only give the player the basis for how the damage is calculated, not the end result. -
Actually, in my game I have predicted damage for each skill in skill menu.
However, the said damage is not the final result. It just prediction since the formula is calculated based on a dummy enemy which has average base stats from many enemies. For stronger enemy it would be less of course.Spoiler
It's heavily depends on your need and how do you make your database including the damage formula. For me, it just a short dungeon crawl game where the difference stats from the weakest enemy and strongest enemy is not so different. The real problem is just as ksjp17 said. Actual damage is calculated in battle screen. The damage may be vary since there will be any resistances, weakpoints, or anything especially if you put many things in damage formula such as many function call. -
TheoAllen, that's pretty much what I'm aiming for in my game as well. "Predicted damage" is what I should have put in the description.
So it looks like I would need a script to get that predicted damage into the skill description box then.
Thanks for the comments guys :) -
Apparently, it works. Though, you need to prepare the dummy enemy just as I said above
To show damage formula in description window, simply add <formula> in the skill descriptionSpoilerclass Game_System def test_enemy @test_enemy ||= 1 end def test_enemy=(id) @test_enemy = id @enemy = Game_Enemy.new(0, id) end def dummy_enemy @enemy ||= Game_Enemy.new(0, test_enemy) end endclass Window_Help alias predict_damage_set_item set_item def set_item(item) if item if item.respond_to?:)damage) set_text(predict_damage(item)) else set_text(item.description) end else set_text('') end end def predict_damage(item) desc = item.description.gsub(/<formula>/i) do if $game_party.in_battle a = BattleManager.actor else a = $game_party.menu_actor end b = $game_system.dummy_enemy v = $game_variables damage = item.damage.eval(a,b,v) damage * item.repeats end desc end end
If you want to change the dummy enemy in middle of the game, you just need to do script call
Code:$game_system.test_enemy = enemy_id