Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Two Quick & Possibly Easy Things

This is for XP.

1) Does anyone know where to edit the Poison and Confusion stat or a script that makes new ones?  I don't want it to take 1 / 10 of the maximum HP every turn.  I also want Confusion to have a 50% chance of hitting an enemy and a 50% chance of hitting a partner.  Is there a way to change those?

2) Is there a way to have an animation play when getting a critical hit?  I want to have it play right after the attacking animation and before the damage is shown.
 
You can turn off "Slip Damage" on those States in your database.

If you want to change the 10% to a different percentage, look in the "slip_damage_effect" method of the Game_Battler class (Game_Battler 3)

Chance to hit is controlled by the "Hit Rate" of the skill or item that causes the effect.

For a hint on the animation, look at lines 102 - 114 in Sprite_Battler.
You should be able to copy the 2 'animation' lines from the Animation section above the 'damage' line in the Damage section, then use the @battler.critical in an 'if' statement to determine if it's a critical hit.

Be Well
 
      # Damage
      if @battler.damage_pop
        damage(@battler.damage, @battler.critical)
        @battler.damage = nil
        @battler.critical = false
        @battler.damage_pop = false
      if @battler.critical
        animation = $data_animations[@battler.animation_id]
        animation(animation, @battler.animation_hit)
      end

---------------------------------------------------

I didn't do that right, did I?  It says that the last "end" is a syntax error when I try to test the battle.

I got the Poison to work the way I wanted it to, thanks.

I don't understand what you mean for the Confusion thing.  I want the STATE to have a 50% chance of hitting the enemy or partner.
 
Nope, you're checking @battler.critical after it's being reset to 'false'.
You need to include another 'end' statement to go with the new 'if' statement.
And you probably want a different animation.
Try this...

Code:
      # Damage
      if @battler.damage_pop
        if @battler.critical
          critical_animation = $data_animations[101]
          animation(critical_animation, @battler.animation_hit)
        end
        damage(@battler.damage, @battler.critical)
        @battler.damage = nil
        @battler.critical = false
        @battler.damage_pop = false
      end

The "101" is the number of the new animation. Replace it with the number of the animation you want to use.

Now I'm confused on the confusion thing. 
If a character is affected with the "Confuse" state, and scores a HIT, the Hit should be directed at an enemy half of the time, and an ally half of the time? (as opposed to the "Restriction" setting "Always attack allies" or "always attack enemies")
 
I just tested the critical hit, and it does work. The animations, and the "Critical" display go pretty fast, so you may want to make your 'critical' animation have a longer duration (20+ frames).

For the confusion thing, The restriction on the "confuse" state is "Always Attack Allies". In the default system, this is the only state that uses this restriction. (the value of @active_battler.restriction will be 3).

Take a look at the make_basic_action_result method in Scene_Battle 3.

Look for 2 lines that say, "if @active_battler.restriction == 3"  (one for enemy attack, one for actor attack)

There is one line inside that 'if' statement,   "target = ....."   (again, one random_target_enemy, one random_target_actor)

Let's replace the one line with a random statement (50/50), and an 'if' statement to pick an actor or enemy...

Code:
        if @active_battler.restriction == 3
          die_roll = rand(1)
          if die_roll
            target = $game_troop.random_target_enemy
          else
            target = $game_party.random_target_actor
          end
        elsif @active_battler.restriction == 2
 
Whoops!  I pasted the Critical hit thing wrong.  I fixed it; and now it works.  Since it plays an animation, is there a way to take off the word "CRITICAL" above the critical hit damage?

I looked all over Scene_Battle 3 for those lines you were talking about, but I couldn't find them.
 
To get rid of the "Critical" pop up, move the statement that sets it to false before the "damage" statement

Code:
      # Damage
      if @battler.damage_pop
        if @battler.critical
          critical_animation = $data_animations[101]
          animation(critical_animation, @battler.animation_hit)
        end
        @battler.critical = false
        damage(@battler.damage, @battler.critical)
        @battler.damage = nil
        @battler.damage_pop = false
      end

The lines in Scene_Battle 3 are 189 & 200 (in the default scripts)
 
Critical thing worked.

You said that those lines were in Scene_Battle 3, but I found them in Scene_Battle 4.  It's no big deal, though, I still found them with no trouble.

However, I posted those lines in both places, but when the state is inflicted on someone, whether it's an actor or enemy, the attack always hits an enemy.
 
Scene_Battle 4, yep. That's what I meant!  :scruff:

Hmm, that would indicate that "if die_roll" is always returning 'true'.

Change it to "if die_roll == 0"

Also, I pooched the rand statement, it should be  rand(2)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top