Critical hit image and sound effect dependent on actor.

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
I am in need of a script that while in battle, if an actor gets a critical hit, than just before the actual hit (and before the animation/text goes), the battle will quickly "pause" an image and sound effect will show, fallowed by the normal critical text/animation. An example of what I am looking for is represented perfectly in the game Fire Emblem: Awakening. 
 

PencilCase27

So, I can write anything I want here... right?
Veteran
Joined
Jun 5, 2014
Messages
33
Reaction score
13
First Language
German
Primarily Uses
The video doesn't show a picture, more kind of an animation. If you show a picture, than it won't move.

Would you rather show a static picture + sound or a custom animation?
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Sorry, I should have been more specific with my request.

Here is a more in depth step by step description of what I am looking for the script to do...

1. The script activates just before an actor is about to attack, and land a critical hit. At this point, the battle "pauses" so prevent the battle from continuing onward while the rest of the script goes on (just like the video)

2. A sound effect plays to let the player know that the sequence is about to start (the "shine" noise in the video).

3. The script waits for the above sound effect to play before bringing up the static image (If possible, could you make it that the static image is "pushed" on to the screen, and then "pulled off" the screen?). Also, have the battle still visible behind the image (Since the image is long yet narrow). To make this a bit easier to describe, here is the image that would be brought up for one actor.

http://s1180.photobucket.com/user/Puffle754/media/MerricCrit.png.html

4. Once the image is "pushed" on to the screen, a second sound effect is played (the voice clip in the video)

5. The script waits for the voice clip to end before "pulling" the image off the screen.

5A. I also need the script to be able to set the image and voice clip to a particular actor, so that actor1 has a different image and voice clip from that of actor 2, 3, 4, ext.

6. After the image is "pulled" from the screen, the battle "resumes" as normal, with the actor landing the critical hit as normal.

If possible, could you please make this script workable regardless of the battle system? Although is need be, the battle system I use is Jett's Side View Battle system.

Thanks in advance!~
 
Last edited by a moderator:

PencilCase27

So, I can write anything I want here... right?
Veteran
Joined
Jun 5, 2014
Messages
33
Reaction score
13
First Language
German
Primarily Uses
1. The script activates just before an actor is about to attack, and land a critical hit. At this point, the battle "pauses" so prevent the battle from continuing onward while the rest of the 
And here we have a problem. I guess you want this effect to appear before the battle animation is shown? Because at this point the game doesn't know if the attack is critical or not. This is decided after the animation. While it is not impossible to change that, I'd need to know what to do with skills that have multiple repeats, or hit multiple enemys, or both. What happens if only some of thise hits crit?
 
Last edited by a moderator:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
I see what you mean with multi-hit attacks, and multi-target attacks. I'm not sure which would be possible, but I would be open to any of the fallowing options, just let me know which (if any) of these would work for you:

1. The script activates if a crit would be landed, regardless of it crits 1 target, or 4.

2. The script would activate before each individual hit that crits (for multi-hit attacks, although I'm not sure if the battle could pause mid-attack)(The script would activate is a multi-target attack is used, and at least 1 enemy would be crit) -Preferred Option-

3. I could alternatively either disable crit on multi-hit/target attacks, or not have the script activate for these types of attacks (not preferred, but it could work)

Also, there are 2 other details I'll like to ask about (Neither are absolutely necessary, but preferred):

1. Would it be possible to have several voice clips be set per actor, with 1 being chosen at random.

2. Could the same setup be applied to enemies (via notetag?). More specifically, enemies by default don't use the script (so no image/voice on crit), but it being possible to set them to specific emeries (bosses)
 

PencilCase27

So, I can write anything I want here... right?
Veteran
Joined
Jun 5, 2014
Messages
33
Reaction score
13
First Language
German
Primarily Uses
module PC27 module CritAnimation WooshSound = "Absorb1" #ActorSounds = 3 Picture1 = 2 Picture2 = 1 endendclass Scene_Battle alias pc27_crit_effect_show_animation show_animation def show_animation(targets, animation_id) item = @subject.current_action.item targets.each { |target| target.eval_crit(@subject, item) } show_critical_animation if actor_crit?(targets) pc27_crit_effect_show_animation(targets, animation_id) end def show_critical_animation RPG::SE.new(PC27::CritAnimation::WooshSound).play wait(30) RPG::SE.new("Attack2").play show_crit_background show_crit_actor move_crit_actor(Graphics.width * 0.5 - 50, 20) RPG::SE.new("Attack3").play move_crit_actor(Graphics.width * 0.5 + 50, 60) move_crit_actor(Graphics.width + 50, 20) erease_crit_actor erease_crit_background end def show_crit_actor name = @subject.name + "CritImg" y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CritAnimation::picture1].show(name, 1, -50, y, 100, 100, 255, 0) end def move_crit_actor(x, time) y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CritAnimation::picture1].move(1, x, y, 100, 100, 255, 0, time) wait(time) end def erease_crit_actor $game_troop.screen.pictures[PC27::CritAnimation::picture1].erase end def show_crit_background x = Graphics.width * 0.5 y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CritAnimation::picture2].show("CritBG", 1, x, y, 100, 100, 255, 0) end def erease_crit_background $game_troop.screen.pictures[PC27::CritAnimation::picture2].erase end def actor_crit?(targets) return false unless @subject.is_a?(Game_Actor) targets.each do |target| return true if target.result.critical end return false end endclass Game_Battler def eval_crit(user, item) @result.critical = (rand < item_cri(user, item)) end def item_apply(user, item) crit = @result.critical @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) if @result.hit? unless item.damage.none? @result.critical = crit make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end endend 
First prototype. It's not possibe to change sounds yet, but before I change that I want to ask you if you approve the layout since the success of this script depends on you liking the way I move the pictures around. Thats also a good chance to check for compatibility issues. Should this script cause an error in your current project, please try it in a new project, so you're still able to give me some feedback. For example, if you want each actor to have two different sounds, I need to know when to play them.

You need two pictures. 1) A image called Actor Name + "CritImg" (eg.: MerricCritImg) and 2) a picture called "CritBG". I used this one:



For your other questions: I think this should all be possible, but I'd like to get the basic thing working before I try that.
 
Last edited by a moderator:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Thank you for the quick help, I really appreciate it! 

I tried the script out in my project, and it works great! Some things of note:

1. For starters, there doesn't seen to be any incompatibility, which is a huge relief, seeing as my project is practically bursting at the seams with scripts

2. I tried to recreate various of situations with several characters, and the script worked perfectly in each situation

3. An enemy also got a natural crit on me during testing, which the script handled normally without issue

4. Overall, I really like how the image is brought on to, and pulled from the screen. It looks really smooth and seamless!

5. Only downside so far is that I'm pretty sure the crit image was brought up once without the fallowing attack being a critical hit. There's a strong chance that I may have simply not seen the crit text fallowing the animation, but I figured I should being it up either way. Regardless, I only possibly saw this once in the span of a half hour of testing, so I wouldn't stay that it is a major issue.

Edit: I missed your question asking about the sound effects. I'm looking to have the sound effect process go as fallows:

1. A "static" SE is played just before the face animation starts. By static, I mean that this SE is the same for any actor.

2. While the actor face animation is on screen, a second SE plays, this one being the actors voice clip, and is different for each actor.

3. As far as the last bit regarding several voice clips per actor, I simply mean that I may have 3 voice clips for Merric, but when he lands a crit, one of these three voice clips is chosen at random to be played.
 
Last edited by a moderator:

PencilCase27

So, I can write anything I want here... right?
Veteran
Joined
Jun 5, 2014
Messages
33
Reaction score
13
First Language
German
Primarily Uses
module PC27 module CrAn # If this switch is not equal to 0, this switch can be used to turn the # animation ON or OFF. Switch = 0 # The two picture id's the script uses to draw the animation. Do not use # them for other "Show Pictures" events. ActorPicture = 2 BackPicture = 1 # Number of frames the image needs to slide in/out SlideInTime = 20 SlideOutTime = 20 # Number of frames the image stays and distance it moves in that time LingerTime = 60 LingerDistance = 100 # This is the sound played at the begin of the animation and the number # of frames you want to wait before the picture shows up. InitSound = "Absorb1" InitWait = 30 # Those are actor specific sounds. It plays one random sound. ActorSounds = { # Actor_ID => [ "sound1", "sound2", ...], 1 => [ "Water4", "Water1", "Water3"], 2 => [ "Absorb1", "Fire1", "Fire2"], # 3 => [...} endendclass Scene_Battle alias pc27_crit_effect_show_animation show_animation def show_animation(targets, animation_id) item = @subject.current_action.item if item.damage.none? targets.each { |target| target.set_crit_to_false} else targets.each { |target| target.eval_crit(@subject, item) } end show_critical_animation if actor_crit?(targets) pc27_crit_effect_show_animation(targets, animation_id) end def show_critical_animation lo = PC27::CrAn::LingerDistance * 0.5 play_initial_sound show_crit_background show_crit_actor move_crit_actor(Graphics.width * 0.5 - lo, PC27::CrAn::SlideInTime) play_random_actor_sound(@subject) move_crit_actor(Graphics.width * 0.5 + lo, PC27::CrAn::LingerTime) move_crit_actor(Graphics.width + 50, PC27::CrAn::SlideOutTime) erease_crit_actor erease_crit_background end def play_initial_sound RPG::SE.new(PC27::CrAn::InitSound).play wait(PC27::CrAn::InitWait) end def play_random_actor_sound(subject) RPG::SE.new(PC27::CrAn::ActorSounds[subject.id].sample).play end def show_crit_actor name = @subject.name + "CritImg" y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::ActorPicture].show(name, 1, -50, y, 100, 100, 255, 0) end def move_crit_actor(x, time) y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::ActorPicture].move(1, x, y, 100, 100, 255, 0, time) wait(time) end def erease_crit_actor $game_troop.screen.pictures[PC27::CrAn::ActorPicture].erase end def show_crit_background x = Graphics.width * 0.5 y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::BackPicture].show("CritBG", 1, x, y, 100, 100, 255, 0) end def erease_crit_background $game_troop.screen.pictures[PC27::CrAn::BackPicture].erase end def actor_crit?(targets) return false unless (PC27::CrAn::Switch == 0 || $game_switches[PC27::CrAn::Switch]) return false unless @subject.is_a?(Game_Actor) targets.each do |target| return true if target.result.critical end return false end endclass Game_Battler def eval_crit(user, item) @result.critical = (rand < item_cri(user, item)) end def set_crit_to_false @result.critical = false end def item_apply(user, item) crit = @result.critical @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) if @result.hit? unless item.damage.none? @result.critical = crit make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end endend 
This one comes with sounds and more customisation on how the picture moves. Multiple hits are handled the following way:

 - If an attack hits multiple enemys, the animation shows if at least one of the hits is a crit.

 - If an attack hits the same enemy multiple times, either all hits are critical, or none of them.

Changing those would not be easy, so I am afraight you just have to accept that.

For enemy animations, well, I'll be honest: I am sure this would be possible, but I am too lazy to figure out how. Maybe sometmes in the future, but don't get your hopes high :p
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
module PC27 module CrAn # If this switch is not equal to 0, this switch can be used to turn the # animation ON or OFF. Switch = 0 # The two picture id's the script uses to draw the animation. Do not use # them for other "Show Pictures" events. ActorPicture = 2 BackPicture = 1 # Number of frames the image needs to slide in/out SlideInTime = 20 SlideOutTime = 20 # Number of frames the image stays and distance it moves in that time LingerTime = 60 LingerDistance = 100 # This is the sound played at the begin of the animation and the number # of frames you want to wait before the picture shows up. InitSound = "Absorb1" InitWait = 30 # Those are actor specific sounds. It plays one random sound. ActorSounds = { # Actor_ID => [ "sound1", "sound2", ...], 1 => [ "Water4", "Water1", "Water3"], 2 => [ "Absorb1", "Fire1", "Fire2"], # 3 => [...} endendclass Scene_Battle alias pc27_crit_effect_show_animation show_animation def show_animation(targets, animation_id) item = @subject.current_action.item if item.damage.none? targets.each { |target| target.set_crit_to_false} else targets.each { |target| target.eval_crit(@subject, item) } end show_critical_animation if actor_crit?(targets) pc27_crit_effect_show_animation(targets, animation_id) end def show_critical_animation lo = PC27::CrAn::LingerDistance * 0.5 play_initial_sound show_crit_background show_crit_actor move_crit_actor(Graphics.width * 0.5 - lo, PC27::CrAn::SlideInTime) play_random_actor_sound(@subject) move_crit_actor(Graphics.width * 0.5 + lo, PC27::CrAn::LingerTime) move_crit_actor(Graphics.width + 50, PC27::CrAn::SlideOutTime) erease_crit_actor erease_crit_background end def play_initial_sound RPG::SE.new(PC27::CrAn::InitSound).play wait(PC27::CrAn::InitWait) end def play_random_actor_sound(subject) RPG::SE.new(PC27::CrAn::ActorSounds[subject.id].sample).play end def show_crit_actor name = @subject.name + "CritImg" y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::ActorPicture].show(name, 1, -50, y, 100, 100, 255, 0) end def move_crit_actor(x, time) y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::ActorPicture].move(1, x, y, 100, 100, 255, 0, time) wait(time) end def erease_crit_actor $game_troop.screen.pictures[PC27::CrAn::ActorPicture].erase end def show_crit_background x = Graphics.width * 0.5 y = Graphics.height * 0.5 $game_troop.screen.pictures[PC27::CrAn::BackPicture].show("CritBG", 1, x, y, 100, 100, 255, 0) end def erease_crit_background $game_troop.screen.pictures[PC27::CrAn::BackPicture].erase end def actor_crit?(targets) return false unless (PC27::CrAn::Switch == 0 || $game_switches[PC27::CrAn::Switch]) return false unless @subject.is_a?(Game_Actor) targets.each do |target| return true if target.result.critical end return false end endclass Game_Battler def eval_crit(user, item) @result.critical = (rand < item_cri(user, item)) end def set_crit_to_false @result.critical = false end def item_apply(user, item) crit = @result.critical @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) if @result.hit? unless item.damage.none? @result.critical = crit make_damage_value(user, item) execute_damage(user) end item.effects.each {|effect| item_effect_apply(user, item, effect) } item_user_effect(user, item) end endend 
This one comes with sounds and more customisation on how the picture moves. Multiple hits are handled the following way:

 - If an attack hits multiple enemys, the animation shows if at least one of the hits is a crit.

 - If an attack hits the same enemy multiple times, either all hits are critical, or none of them.

Changing those would not be easy, so I am afraight you just have to accept that.

For enemy animations, well, I'll be honest: I am sure this would be possible, but I am too lazy to figure out how. Maybe sometmes in the future, but don't get your hopes high :p
EDIT!!!: After quite a bit of fiddling, I think I got the script to work perfectly by dropping a few scripts in my project. What REALLY confuses me is that the script was working just fine as version 1 earlier, then wouldn't work with version 2, then decide not to work with version 1 anymore, and finally after removing those scripts, finally work with both versions perfectly! I'll be honest, the idea that the script acting so odd doesn't make a lick of sence to me, but I'll just keep to what I'm doing, more testing. :p

I left my old post below for reference, though.

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

~~~~Old Post~~~~~

I hate to say it, but I tried out the new script, and unfortunately, it seems something broke while finishing up the script. The crit animation seems to play at random turns, often not fallowed by a crit. On the flip side, even when the user gets a crit, the animation doesn't play.

I also went back to the previous script to further test it, and although it detects the crit far more reliably than the second version, its fumbles with either showing/not showing when it isn't supposed to seems to be more common than I was running into this morning, with me running into the problem twice within 5 minutes...

Edit: Unfortunately, after even more testing, I have to report that the first script cannot detect critical hits either. Why it seemed to detect them potently earlier puzzles me, although I suppose I simply got really lucky. I'm really sorry if this creates extra work for you.
 
Last edited by a moderator:

PencilCase27

So, I can write anything I want here... right?
Veteran
Joined
Jun 5, 2014
Messages
33
Reaction score
13
First Language
German
Primarily Uses
Hm, yeah. That explains why I wasn't able to recreate your problem. I just tested it with different actors and skills, and it worked as intended.

You could also try to place my script at the top of all other scripts, just in case you haven't done this already. Sometimes that helps (and sometimes it messes stuff up even more).

If you drop the scripts one by one you could find the one that causes trouble and post it here, maybe I can fix the issue.

EDIT: It's also worth saying that the changes from v1 to v2 are (almost) only cosmetical. It doesn't make any sense that the first one works and the second one does not.

EDIT2: For the lulz, I just tested this script with the Yanfly Battle Engine, and it seems that skills with repititions work just the way you want. Not sure if this information is of any use to you^^
 
Last edited by a moderator:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
With a last bit of fiddling around, I found what was causing the issue with critical hits not pairing up, and ironically, it was another script that relied on critical hits. The other script wasn't really in any use, so there's no need to work out a comparability between the two, as the other script merely made the screen flash upon critical, which I'm fine without. After getting that settled out, the script works without problem! Thanks again for all your help, and for the information about Yanfly Battle Engine. If by chance you decide to extend the script someday to utilize enemies/ext. just be sure to let me know! :)
 

setsuna03

Warper
Member
Joined
Jul 30, 2014
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Hey Pencil Case 27, this script does almost exatly what I need for a game I'm working on. The game is planned IFR a commercial release, would you allow me to use your script in the game? What would be your terms of use?
 

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,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top