Is it possible to create such skills?

Murd

Apprentice
Member
Joined
Jan 28, 2015
Messages
112
Reaction score
7
First Language
Thai
Primarily Uses
Need help to create skills by using formula box or snippet.

Soul Eater - skill deals damage to one enemy and if the enemy dies by this skill, you gain some HP.

Lightning Strike - hit one selected enemy for some damage then the damage split by half to besides targets (left and right of the selected target). Eg. Slame A, B, C appear. You use Lightning Strike on B for 1,000 damage first then Slame A and C also take 500 damage. If your Lightning Strike hits Slame A or C then only B will take the split damage.

Thanks!
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Theoretically everything is possible - but your ideas are a bit tricky.


The first one would require either a lot of complex eventing or a script specifically for it.


The second idea absolutely requires scripting as it would need a different targeting and damage distribution effect.
 

xiaden

Definitely not a cat
Member
Joined
Jun 13, 2014
Messages
7
Reaction score
0
First Language
English
Primarily Uses
Check out the battle engine yanfly hosts over at: https://github.com/Archeia/YEARepo . The Lunatic battle stuff in particular can very easily alter skills to do what you want the first one to do, the second requires a bit more work to really accomplish.  I don't know of a battle system off the top of my head that accounts for exact enemy placements.  At best, you'd spread to Enemy A and C regardless of location (EG: one is set up behind the others, it would still get hit by a lunatic multi-enemy attack).

either way, you definitely need some RGSS knowledge to really step into the world of feature ridden skills like that.  Best to Keep it simple if you're not looking to delve into all that complex stuff.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
class Scene_Battle < Scene_Base

  attr_accessor :log_window

end

 

class Game_Battler < Game_BattlerBase

 

def manual_make_damage_value(value, subject, item)

    value *= item_element_rate(subject, item)

    value *= mdr

    value = apply_critical(value) if @result.critical

    value = apply_variance(value, item.damage.variance)

    value = apply_guard(value)

    @result.make_damage(value.to_i, item)

  end

  

  def custom_formula_lightningstrike(a, b )

    log_window = SceneManager.scene.log_window

    targets =

    targets = targets |= [$game_troop.alive_members[[b.index-1, 0].max]]

    targets = targets |= [$game_troop.alive_members[[b.index+1, $game_troop.alive_members.size-1].min]]

    item = a.current_action.item

    targets.each_with_index { |target, index|

      standard_formula = 200 + a.mat * 2 - target.mdf * 2

      target.result.clear

      target.result.used = item_test(a, item)

      target.result.missed = (target.result.used && rand >= item_hit(a, item))

      target.result.evaded = (!target.result.missed && rand < item_eva(a, item))

      if target.result.hit?

        unless item.damage.none?

          target.result.critical = (rand < item_cri(a, item))

          value = standard_formula - (0.5 * standard_formula)

          target.manual_make_damage_value(value, a, item)

          target.execute_damage(a)

          log_window.clear

          log_window.add_text("The lightning jumps!") if index > 0

          log_window.display_action_results(target, item)

        end

      end

    }

    b.result.clear

    return 0

  end

  

  def custom_formula_souleater(a, b )

    log_window = SceneManager.scene.log_window

    standard_formula = a.atk * 4 - b.def * 2

    item = a.current_action.item

    b.result.clear

    b.result.used = item_test(a, item)

    b.result.missed = (b.result.used && rand >= item_hit(a, item))

    b.result.evaded = (!b.result.missed && rand < item_eva(a, item))

    if b.result.hit?

      unless item.damage.none?

        b.result.critical = (rand < item_cri(a, item))

        b.manual_make_damage_value(standard_formula, a, item)

        damage = b.result.hp_damage

        b.execute_damage(a)

        log_window.display_action_results(b, item)

      end

    end

    if b.hp <= 0 && a.hp < a.mhp

      heal = [(-damage * 0.4), -(a.mhp - a.hp)].max.to_i

      a.manual_make_damage_value(heal, a, item)

      a.execute_damage(a)

      log_window.clear

      log_window.add_text(sprintf("%s is healed for %d HP by the strike!", a.name, heal.abs))

      log_window.display_action_results(a, item)

    end

    b.result.clear

    return 0

  end

end

 

Add this as a new script above main, then in your skill formula put either a.custom_formula_lightningstrike(a, b ) or a.custom_formula_souleater(a, b ). Remember to replace the standard_formula with whatever calculation you're using.
 
Last edited by a moderator:
  • Like
Reactions: BCj

Murd

Apprentice
Member
Joined
Jan 28, 2015
Messages
112
Reaction score
7
First Language
Thai
Primarily Uses
class Scene_Battle < Scene_Base

attr_accessor :log_window

end

class Game_Battler < Game_BattlerBase

def manual_make_damage_value(value, subject, item)

value *= item_element_rate(subject, item)

value *= mdr

value = apply_critical(value) if @result.critical

value = apply_variance(value, item.damage.variance)

value = apply_guard(value)

@result.make_damage(value.to_i, item)

end

def custom_formula_lightningstrike(a, b )

log_window = SceneManager.scene.log_window

targets =

targets = targets |= [$game_troop.alive_members[[b.index-1, 0].max]]

targets = targets |= [$game_troop.alive_members[[b.index+1, $game_troop.alive_members.size-1].min]]

item = a.current_action.item

targets.each_with_index { |target, index|

standard_formula = 200 + a.mat * 2 - target.mdf * 2

target.result.clear

target.result.used = item_test(a, item)

target.result.missed = (target.result.used && rand >= item_hit(a, item))

target.result.evaded = (!target.result.missed && rand < item_eva(a, item))

if target.result.hit?

unless item.damage.none?

target.result.critical = (rand < item_cri(a, item))

value = standard_formula - (0.5 * standard_formula)

target.manual_make_damage_value(value, a, item)

target.execute_damage(a)

log_window.clear

log_window.add_text("The lightning jumps!") if index > 0

log_window.display_action_results(target, item)

end

end

}

b.result.clear

return 0

end

def custom_formula_souleater(a, b )

log_window = SceneManager.scene.log_window

standard_formula = a.atk * 4 - b.def * 2

item = a.current_action.item

b.result.clear

b.result.used = item_test(a, item)

b.result.missed = (b.result.used && rand >= item_hit(a, item))

b.result.evaded = (!b.result.missed && rand < item_eva(a, item))

if b.result.hit?

unless item.damage.none?

b.result.critical = (rand < item_cri(a, item))

b.manual_make_damage_value(standard_formula, a, item)

damage = b.result.hp_damage

b.execute_damage(a)

log_window.display_action_results(b, item)

end

end

if b.hp <= 0 && a.hp < a.mhp

heal = [(-damage * 0.4), -(a.mhp - a.hp)].max.to_i

a.manual_make_damage_value(heal, a, item)

a.execute_damage(a)

log_window.clear

log_window.add_text(sprintf("%s is healed for %d HP by the strike!", a.name, heal.abs))

log_window.display_action_results(a, item)

end

b.result.clear

return 0

end

end

Add this as a new script above main, then in your skill formula put either a.custom_formula_lightningstrike(a, b ) or a.custom_formula_souleater(a, b ). Remember to replace the standard_formula with whatever calculation you're using.
This looks amazing! Need to do some settings for skill damage and try whether the skills work.

Anyway, thank you for your scripts Trihan.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
If you have any issues let me know.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Soul Eater - skill deals damage to one enemy and if the enemy dies by this skill, you gain some HP.
You can also try this damage formula with variance set as 0:

dmg = apply_guard(apply_variance(original_damage_formula, var)); dmg = apply_critical(dmg) if b.result.critical; a.hp += some_hp if b.hp - dmg <= 0 && !b.state_resist?(death_state_id); dmgYou may want to try this simpler form instead:

dmg = original_damage_formula * (1 - var + rand(var) * 2) / 2 / b.grd; dmg *= 3 if b.result.critical; a.hp += some_hp if b.hp - dmg <= 0 && !b.state_resist?(death_state_id); dmgUnfortunately, even the simpler form will still likely be too long lol
 
Last edited by a moderator:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
I don't think that fits in the box and it also won't show a message with the HP gained, though I guess if you're using something like Yanfly's battle engine that's a moot point.

Good point that I didn't factor in enemies immune to the death state, though.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top