Status
Not open for further replies.

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
It has always bothered me to see my character's attack clearly hit the enemy, only for it to then "miss".
And so, as the title says, I'd like for an attack animation to not play until after the battle scene determines whether an attack hits or misses, and if the attack misses, the animation will not play at all.

An even cooler idea would be to have a separate animation play when the attack misses, so that I can make a sword slash animation but have it miss the enemy. Maybe this could be specified in the note tags?

Well, I hope this isn't too much to ask. At the very least I'd like it so that an animation just doesn't play if the attack misses. The other suggestion of an additional animation is fine to leave out if it's too difficult.
Is this possible? Thank you for any help
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I'll bump this but I have a feeling that this might be too difficult for someone to take the time to do without any pay. But you never know.
It's not urgent so it can wait but yeah, I'd still appreciate it.
Honestly I think it's something that should be in every RPG game, it only makes sense :LZSrasp:
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,064
Reaction score
7,168
First Language
Indonesian
Primarily Uses
RMVXA
Hit/miss is determined after the animation played. So, we just need to change that. It is not hard to modify, but it is required to be modified in a way that might not compatible with a lot of scripts (plus animation being played first is not a bad design in my opinion). So, do you use other battle-related scripts?
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
(plus animation being played first is not a bad design in my opinion)
I use Galv's Animated Battlers and my character moves up to the enemy and then physically hits them, which then makes a typical hit effect along with blood appearing. This is why I'd like there to be no animation when missing, because to see the enemy clearly being hit and then drawing blood (or even without blood, just being hit in general) only for it to just "miss" is immersion breaking, to say the least. It just doesn't make sense.
So yeah as mentioned I use an animated battler script by Galv and some gameplay modifications and I have changed the layout of the battle windows.
I'll just list what I have that actually affects the gameplay during battle:
  • Hime Effect Manager
  • "Target One Ally (Not the User) Scope" by Sixth
  • Galv's Cover (Substitute) Functionality
  • Victor Engine - Custom Hit Formula
I have the Yanfly Ace Core Engine which seems to modify some stuff perhaps, but I do not use the Yanfly Battle Engine, just to be clear. I also have the Victor Engine too of course.
I have MOG's Damage Popup, I don't know if that would conflict with any modifications to animations or not.

So far that actually seems to be it for now. Other stuff just changes the battle results or adds enemy hit bars and whatnot.
Truth be told I've only started to seriously work on my battle mechanics recently so I will probably be adding more scripts in the future. Is there anything I should look out for in regards to compatibility? What classes will need to be changed?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
Hit/miss is determined after the animation played
I was tracking it back and is it not already know before the animation is called?
Scene Battle under Process action (line 540) it pulls in the subject and action.
I did some print displays in the console and I was able to find that @subject.result.missed is in there.
After this execute action is called where use item is called and in use item it does a call for
show_animation.
I tested changing that line to
show_animation(targets, item.animation_id) unless @subject.result.missed
and it took a lot of testing but it works. I had a hard time getting my level 1 character to miss a slime with 999 def and 999 eva. It normally came up as no damage. when I finally put the characters atk down to low values then a miss came and no animation played.
This should work (depending on the battle system)
Ruby:
class Scene_Battle < Scene_Base
  def use_item
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id) unless @subject.result.missed
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I was tracking it back and is it not already know before the animation is called?
Scene Battle under Process action (line 540) it pulls in the subject and action.
I did some print displays in the console and I was able to find that @subject.result.missed is in there.
After this execute action is called where use item is called and in use item it does a call for
show_animation.
I tested changing that line to
show_animation(targets, item.animation_id) unless @subject.result.missed
and it took a lot of testing but it works. I had a hard time getting my level 1 character to miss a slime with 999 def and 999 eva. It normally came up as no damage. when I finally put the characters atk down to low values then a miss came and no animation played.
This should work (depending on the battle system)
Ruby:
class Scene_Battle < Scene_Base
  def use_item
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id) unless @subject.result.missed
    targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  end
end
I set the attack's Success % to 0 so that it misses every time, and tested it. The animation still plays before the attack misses. I then moved the script to the bottom of my load order and it still doesn't work
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,064
Reaction score
7,168
First Language
Indonesian
Primarily Uses
RMVXA
I was tracking it back and is it not already know before the animation is called?
The hit/miss roll is inside the invoke item as far as I can tell. How do you assume this?

I did some print displays in the console and I was able to find that @subject.result.missed is in there.
Yes, you can always print it in the console or somewhere else. But is the value correct?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
But is the value correct?
From my observations and the console output, yes it is.
But this seems to only work on the default battle system.
Yanfly battle engine changes this somehow.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,064
Reaction score
7,168
First Language
Indonesian
Primarily Uses
RMVXA
How do you assume this?
Alright, so can you answer this question?
I don't want a baseless "because the console said so". But the actual breakdown of the damage flow.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
the actual breakdown of the damage flow
Ah, ok but I assume you have a good way of doing this?
I was just putting in p(@subject.result.missed) and getting
false, false, false, true, false, false
I can try to figure out the place where yanfly battle engine is calling the animation and see if the flow can be change with it.
When I put my snippet below yanfly battle engine, the animation played twice.
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,064
Reaction score
7,168
First Language
Indonesian
Primarily Uses
RMVXA
Ah, ok but I assume you have a good way of doing this?
I have but I won't say it is a good way, because it won't be.
The first thing to do would be putting hit/miss roll on the show animation method.
Depending on the result, you can just continue to play the animation or stop completely.

Then, inside the invoke_item method, or specifically in the item_apply method, use the previous hit/miss result you have rolled inside the show_animation to force if the skill/item is missed.

The problem with this approach is that the substitute/magic reflect/counter is rolled inside the invoke item method as well. So it probably only works if you don't use these features. I personally don't use them, at least not in the default way.

Not to mention, several scripts may use the use_item method for various reasons. Depending on the battle system, that particular part in the Scene_Battle may be changed.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
I use Galv's Animated Battlers
This worked for Galv's animated battlers script.
Add in one line
in def show_animation (line 546)
add return if @subject.result.missed before
galv_animb_sbsb_show_animation(targets, animation_id)
Ruby:
  alias galv_animb_sbsb_show_animation show_animation
  def show_animation(targets, animation_id)
    @move_target = targets[0]
    check_dash
    set_pose
    return if @subject.result.missed
    galv_animb_sbsb_show_animation(targets, animation_id)
  end
Let us know if this works.
My test with yanfly battle engine and galv's animated battlers worked. the character played the weapon swing but no slash across the enemy.
if that causes issues, try this,
Ruby:
class Scene_Battle < Scene_Base
  def show_animation(targets, animation_id)
    if animation_id < 0
      show_attack_animation(targets) unless @subject.result.missed
    else
      show_normal_animation(targets, animation_id)
    end
    @log_window.wait
    wait_for_animation
  end
end
Be sure to place this one above all custom scripts.

This worked for the actor not the enemies
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
This worked for Galv's animated battlers script.
Add in one line
in def show_animation (line 546)
add return if @subject.result.missed before
galv_animb_sbsb_show_animation(targets, animation_id)
Ruby:
  alias galv_animb_sbsb_show_animation show_animation
  def show_animation(targets, animation_id)
    @move_target = targets[0]
    check_dash
    set_pose
    return if @subject.result.missed
    galv_animb_sbsb_show_animation(targets, animation_id)
  end
Let us know if this works.
My test with yanfly battle engine and galv's animated battlers worked. the character played the weapon swing but no slash across the enemy.
if that causes issues, try this,
Ruby:
class Scene_Battle < Scene_Base
  def show_animation(targets, animation_id)
    if animation_id < 0
      show_attack_animation(targets) unless @subject.result.missed
    else
      show_normal_animation(targets, animation_id)
    end
    @log_window.wait
    wait_for_animation
  end
end
Be sure to place this one above all custom scripts.

This worked for the actor not the enemies
For some reason it's not working. I added the line above "galv_animb_sbsb_show_animation(targets, animation_id)", and that didn't work so I then added the other script you gave but still it doesn't work.
Just to make sure, it definitely works for you?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
Just to make sure, it definitely works for you?
Yes, I wouldn't have given that code without it giving me the result you asked for.
You will have to send me a demo or maybe just your scripts file. I need to see what else is wrong there.
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Yes, I wouldn't have given that code without it giving me the result you asked for.
You will have to send me a demo or maybe just your scripts file. I need to see what else is wrong there.
Well, I tested it in a default project too, and it doesn't work. I set the default attack to have a 0% success rate, and the attack misses, but the animation plays before the attack misses just as it does normally.
You mentioned you use Yanfly's battle engine. I don't use any custom battle engines, I only use the default battle engine. Does that have something to do with it not working?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,064
Reaction score
7,168
First Language
Indonesian
Primarily Uses
RMVXA
As far as I can tell, Roninator2's solution is quite fragile.
And also, I'm also interested to look at your Script.rvdata2
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
As far as I can tell, Roninator2's solution is quite fragile.
And also, I'm also interested to look at your Script.rvdata2
There's no need to upload my script data as I already gave the battle scripts I use that affect battle gameplay. Scripts I have that do heavily modify my game are non-battle related; as of now, my battles are very vanilla. I do not even have any custom battle engine scripts. I only have what I listed in my first reply to you and I have modified some x and y values of windows.

As I mentioned, roninator's script doesn't even work in a brand new default project. If it can work in there it should work in my project though.
 

UncannyBoots

Veteran
Veteran
Joined
Feb 1, 2020
Messages
42
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Then I will pass. Good luck.
Alright then. Sorry but I don't want to share my project at the moment, nor any of its data files. I gave the battle scripts that I am using but if that's not good enough then so be it.

If making a script that works in a default new VX Ace project is too much to ask then I am willing to accept that this script won't be made. It isn't a huge priority for me to have this, but still, it'd be nice.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,914
Reaction score
643
First Language
English
Primarily Uses
RMVXA
roninator's script doesn't even work in a brand new default project
OK fine. Here.

I set the default attack to have a 0% success rate, and the attack misses, but the animation plays before the attack misses just as it does normally.
It most certainly does not play with 0% change of success on the skill. with 100% chance it does play.
Check the project I uploaded. I have yanfly battle engine in there, but you can remove it and the result is the same.
Roninator2's solution is quite fragile.
Perhaps. My excuse is always "I'm still learning". I'm probably only mid way to being a good programmer with RGSS3.
If it's not too much trouble, I'd be interesting in hearing your thoughts. PM me if you wish.
 
Last edited:
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

I haven't been on here in forever wow(missed my forum birthday T-T). Anyways, I'm dabbling in BGMs, here's something I'm actually willing to share.

Binge-watched 6 episodes of the Erased anime... And that means I've watched half of it?! Sigh...
I'm bad at base-building games (looking at other players created an aesthetically beautiful base compared to me), but IDK why I keep playing the game and seek more of it.
Pyra and Mythra in smash ultimate are way too OP. They're basically Smash 4 Bayonetta 2.0, and not in a good way. Very toxic and unfair. At least they're hot tho.

Forum statistics

Threads
109,197
Messages
1,042,970
Members
141,700
Latest member
skybola188
Top