Nérylis 2 Posted May 4, 2015 (edited) Hello, I use a script to play videos with skills. I've a problem : the video is played before the display of the cast message. The animation and the display of damages appear after the video during the cast message. I would like the video to be played after the cast message but before the animation and the display of damages. Can you help me, please ? The script is here : # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # <movie = x> # # x = movie name # class RPG::Skill < RPG::UsableItem def movie if @note =~ /<movie = (\S+)>/ return $1.to_s end end end class Game_Battler < Game_BattlerBase def use_item(item) if item.is_a?(RPG::Skill) Graphics.play_movie('Movies/' + item.movie) if item.movie pay_skill_cost(item) end consume_item(item) if item.is_a?(RPG::Item) item.effects.each {|effect| item_global_effect_apply(effect) } end end Edited May 8, 2015 by Nérylis Share this post Link to post Share on other sites
DoubleX 208 Posted May 8, 2015 I highly suspect you're using some other custom scripts as well, as otherwise your situation shouldn't be possible. I think you'll have to give your demo for this one Share this post Link to post Share on other sites
Trihan 40 Posted May 8, 2015 The script doesn't work because it doesn't tell the log window to wait for the message before playing the movie, something this script as written isn't actually capable of. Replace it with this. # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.movie && item.is_a?(RPG::Skill) @log_window.wait Graphics.play_movie('Movies/' + item.movie) else show_animation(targets, item.animation_id) end targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end This example assumes you've set the regex as movie: [filename] but you'll have to change that line if you were using something different. 1 Share this post Link to post Share on other sites
Nérylis 2 Posted May 8, 2015 (edited) Sorry, that's not the last version of the script. I edited my previous post. Here is a demo : http://www.mediafire.com/download/r97ms9k5z9nldls/Battle+test%283%29.exe The skill in video is "Météorites" with the first actor. Edited May 8, 2015 by Nérylis Share this post Link to post Share on other sites
DoubleX 208 Posted May 9, 2015 The script doesn't work because it doesn't tell the log window to wait for the message before playing the movie, something this script as written isn't actually capable of. Replace it with this. # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.movie && item.is_a?(RPG::Skill) @log_window.wait Graphics.play_movie('Movies/' + item.movie) else show_animation(targets, item.animation_id) end targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end This example assumes you've set the regex as movie: [filename] but you'll have to change that line if you were using something different. I've tested and it turns out that you're right. Yours should work(if 1 @log_window.wait isn't enough, use 2, 3 or more @log_window.wait lol) Share this post Link to post Share on other sites
Nérylis 2 Posted May 9, 2015 Look at my first post, I edited the script with the last version. Can you do the same change with it ? I tested with your update but the video doesn't play. Share this post Link to post Share on other sites
Trihan 40 Posted May 9, 2015 What have you put as the notetag for the skill? Share this post Link to post Share on other sites
Nérylis 2 Posted May 9, 2015 I tried "Météorites" and "<movie = Météorites> Share this post Link to post Share on other sites
Trihan 40 Posted May 9, 2015 Change it to just "movie: Météorites.ogv" No angle brackets, colon instead of equals, with file extension. Share this post Link to post Share on other sites
Nérylis 2 Posted May 9, 2015 Yes, it works better. Is it possible to ensure that the message announcing the animated video skill rest a little longer on the screen before the video starts ? Share this post Link to post Share on other sites
DoubleX 208 Posted May 9, 2015 Try this(slightly modified from Trihan's snippet): # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # module Play_Movie_Before_Skill DURATION = x # x is used to control how long the cast message will last end class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.movie && item.is_a?(RPG::Skill) PLAY_MOVIE_BEFORE_SKILL::DURATION.times { @log_window.wait } Graphics.play_movie('Movies/' + item.movie) else show_animation(targets, item.animation_id) end targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end Share this post Link to post Share on other sites
Nérylis 2 Posted May 9, 2015 When I replace x by a constant (60 for example), I have a mistake : uninitialized constant Sne_Battle::Play_Movie_Before_Skill Share this post Link to post Share on other sites
Trihan 40 Posted May 9, 2015 The capitalisation of the module call needs to match. It's called Play_Movie_Before_Skill so you need to type that in the call to it. Share this post Link to post Share on other sites
Nérylis 2 Posted May 9, 2015 I don't understand what I have to do. I must replace x ? Or another thing ? Share this post Link to post Share on other sites
DoubleX 208 Posted May 10, 2015 I don't understand what I have to do. I must replace x ? Or another thing ? Again, my bad lol Try this instead(there are a type in the last one): # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # module Play_Movie_Before_Skill DURATION = x # x is used to control how long the cast message will last end class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.movie && item.is_a?(RPG::Skill) Play_Movie_Before_Skill::DURATION.times { @log_window.wait } Graphics.play_movie('Movies/' + item.movie) else show_animation(targets, item.animation_id) end targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end Technically speaking, DURATION sets how many times @log_window.wait will be called before playing the movie. Setting it as 60 will have a very, very long wait Share this post Link to post Share on other sites
Nérylis 2 Posted May 10, 2015 Yes, it works. In fact, x is duration in seconds, not frames.^^ Thanks for your help. Share this post Link to post Share on other sites
Nérylis 2 Posted May 14, 2015 I didn't see, there is a problem. After the video, there is no animation, damages are directly displayed. Is it possible to have the animation after the video and before the display of damages ? Share this post Link to post Share on other sites
DoubleX 208 Posted May 14, 2015 I didn't see, there is a problem. After the video, there is no animation, damages are directly displayed. Is it possible to have the animation after the video and before the display of damages ? Try this instead: # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # module Play_Movie_Before_Skill DURATION = x # x is used to control how long the cast message will last end class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.movie && item.is_a?(RPG::Skill) Play_Movie_Before_Skill::DURATION.times { @log_window.wait } Graphics.play_movie('Movies/' + item.movie) end show_animation(targets, item.animation_id) targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end Share this post Link to post Share on other sites
Nérylis 2 Posted May 14, 2015 (edited) Perfect ! It works ! Thank for your quick answer ! Edited May 14, 2015 by Nérylis Share this post Link to post Share on other sites
Nérylis 2 Posted May 25, 2015 Hi ! I found two problems with the script : - When I kill an enemy with the boss extinction effect, the victory message is displayed before the end of the extinction of the enemy. Normally, this message is displayed after. - When I use an item in battle (a potion for example), I have a error message : Share this post Link to post Share on other sites
DoubleX 208 Posted May 25, 2015 For the 2nd issue, try this instead: # ------------------------------------------------- # Script Name : Play Movie before skill # Scripter : efeberk # Date : 29.07.2013 07:28 # Version : RPG Maker VX Ace(RGSS3) # Modified by Trihan on 08/05/2015 # ------------------------------------------------ # # How to: # # Just add a little text to skill notetag # # # # x = movie name # module Play_Movie_Before_Skill DURATION = x # x is used to control how long the cast message will last end class RPG::Skill < RPG::UsableItem def movie if @note =~ /movie: (.*)/ return $1.to_s end end end class Scene_Battle < Scene_Base alias tri_mbs_use_item use_item 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 if item.is_a?(RPG::Skill) && item.movie Play_Movie_Before_Skill::DURATION.times { @log_window.wait } Graphics.play_movie('Movies/' + item.movie) end show_animation(targets, item.animation_id) targets.each {|target| item.repeats.times { invoke_item(target, item) } } end end Share this post Link to post Share on other sites
Nérylis 2 Posted May 25, 2015 Yes, it works well. Fot the 1st issue, I remade a test, the bug occurs well with the update of this script. Share this post Link to post Share on other sites