Mundo Maker
¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.

[Pedido] Pequeña ayuda con 2 scripts

Ver el tema anterior Ver el tema siguiente Ir abajo

RPG Maker VX ACE [Pedido] Pequeña ayuda con 2 scripts

Mensaje por Dails el 2018-04-30, 12:10

Digo pequeña por que creo que es fácil de solventar  estos problemas que tengo con estos 2 scripts. En el caso de que haya alguien que sepa como solucionarlo prefiero que contacte conmigo por un chat en privado o si no que ponga la solución por aquí. Preferible la 1º opción.

Estoy haciendo un proyecto de un fangame de yume nikki bastante exigente en el que tiene bastantes opciones. Una de ellas es tocar instrumentos mediante este script:
Código:
#===============================================================================
# * [ACE] QTE (Type 2) Mini-Game
#===============================================================================
# * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
# * Version: 1.0
# * Updated: 13/12/2015
# * Requires: Sixth's Picture Number Drawing
#             Sixth's Mini-Game Base
#-------------------------------------------------------------------------------
# * < Change Log >
#-------------------------------------------------------------------------------
# * Version 1.0 (13/12/2015)
#   - Initial release.
#-------------------------------------------------------------------------------
# * < Description >
#-------------------------------------------------------------------------------
# * This is a mini-game script, where the player needs to press buttons at the
#   right time. So, it's a timing mini-game, can be called a "quick time event"
#   (QTE) mini-game as well.
# * The player can earn scores from winning in the game too. You can use these
#   scores in eventing.
# * Settings for making infinite difficulties.
# * Completely image based! The images used can be changed during the game too!
# * For scripters: Easily implement this mini-game into any scenes!
#   All you have to do is to create a mini game instance and loop it's update
#   method (along with the Input and Graphics update methods) until the game
#   is finished.
#-------------------------------------------------------------------------------
# * < Playing the Game >
#-------------------------------------------------------------------------------
# * When you use the script call to start a game, the images used for the game
#   will show up. The player must press the confirm button to start the game.
#   When the game is started, random images will start to spawn on the screen.
#   These images will appear on vertical lines (there can be multiple lines) and
#   will start to move downwards. These images (called "trigger images" from now
#   on) should reach the goal line image (which is normally a horizontal line
#   image) and if they are at the right place when the player press the button
#   assigned to the line the trigger image is on, the player earns some score
#   points. The more successful button presses the player make, the higher the
#   score point gain gets.
#   If multiple trigger images were triggered successfully with a single button
#   press, the amount of score gain will be doubled!
#   But if the player missed the timing, failure points are gained instead.
#   If the "fail-o-meter" is filled completely, the game is over and the player
#   will not get anything.
#   When there are no more trigger images appearing, the player wins the game
#   and will receive the collected score points.
#   Regardless if the game is won or lost, when it ends, the player must press
#   the confirm button to exit the game.
#   After the game, you can check if it was won or lost with the provided script
#   variables in conditional branch commands (with the script option), so you
#   can trigger different things depending on whether the player won or lost the
#   game.
#-------------------------------------------------------------------------------
# * < Script Calls >
#-------------------------------------------------------------------------------
# * To start a mini-game, use the following script call:
#
#     start_qte2(key)
#
#   Replace 'key' with a key you used in the 'Games' settings in the script!
#
#   Exammples: start_qte2(:easy)
#              start_qte2(:hard)
#-------------------------------------------------------------------------------
# * < Installation >
#-------------------------------------------------------------------------------
# * Place this script below Materials but above Main!
#-------------------------------------------------------------------------------
# * < Compatibility Info >
#-------------------------------------------------------------------------------
# * No known incompatibilities.
#-------------------------------------------------------------------------------
# * < Known Issues >
#-------------------------------------------------------------------------------
# * No known issues.
#-------------------------------------------------------------------------------
# * < Terms of Use >
#-------------------------------------------------------------------------------
# * Free to use for whatever purposes you want.
# * Credit me (Sixth) in your game, pretty please! :P
# * Posting modified versions of this script is allowed as long as you notice me
#   about it with a link to it!
#===============================================================================
$imported = {} if $imported.nil?
$imported["SixthQTEMiniGame2"] = true
#===============================================================================
# Settings:
#===============================================================================
module QTEGame2
 #-----------------------------------------------------------------------------
 # Image Folder Settings:
 #-----------------------------------------------------------------------------
 # Set up the folder which contains the images used for the mini game.
 # All of the images used must be in this folder!
 #-----------------------------------------------------------------------------
 ImgFolder = "Graphics/QTE_Type_2/"
 
 #-----------------------------------------------------------------------------
 # Score Settings:
 #-----------------------------------------------------------------------------
 # You can show/hide the score display with this setting.
 # true = show, false = hide.
 # The scores will still be updated even if you set this to false, but the
 # score display during games will be hidden.
 #-----------------------------------------------------------------------------
 UseScore = true
 
 #-----------------------------------------------------------------------------
 # Image Settings:
 #-----------------------------------------------------------------------------
 # This mini-game is made with images. This is the place where you set up the
 # used images in the mini game.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Details:
 #
 #   :img => "filename",
 # The image used for the specified data.
 # All images must be in the folder you have set up above!
 #
 #   :opa => value,
 # The opacity value of the images. Valid values: 0 - 255.
 #
 #   :z => value,
 # The Z value of the images.
 #
 #   :pos => [x,y],
 # X and Y position/offset values for the images.
 # Note that it is an offset value in the case of the current and total score
 # displays! The position of those is tied with the background image of the
 # score settings.
 # Also, the goal image's position is a position on the game's area itself,
 # NOT a screen position! So, if you place the goal image outside of the game's
 # area, it will either be cut down on some sides, or will not show up at all!
 # The rest of the images use direct position settings!
 #
 #   :size => [width,height],
 # The width and height of the score display bitmaps.
 # In other words, the size reserved for drawing the score numbers.
 #  
 #   :tpos => [x,y],
 # The X and Y positions of the score numbers INSIDE the score bitmaps.
 # Note that if the score text gets outside of the score bitmap, the text
 # outside will be cut down!
 #
 #   :align => type,
 # The alignment type of the score number texts.
 # 0 = Left, 1 = Middle, 2 = Right.
 # Make sure to read about the connection of the alignment and position
 # settings in my Picture Number Drawing script!
 #
 #   :style => ["filename",row_index],
 # The picture number style used to draw the score numbers.
 # Make sure to read about this setting in my Picture Number Drawing script!
 # Note that the image files used here must be in the folder you have set up
 # in my Picture Number Drawing script!
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Popup specific setting details:
 #
 # There are 3 popups which can appear during the game.
 # These are the start, success and fail popup images.
 # These can be animated by setting movement, opacity and zoom level changes
 # for them.
 # The position, opacity, and zoom settings you enter are the initial values
 # for those properties. These will be changed with the :move_in, :fade_in and
 # :zoom_in settings.
 # When the popup is finished with the entering animation, the player can press
 # the confirm button to get rid of the popup. After the confirm button
 # pressing, the popup will start it's exiting animation.
 # The exiting animation is controlled by the :move_out, :fade_out and
 # :zoom_out settings. These settings will start to change the popup's
 # properties until the exiting animation finishes.
 #
 # Details:
 #
 #   :zoom => [x_zoom,y_zoom],
 # Sets the initial zoom levels of the popup images.
 # These values can be changed with the entering and exiting animations for
 # the popup images.
 #
 #   :in_time => frames,
 # The frames of the entering animation. The less frames you set here, the
 # quicker the animation will be. Remember: 1 second = 60 frames!
 #
 #   :out_time => frames,
 # The frames of the exiting animation. The less frames you set here, the
 # quicker the animation will be. Remember: 1 second = 60 frames!
 #
 #   :move_in => [x,y],
 # The movement of the entering animation. This many pixels will the popup
 # move on the X and Y axis while the entering animation lasts.
 #
 #   :move_out => [x,y],
 # The movement of the exiting animation. This many pixels will the popup
 # move on the X and Y axis while the exiting animation lasts.
 # Note that this takes the popup's position after the entering animation, and
 # the values you set up here will be added to that position!
 #
 #   :fade_in => value,
 # The change in the popup's opacity during the entering animation.
 #
 #   :fade_out => value,
 # The change in the popup's opacity during the exiting animation.
 # Note that this takes the popup's opacity after the entering animation, and
 # the value you set up here will be added to that value!
 #
 #   :zoom_in => [x_zoom,y_zoom],
 # The change in the popup's zoom level on the X and Y axis during the entering
 # animation.
 #
 #   :zoom_out => [x_zoom,y_zoom],
 # The change in the popup's zoom level on the X and Y axis during the exiting
 # animation.
 # Note that this takes the popup's zoom level after the entering animation,
 # and the values you set up here will be added to that zoom value!
 #
 #   :wave = true/false,
 # With this, you can enable a wave effect for the popup when it is in the
 # waiting phase (waiting for the player to press the confirm button).
 # true = enable wave effect, false = disable wave effect.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Button image setting details:
 #
 # For each of your buttons available in this mini-game, you must set up an
 # image. This can be used to show the player which button needs to be pressed
 # for which line on the screen.
 # You can enter as many button image settings as you want!
 #
 # The keys used must match with a valid input key!
 # The default input keys are:
 # :LEFT, :RIGHT, :UP, :DOWN,
 # :A, :B, :C, :L, :R, :X, :Y, :Z
 # :F5, :F6, :F7, :F8, :F9
 # :SHIFT, :CTRL, :ALT
 #
 # Aside from the default keys, you can use an input key from custom input
 # scripts as well. If you plan to use a custom input key, make sure that this
 # script is below your custom input script! This is if that custom input
 # script uses module constants as input keys, and if you use those module
 # constants in the settings here. If you use the direct input identifiers
 # instead of those module constants, the placement of this script does not
 # matter.
 # Also, the custom input script must use the default input trigger check
 # method ( Input.trigger?(key) ) or else it will not work with this script!
 #
 # Details:
 #
 #   :img => "filename",
 #   :opacity => value,
 #   :z => value,
 # All of these settings are explained above already, so feel free to look
 # above for their explanation!
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Line image setting details:
 #
 # These are the images where the trigger images will show up and move.
 # It should be a vertical line-like image.
 # A game can have any amount of these lines. The more you got, the harder
 # the game gets.
 # The position of these images are set in the game settings. You can place
 # them at different places in different games if you want.
 # Got the same settings as the button images.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Trigger image setting details:
 #
 # These are the images which will spawn on the lines.
 # You can set up as many as you want here, which lets you make many types of
 # trigger images, smaller and bigger alike. A good way to increase difficulty
 # is to use small images.
 # Got the same settings as the button image settings, plus two special
 # settings, and those are:
 #
 #   :goal => [min,max],
 # Okay, this will be difficult to explain, but let me try...
 # The X and Y position of your trigger images will be the center of the
 # images used for them.
 # The goal Y is the Y position of the goal image.
 # So, in order to let you make weird shaped trigger images without any
 # limiitations, and let you decide the correct trigger time for them, I made
 # these settings.
 # If the goal Y is between the trigger image's (Y + min) and (Y + max) values,
 # the button press will be successful. If not, it will be a failure.
 # This will let you set up the correct trigger places on your images without
 # any limitations. For example, if you want an image to use it's top part as
 # the successful trigger position, you can do so with these settings.
 #
 #   :fail => value,
 # When the trigger image gets past it's trigger zone, it can still travel some
 # pixels downwards before triggering a failure point gain.
 # You can set up the extra distance with this setting.
 #-----------------------------------------------------------------------------
 Images = {
   :back => { # Background image settings.
     :img => "back1a", :pos => [Graphics.width/10,250], :opa => 250, :z => 10,
   },
   :start => { # Start popup image settings.
     :img => "startpop1a", :pos => [Graphics.width/2,300], :z => 500,
     :opa => 0, :zoom => [0.0,0.0],
     :in_time => 60, :move_in => [0,-50], :fade_in => 255, :zoom_in => [1.0,1.0],
     :out_time => 60, :move_out => [0,50], :fade_out => -255, :zoom_out => [-1.0,-1.0],
     :wave => true,
   },
   :success => { # Success popup image settings.
     :img => "successpop1a", :pos => [Graphics.width/2,300], :z => 500,
     :opa => 0, :zoom => [0.0,0.0],
     :in_time => 60, :move_in => [0,-50], :fade_in => 255, :zoom_in => [1.0,1.0],
     :out_time => 60, :move_out => [0,50], :fade_out => -255, :zoom_out => [-1.0,-1.0],
     :wave => true,
   },
   :fail => { # Fail popup image settings.
     :img => "failpop1a", :pos => [Graphics.width/2,300], :z => 500,
     :opa => 0, :zoom => [0.0,0.0],
     :in_time => 60, :move_in => [0,-50], :fade_in => 255, :zoom_in => [1.0,1.0],
     :out_time => 60, :move_out => [0,50], :fade_out => -255, :zoom_out => [-1.0,-1.0],
     :wave => true,
   },
   :life => { # Filling "life" bar image settings.
     :img => "fail1a", :pos => [Graphics.width/2,Graphics.height-350], :opa => 250, :z => 6,
   },
   :lback => { # Background image settings for the filling "life" bar.
     :img => "fback1a", :pos => [Graphics.width/2,Graphics.height-350], :opa => 200, :z => 5,
   },    
   :sback => { # Background image settings for the score display.
     :img => "score1a", :pos => [Graphics.width/600,600], :opa => 200, :z => 5,
   },
   :current => { # Current score info display settings.
     :opa => 250, :z => 8, :size => [600,600],
     :pos => [-65,18], :tpos => [65,0],
     :style => ["mpnums1va",0], :align => 1,
   },
   :total => { # Total accumulated score info display settings.
     :opa => 250, :z => 8, :size => [600,600],
     :pos => [65,18], :tpos => [65,0],
     :style => ["mpnums1va",1], :align => 1,
   },
   
   :goal => { # Goal line image settings.
     :img => "goal2a", :pos => [224,260], :opa => 220, :z => 15
   },
   
   #-----------------------------------------------------------
   # Button Image Settings:
   #-----------------------------------------------------------
   :LEFT => {:img => "left2a", :opa => 255, :z => 20},
   :RIGHT => {:img => "right2a", :opa => 255, :z => 20},
   :UP => {:img => "up2a", :opa => 255, :z => 20},
   :DOWN => {:img => "down2a", :opa => 255, :z => 20},
   # Add more button image settings here if you want!
   #-----------------------------------------------------------
   # Line Image Settings:
   #-----------------------------------------------------------
   :line1 => {:img => "line1a", :opa => 255, :z => 10},
   :line2 => {:img => "line2a", :opa => 255, :z => 10},
   :line3 => {:img => "line3a", :opa => 255, :z => 10},
   :line4 => {:img => "line4a", :opa => 255, :z => 10},
   # Add more line image settings here if you want!
   #-----------------------------------------------------------
   # Trigger Image Settings:
   #-----------------------------------------------------------
   :trigger1 => {:img => "trigger1a", :opa => 220, :goal => [-3,3], :fail => 10},
   :trigger2 => {:img => "trigger2a", :opa => 220, :goal => [-4,4], :fail => 15},
   :trigger3 => {:img => "trigger3a", :opa => 220, :goal => [-9,9], :fail => 15},
   # Add more trigger image settings here if you want!
 }

 #-----------------------------------------------------------------------------
 # Sound Settings:
 #-----------------------------------------------------------------------------
 # Set up the BGM to be played during the game and the sound effects used upon
 # various actions during the game.
 #
 # Format: RPG::BGM.new("filename",volume,pitch), # For the BGM.
 #         RPG::SE.new("filename",volume,pitch),  # For the SEs.
 #
 # "filename" = The name of the audio file to be played.
 # volume = The volume of the audio.
 # pitch = The pitch of the audio.
 #
 # If you don't want to change the map BGM during the mini-game, set the
 # whole :bgm setting to 'nil' (without the apostrophes!), like this:
 #   :bgm => nil,
 #-----------------------------------------------------------------------------
 Sounds ={
   :success => RPG::SE.new("Decision1",80,100),
   :fail => RPG::SE.new("Buzzer1",80,100),
   :start => RPG::SE.new("Bell3",80,100),
   :win => RPG::SE.new("Chime2",80,100),
   :lose => RPG::SE.new("Buzzer1",80,100),
   :exit => RPG::SE.new("Decision2",80,100),
 }

 #-----------------------------------------------------------------------------
 # Flash Settings:
 #-----------------------------------------------------------------------------
 # You can set up a flash effect when you press a required button during a
 # mini-game. The button and line image, will flash differently depending on
 # the result of the button press.
 # If you triggered it the correct time, the :success flash effects will play
 # on the button, line and trigger images, if not, the :fail flash effects will
 # be played on the button and line images.
 #
 # Details:
 #
 #   :color => Color.new(R,G,B,A),
 # The color of the flashing. Uses RGBA codes!
 # The lower your alpha value (opacity) the less noticeable will the flash be.
 #
 #   :dur => frames,
 # The duration of the flash effect in frames. 1 second = 60 frames!
 # The button can not disappear before the flash effect is finished completely!
 #-----------------------------------------------------------------------------
 Flash = {
   :success => { # Flash settings for successful button presses.
     :color => Color.new(50,255,50,250), :dur => 20,
   },
   :fail => { # Flash settings for failed button presses.
     :color => Color.new(255,50,50,250), :dur => 20,
   },
 }

 #-----------------------------------------------------------------------------
 # Game Settings:
 #-----------------------------------------------------------------------------
 # This is where you can set up your game settings.
 # You can make different settings here, and you can load these settings for
 # the range mini-game with the script call.
 # In other words, you can use this section to make different difficulty
 # settings for your range mini-games.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Format:
 #
 #  key => { # Key used for the setting. You will use this in the script calls.
 #    :area => { # Game area settings.
 #      :pos => [x,y],
 #      :size => [width,height],
 #      :z => value,
 #    },
 #    :lines => { # Line settings.
 #      linekey1 => { # Key used for the line setting. No duplicates!
 #        :limg => line_img,
 #        :pos => [x,y],
 #        :button => button_trigger,
 #        :bpos => [x,y],
 #        :speed => [speed1, speed2, speed3, ...],
 #        :timg => [t_img1, t_img2, t_img3, ...],
 #        :wait => [min_frames, max_frames],
 #        :twait => frames,
 #        :amount => number,
 #        :max => number,
 #      },
 #      # You can add more line settings here if you want!
 #    },
 #    :score => { # Score acceleration settings.
 #      :base => value,
 #      :extra => value,
 #      :acc_a => value,
 #      :acc_b => value
 #    },
 #    :fail => { # Failure point acceleration settings.
 #      :base => value,
 #      :extra => value,
 #      :acc_a => value,
 #      :acc_b => value
 #    },
 #    :max_fail => max_fail_points,
 #  },
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Details:  
 #
 #   key => {
 # The 'key' here can be anything you want, from strings to integers across
 # symbols and arrays of data. There is only one rule: don't make duplicates!
 # You will use these keys in your script calls to load the correct settings
 # for your mini-games.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Game Area Settings:
 #
 # The goal, line, and trigger images used in the game will be shown on a
 # pre-determined area. They can NOT be displayed outside of this area!
 # This is to prevent the trigger images showing up, well, out of nowhere.
 # You can make any sized areas and put them wherever you want it on the
 # screen.
 # Remember that the above mentioned images will get cut down or will not show
 # up at all if you set their X and Y position outside of this area.
 # The [0,0] position for these images is the top left corner of this area and
 # NOT the top left corner of the game's screen!
 #
 # Details:
 #
 #   :pos => [x,y],
 # The position of the game area. Direct X and Y co-ords on the screen!
 #
 #   :size => [width,height],
 # The width and height of the game area.
 # Read more about the importance of this setting above, in the explanation
 # above.
 #
 #   :z => value,
 # The Z level of the game area. No idea why would you change this, but in case
 # you want to move it below/above pictures, you can do so by changing
 # this value.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Score Acceleration Settings:  
 #
 # Well, just as in my other mini-games, this one got an advanced score gain
 # acceleration setting. Works the same way as in my other mini-games, so if
 # you want to read the details of this setting, kindly refer to either the
 # "Stay-In-Range" or the QTE Mini-Game (Type 1) explanations in those scripts,
 # because I won't plan to write down all of this again.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Failure Point Acceleration Settings:  
 #
 # This works exactly how the score acceleration works.
 # The more time the player misses a timing, the bigger the penalty will be.
 # Once the fail meter is filled entirely, the game will end in a failure!
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Line Settings:
 #
 # This is where you set up your spawning lines. The trigger images will spawn
 # on these lines only!
 # The more lines you add for a game, the harder it gets.
 # You can add as many as you want, but make sure that you don't use the same
 # keys for them! The keys used can be anything, from strings to symbols,
 # across integer numbers and arrays of data. I used integers for the sake of
 # simplicity.
 # These lines are inside the game's area!
 #
 # Details:
 #
 #   :limg => line_img,
 # The image used for the line. This must be a key from the 'Images' settings,
 # from the Trigger Images area (well, it can be placed anywhere in that
 # setting, but for the sake of organization, you should really put them into
 # one place and group them together).
 #
 #   :pos => [x,y],
 # The position of the line image INSIDE the game's area!
 # This is a position on the game area itself, NOT a direct screen position!
 # Remember that the image's X and Y position is their center, NOT their top
 # left corner!
 #
 #   :button => button_trigger,
 # You can use any valid input keys here. Read more about input keys above,
 # at the 'Images' setting, in the 'Button Image Settings' section!
 # Every button entered here must have a button image set up using the same
 # input keys for their image setting keys!
 # Kindly don't use the same buttons for multiple lines, or your game will be
 # unplayable! Well, it can be played, but the chance to win it is close to
 # impossible. :P
 #
 #   :bpos => [x,y],
 # The position of the button image for the line. The button image will be
 # automatically selected depending on the :button settings.
 # This position is NOT tied to the game's area, it is a direct position on the
 # screen itself!
 #
 #   :speed => [speed1, speed2, speed3, ...],
 # The speed settings for the trigger images on the line.
 # Enter as many speed settings as you want! A random speed will be selected
 # for each trigger images. You can use integer or float numbers alike!
 # Needless to say, higher speed settings mean harder games!
 #
 #   :timg => [t_img1, t_img2, t_img3, ...],
 # These are the trigger images used on the line.
 # Enter as many as you want! A random image will be selected each time a
 # trigger image is spawned.
 # You can only use keys from the 'Images' setting here, from the
 # "Trigger Image" section.
 # Note that the images used here will be automatically centered horizontally
 # on the line images!
 #  
 #   :wait => [min_frames, max_frames],
 # The minimum and maximum waiting time between spawning two trigger images.
 # The next trigger will wait a random amount of frames between these numbers
 # before it spawns.
 # If no more trigger images can be spawned (specified with the :max setting),
 # they won't spawn anymore until at least one disappears, regardless of the
 # waiting time!
 #
 #   :twait => frames,
 # The amount of frames the trigger images will stay on the screen after they
 # are triggered or after they reached their final destination.
 # The trigger image will wait until the flash effect is over plus the number
 # of frames you enter here.
 #
 #   :amount => number,
 # The number of trigger images to spawn on the line.
 # If the amount of total trigger images spawned reaches this number, no more
 # trigger images will be spawned on the line.
 # If all lines are out of trigger images, the game will end in a success.
 #
 #   :max => number,
 # The maximum amount of trigger images shown on a line at any given time.
 # If there are this many trigger images shown on the line, new ones will not
 # be spawn until at least one disappears.
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # Rest of the Settings:
 #
 # Well, only one left, and that is:
 #
 #   :max_fail => max_fail_points,
 # As in my other mini-games, this is the maximum amount of failure points the
 # player can get before triggering the game over popup.
 #-----------------------------------------------------------------------------
 Games = {
   :easy => { # Easy difficulty.
     :area => {
       :pos => [96,106], :size => [448,300], :z => 200,
         :bgm => RPG::BGM.new("garden",100,100),
     },
     :lines => {
       0 => {
         :limg => :line1, :pos => [300,142], :button => :LEFT, :bpos => [395,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [170,330], :twait => 30, :amount => 10, :max => 3,
       },
       1 => {
         :limg => :line4, :pos => [370,142], :button => :RIGHT, :bpos => [465,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [170,360], :twait => 30, :amount => 10, :max => 3,
       },
     },
     :score => {:base => 4, :extra => 0.5, :acc_a => 1.1, :acc_b => 1.5},
     :fail => {:base => 3, :extra => 0.3, :acc_a => 1.2, :acc_b => 1.3},
     :max_fail => 320,
   },
   :normal => { # Normal difficulty.
     :area => {
       :pos => [96,106], :size => [448,300], :z => 200,
     },
     :lines => {
       0 => {
         :limg => :line1, :pos => [170,142], :button => :LEFT, :bpos => [266,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [160,260], :twait => 30, :amount => 10, :max => 3,
       },
       1 => {
         :limg => :line2, :pos => [224,142], :button => :UP, :bpos => [321,406],
         :speed => [0.5,0.6,0.7], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [180,280], :twait => 30, :amount => 10, :max => 3,
       },
       2 => {
         :limg => :line3, :pos => [278,142], :button => :RIGHT, :bpos => [374,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [170,260], :twait => 30, :amount => 10, :max => 3,
       },
     },
     :score => {:base => 4, :extra => 0.5, :acc_a => 1.1, :acc_b => 1.5},
     :fail => {:base => 3, :extra => 0.3, :acc_a => 1.2, :acc_b => 1.3},
     :max_fail => 420,
   },
   :hard => { # Hard difficulty.
     :area => {
       :pos => [96,106], :size => [448,300], :z => 200,
     },
     :lines => {
       0 => {
         :limg => :line1, :pos => [140,142], :button => :LEFT, :bpos => [236,406],
         :speed => [0.3,0.4,0.5], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [160,260], :twait => 30, :amount => 10, :max => 3,
       },
       1 => {
         :limg => :line2, :pos => [194,142], :button => :UP, :bpos => [290,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [180,270], :twait => 30, :amount => 10, :max => 3,
       },
       2 => {
         :limg => :line3, :pos => [248,142], :button => :DOWN, :bpos => [344,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [180,270], :twait => 30, :amount => 10, :max => 3,
       },
       3 => {
         :limg => :line4, :pos => [302,142], :button => :RIGHT, :bpos => [398,406],
         :speed => [0.3,0.4,0.5], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [160,260], :twait => 30, :amount => 10, :max => 3,
       },
     },
     :score => {:base => 4, :extra => 0.5, :acc_a => 1.1, :acc_b => 1.5},
     :fail => {:base => 3, :extra => 0.3, :acc_a => 1.2, :acc_b => 1.3},
     :max_fail => 620,
   },
   :insane => { # Insane difficulty.
     :area => {
       :pos => [96,106], :size => [448,300], :z => 200,
     },
     :lines => {
       0 => {
         :limg => :line1, :pos => [140,142], :button => :LEFT, :bpos => [236,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [160,260], :twait => 30, :amount => 20, :max => 3,
       },
       1 => {
         :limg => :line2, :pos => [194,142], :button => :UP, :bpos => [290,406],
         :speed => [0.6,0.7,0.8], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [300,360], :twait => 30, :amount => 15, :max => 3,
       },
       2 => {
         :limg => :line3, :pos => [248,142], :button => :DOWN, :bpos => [344,406],
         :speed => [0.6,0.7,0.8], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [300,360], :twait => 30, :amount => 15, :max => 3,
       },
       3 => {
         :limg => :line4, :pos => [302,142], :button => :RIGHT, :bpos => [398,406],
         :speed => [0.4,0.5,0.6], :timg => [:trigger1,:trigger2,:trigger3],
         :wait => [160,260], :twait => 30, :amount => 20, :max => 3,
       },
     },
     :score => {:base => 4, :extra => 0.5, :acc_a => 1.1, :acc_b => 1.5},
     :fail => {:base => 3, :extra => 0.3, :acc_a => 1.2, :acc_b => 1.3},
     :max_fail => 1020,
   },
   # Add more game settings here if you want!
 }
 
end
#===============================================================================
# End of Settings! Editing anything below may lead to... you know it, right?
#===============================================================================

class Game_Interpreter
 
 def start_qte2(type)
   game_on = QTE_Type2.new(type)
   while $game_system.minigames(:qte2)[:active] == true
     return if !$game_system.minigames(:qte2)[:active]
     Fiber.yield
     game_on.update
   end
 end
 
end

class QTE_Type2

 def initialize(type)
   if QTEGame2::Sounds[:bgm]
     @map_bgm = RPG::BGM.last
     QTEGame2::Sounds[:bgm].play
   end
   $game_system.minigames(:qte2)[:active] = true
   @data = QTEGame2::Games[type]
   @phase = :start
   @success = @failnum = 1
   @fail = 0
   vpos = @data[:area][:pos]
   vsz = @data[:area][:size]
   @view = Viewport.new(vpos[0],vpos[1],vsz[0],vsz[1])
   @view.z = @data[:area][:z]
   @imgs = {}
   [:back,:goal].each {|tt| init_sprites(tt)}
   $game_system.minigames(:qte2)[:score][:current] = 0
   @lines = {}
   @data[:lines].each {|line,data| init_lines(line,data)}
   @score = ScoreDisplay.new([0,0],:qte2) if QTEGame2::UseScore
   @failbar = FailBar.new([0,0],:qte2)
 end
 
 def init_sprites(type)
   dt = $game_system.minigames(:qte2)[:imgs][type]
   @imgs[type] = Sprite.new if type == :back
   @imgs[type] = Sprite.new(@view) if type == :goal
   @imgs[type].bitmap = Cache.custom_imgs(dt[:img],QTEGame2::ImgFolder)
   @imgs[type].opacity = dt[:opa]
   @imgs[type].ox = @imgs[type].bitmap.width/2
   @imgs[type].oy = @imgs[type].bitmap.height/2
   @imgs[type].x = dt[:pos][0]
   @imgs[type].y = dt[:pos][1]
   @imgs[type].z = dt[:z]
 end
 
 def init_lines(key,dat)
   dt = $game_system.minigames(:qte2)[:imgs][dat[]][:img]
   @lines[key] = QTE_Lines.new(self,dat,@view)
 end
 
 def get_goal
   return @imgs[:goal]
 end
 
 def get_phase
   return @phase
 end
 
 def update
   case @phase
   when :start
     update_start_game
   when :game
     check_end_game
   when :prep_disp
     prep_disp
   when :dispose
     dispose
   end
   update_lines
   @pop.update if !@pop.nil?
 end

 def update_game_start
   @lines.each_value {|line| line.set_phase(:game)}
 end

 def update_lines
   @lines.each_value {|line| line.update}
 end
 
 def update_start_game
   @pop = ResultPop.new(:qte2,:start) if @pop.nil?
   if @pop.phase == :wait && Input.trigger?(:C)
     QTEGame2::Sounds[:start].play
   end
   if @pop.disposed?
     update_game_start
     @phase = :game
     @pop = nil
   end
 end
 
 def check_end_game
   if @lines.values.all? {|ln| ln.get_phase == :end_game}
     if @fail >= @data[:max_fail]
       @pop = ResultPop.new(:qte2,:fail)
       QTEGame2::Sounds[:lose].play
       $game_system.minigames(:qte2)[:score][:lose] += 1
       $game_system.minigames(:qte2)[:result] = false
     else
       @pop = ResultPop.new(:qte2,:success)
       QTEGame2::Sounds[:win].play
       $game_system.minigames(:qte2)[:score][:win] += 1
       $game_system.minigames(:qte2)[:score][:total] += $game_system.minigames(:qte2)[:score][:current]
       @score.set_score(:total) if QTEGame1::UseScore
       $game_system.minigames(:qte2)[:result] = true
       if $game_system.minigames(:qte2)[:score][:current] > $game_system.minigames(:qte2)[:score][:high]
         $game_system.minigames(:qte2)[:score][:high] = $game_system.minigames(:qte2)[:score][:current]
       end
     end
     @phase = :prep_disp
   end
 end
 
 def refresh_failbar(val)
   @fail += val
   rate = @fail.to_f/@data[:max_fail]
   @failbar.set_life(rate)
   if @fail >= @data[:max_fail]
     @lines.each_value {|line| line.set_fail_game}
   end
 end
 
 def set_score(amount)
   if amount > 0
     amount *= 2 if amount > 1
     @success += amount; @failnum = 1
     val = acc_level(:score,@success)
     $game_system.minigames(:qte2)[:score][:current] += val
     @score.set_score(:current) if QTEGame2::UseScore
   else
     @success = 1; @failnum += 1
     val = acc_level(:fail,@failnum)
     refresh_failbar(val)
   end
 end
 
 def acc_level(type,level)
   lv = level.to_f
   basis = @data[type][:base].to_f
   extra = @data[type][:extra].to_f
   acc_a = @data[type][:acc_a].to_f
   acc_b = @data[type][:acc_b].to_f
   return (basis*((lv-1)**(0.9+acc_a/250))*lv*(lv+1)/
     (6+lv**2/50/acc_b)+(lv-1)*extra).round.to_i
 end

 def prep_disp
   if @pop.phase == :wait && Input.trigger?(:C)
     QTEGame2::Sounds[:exit].play
     @phase = :dispose
   end
 end
 
 def dispose
   if @pop.disposed?
     @imgs.each_value {|sp| sp.dispose}
     @lines.each_value {|ln| ln.dispose}
     @score.dispose if QTEGame2::UseScore
     @failbar.dispose
     @view.dispose
     $game_system.minigames(:qte2)[:active] = false
     @map_bgm.replay if QTEGame2::Sounds[:bgm]
   end
 end

end

class QTE_Lines
 
 def initialize(game,data,view)
   @game = game; @data = data; @view = view; @max = 0
   @phase = :start; @triggers = []; @aborting = false
   @wait = 0; @mwait = SixthNum.random(*@data[:wait])
   @imgs = {}
   [:limg,:button].each {|key| init_sprites(key,view)}
 end
 
 def get_phase
   return @phase
 end
 
 def set_phase(phase)
   @phase = phase
 end
 
 def init_sprites(key,view)
   dt = $game_system.minigames(:qte2)[:imgs][@data[key]]
   @imgs[key] = Sprite.new(view) if key == :limg
   @imgs[key] = Sprite.new if key == :button
   @imgs[key].bitmap = Cache.custom_imgs(dt[:img],QTEGame2::ImgFolder).clone
   @imgs[key].opacity = dt[:opa]
   @imgs[key].z = dt[:z]
   @imgs[key].ox = @imgs[key].bitmap.width/2
   @imgs[key].oy = @imgs[key].bitmap.height/2
   @imgs[key].x = key == :limg ? @data[:pos][0] : @data[:bpos][0]
   @imgs[key].y = key == :limg ? @data[:pos][1] : @data[:bpos][1]
 end
 
 def set_fail_game
   @triggers.each do |trigger|
     next if trigger.nil? || trigger.disposed? || trigger.get_phase == :end
     trigger.start_flash(:fail)
     line_flash(:fail)
   end
   @aborting = true
 end
 
 def update
   @imgs.each_value {|sp| sp.update unless sp.disposed?}
   update_triggers
   case @phase
   when :game
     if !@aborting
       update_line
       update_button_trigger
     end
     check_end_game
   when :end_game
     update_empty_game
   end
 end
 
 def line_flash(type)
   dt = QTEGame2::Flash[type]
   @imgs.each_value {|sp| sp.flash(dt[:color], dt[:dur]) unless sp.disposed?}
 end
 
 def update_empty_game
   if Input.trigger?(@data[:button]) && @game.get_phase == :game
     QTEGame2::Sounds[:fail].play
     line_flash(:fail)
     @game.set_score(0)
   end
 end
 
 def update_line
   if @max < @data[:max] && @triggers.size < @data[:amount] && @wait >= @mwait
     pos = [@imgs[:limg].x, @imgs[:limg].y - @imgs[:limg].bitmap.height/2]
     z = [@imgs[:limg].z, @game.get_goal.z].max + 1 + @triggers.size
     @triggers[@triggers.size] = QTE_Triggers.new(pos,@data,@view,z)
     @max += 1
     @mwait = SixthNum.random(*@data[:wait])
     @wait = 0
   else
     @wait += 1
   end
 end
 
 def check_end_game
   if (@triggers.size >= @data[:amount] || @aborting) &&
       @triggers.all? {|tr| tr.nil? ? true : tr.disposed?}
     @phase = :end_game
   end
 end
 
 def update_button_trigger
   if Input.trigger?(@data[:button])
     check_triggers
   end
 end
   
 def check_triggers
   amount = 0
   @triggers.each do |trigger|
     next if trigger.nil? || trigger.disposed?
     gl = trigger.get_goal
     if trigger.img.y.between?(@game.get_goal.y+gl[0],@game.get_goal.y+gl[1]) &&
        trigger.get_phase == :start
       amount += 1
       trigger.start_flash(:success) unless trigger.get_phase == :end
     end
   end
   @game.set_score(amount)
   if amount > 0
     line_flash(:success)
   else
     line_flash(:fail)
     QTEGame2::Sounds[:fail].play
   end
 end
 
 def update_triggers
   @triggers.each_with_index do |trigger,i|
     next if trigger.nil?
     if trigger.disposed?
       @triggers[i] = nil
       @max -= 1
     else
       if trigger.img.y + trigger.get_goal[0] >= @game.get_goal.y + trigger.get_fadd
         unless trigger.get_phase == :end
           trigger.start_flash(:fail)
           line_flash(:fail)
           @game.set_score(0)
         end
       end
       trigger.update
     end
   end
 end
   
 def dispose
   @triggers.each {|sp| next if sp.nil?; sp.dispose unless sp.disposed?}
   @imgs.each_value {|sp| sp.bitmap.dispose; sp.dispose}
 end
 
end

class QTE_Triggers
 
 def initialize(pos,data,view,z)
   @data = data; @pos = pos; @phase = :start
   @speed = data[:speed].sample
   @move = 0; @wait = 0
   imgkey = data[:timg].sample
   init_sprite(imgkey,view,z)
 end
 
 def init_sprite(key,view,z)
   dt = $game_system.minigames(:qte2)[:imgs][key]
   @goal = dt[:goal]; @fadd = dt[:fail]
   @img = Sprite.new(view)
   @img.bitmap = Cache.custom_imgs(dt[:img],QTEGame2::ImgFolder).clone
   @img.opacity = dt[:opa]
   @img.z = z
   @img.ox = @img.bitmap.width/2
   @img.oy = @img.bitmap.height/2
   @img.x = @pos[0]
   @img.y = @pos[1] - @img.bitmap.height/2
 end
 
 def img
   return @img
 end
 
 def get_goal
   return @goal
 end
 
 def get_fadd
   return @fadd
 end
 
 def get_phase
   return @phase
 end
 
 def start_flash(type,se = true)
   dt = QTEGame2::Flash[type]
   QTEGame2::Sounds[type].play if se
   @img.flash(dt[:color], dt[:dur])
   @flwait = dt[:dur]
   @phase = :end
 end
 
 def update
   case @phase
   when :start
     update_move
   when :end
     prep_end
   end
   @img.update unless disposed?
 end
 
 def update_move
   @move += @speed
   @img.y = @pos[1] + @move
 end
 
 def prep_end
   if @wait >= @flwait + @data[:twait]
     if @img.opacity > 0
       @img.opacity -= 20
     else
       dispose
     end
   else
     @wait += 1
   end
 end
 
 def disposed?
   return @img.disposed?
 end
 
 def dispose
   @img.bitmap.dispose
   @img.dispose
 end
 
end
#==============================================================================
# !!END OF SCRIPT - OHH, NOES!!
#==============================================================================

Link de la demo del script: https://www.mediafire.com/?pbncoik5eca2ai2

Se trata de un script de un minijuego que va de pulsar las notas cuando caen, como stepmania.

El problema de este script es que solo te deja seleccionar una música y encima no estará coordinada con el juego por que la música saldrá aun cuando no le has dado a "Start"

Lo que querria hacer serian 2 opciones:

La primera y sencilla: Que el minijuego se inicie sin esa parte de pulsar "start". Asi el juego iria sincronizado con la música que pondría fácilmente.

La segunda y algo mas complicada: Al darle comenzar pues que sonase la música que yo quisiera.

Básicamente eso es lo que querria, ya os digo no soy muy sabido en el tema, pero no se si esto seria difícil de hacer para los scripters, pero espero que me podáis hacer un favor grandísimo.

Sin mas me despido y espero vuestra amable ayuda.

Hasta pronto
avatar
Dails
Novato
Novato

0/3

Créditos 100

Gracias : 20

Volver arriba Ir abajo

RPG Maker VX ACE Re: [Pedido] Pequeña ayuda con 2 scripts

Mensaje por Wecoc el 2018-05-02, 17:25

Este script usa una gran cantidad de Symbol hasta el punto que no sé ni lo que estoy viendo xD
Poco se me ocurre para ayudarte en esto y tampoco puedo probarlo, espero que alguien que use VX Ace te pueda echar un cable.

Lo que se me ocurre como prueba es cambiar esto:
Código:
@phase = :start
Por esto:
Código:
@phase = :game

Aparece tres veces en el script y eso debería saltarse la fase :start entera, que creo que es lo que buscas.
avatar
Wecoc
Administrador
Administrador



Créditos 12314

Gracias : 655

Volver arriba Ir abajo

RPG Maker VX ACE Re: [Pedido] Pequeña ayuda con 2 scripts

Mensaje por Dails el 2018-05-07, 22:15

@Wecoc escribió:Este script usa una gran cantidad de Symbol hasta el punto que no sé ni lo que estoy viendo xD
Poco se me ocurre para ayudarte en esto y tampoco puedo probarlo, espero que alguien que use VX Ace te pueda echar un cable.

Lo que se me ocurre como prueba es cambiar esto:
Código:
@phase = :start
Por esto:
Código:
@phase = :game

Aparece tres veces en el script y eso debería saltarse la fase :start entera, que creo que es lo que buscas.

No me aparece el start... pero tampoco las teclas. Sin embargo el juego va y cuando se falla el minijuego el juego tampoco muestra la pantalla de game over...

Por cierto, hay otro script enlanzado a este para que funcione

Código:
#===============================================================================
# * [ACE] Mini-Game Base
#===============================================================================
# * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
# * Version: 1.1
# * Updated: 13/12/2015
# * Requires: Sixth's Picture Number Drawing
#-------------------------------------------------------------------------------
# * < Change Log >
#-------------------------------------------------------------------------------
# * Version 1.0 (08/12/2015)
#  - Initial release.
# * Version 1.1 (13/12/2015)
#  - Added support for my 3rd released mini-game (QTE Mini-Game Type 2).
#-------------------------------------------------------------------------------
# * < Description >
#-------------------------------------------------------------------------------
# * This script contains shared classes, modules and methods for all of my
#  mini-game scripts.
# * Adds script calls for the following things:
#  - Changing the images used in a mini-game.
#  - Checking the result of a mini-game (won or lost).
#  - Checking the scores of a mini-game.
#-------------------------------------------------------------------------------
# * < Script Calls >
#-------------------------------------------------------------------------------
# * To check for the result of the last mini-game, use this script call in a
#  scripted conditional branch command:
#
#    game_result(game_key) == true
#  This checks if the last game played is won or not.
#  Returns true if the game is won, false otherwise.
#
#    game_result(game_key) == false
#  This checks if the last game played is lost or not.
#  Returns true if the game is lost, false otherwise.
#
#  Replace 'game_key' with one of the following symbols:
#  :range = Checks the result of the last "Stay-In-Range" mini-game.
#  :qte1 = Checks the result of the last QTE (Type 1) mini-game.
#  :qte2 = Checks the result of the last QTE (Type 2) mini-game.
#
#  Examples: game_result(:range) == true
#            game_result(:qte1) == false
#            game_result(:qte2) == true
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * You also have the following variables which you can use to check the score
#  of a mini-game or to assign their value to a database variable, which lets
#  you display the score in message boxes.
#
#    game_score(game_key,score_type)
#
#  Replace 'game_key' with one of the following symbols:
#  :range = Checks the score for the "Stay-In-Range" mini-game.
#  :qte1 = Checks the score for the QTE (Type 1) mini-game.
#  :qte2 = Checks the score for the QTE (Type 2) mini-game.
#
#  Replace 'score_type' with one of the following symbols:
#  :current = This is the last score recorded from the mini-game.
#              This will be updated at the end of each game, regardless if the
#              player has won or not!
#  :high = This is the highest score gotten in a mini-game.
#          This score only updates if the player actually won the game!
#  :total = This is the total accumulated score for a mini-game.
#            If the player wins a game, the score from the last game always gets
#            added to this total score variable.
#            The last score will NOT be added if the player lost the game!
#  :win = The number of mini-games the player won from a mini-game type.
#  :lose = The number of mini-games the player lost from a mini-game type.
#
#  So, knowing this, you can check for these scores in conditional branches by
#  using the "Script" option.
#  Examples: game_score(:range,:current) >= 6500
#            game_score(:range,:high) >= 25500
#            game_score(:range,:lose) <= 10
#            game_score(:qte1,:total) >= 582500
#            game_score(:qte2,:win) >= 35
#
#  You can also set these recorded values to a database variable. That lets you
#  display them in a message box. Use the "Script" command to set a variable
#  to one of these recorded scores, and show the variable the regular way in
#  the message box ( \V[var_id] ).
#  Examples: game_score(:qte1,:current)
#            game_score(:qte2,:high)
#            game_score(:qte1,:lose)
#            game_score(:range,:total)
#            game_score(:range,:win)
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# * You can chane any properties of any images used for the mini-games even
#  during the game. Use this script call to do that:
#
#    change_game_imgs(:game_key,:img_type,:prop,data)

#  :game_key = Can be one of these:
#              :range = Changes the images used in the "Stay-In-Range" game.
#              :qte1 = Changes the images used in the QTE (Type 1) game.
#              :qte2 = Changes the images used in the QTE (Type 2) game.
#  :img_type = The key representing the image you want to change. Can be any
#              keys from the 'Images' setting from the script!
#              Ex.: :cursor, :bar, :back, :life, :start, :fail, ...
#  :prop = The property of the image you want to change for. Can be any
#          property keys from the 'Images' settings!
#          Ex.: :opa, :pos, :img, :style, :zoom_in, ...
#  data = This is the new value of the property. This must follow the same
#          format as the ones from the script setting! So, for :opa, this must
#          be a single integer number from 0 to 255, for :pos, this must be an
#          array with the X and Y offset values ([x,y]), for :img, this must be
#          a string which is the name of the image you want to use, and so on.
#
#  Examples: change_game_imgs(:range,:cursor,:img,"cursor3b")
#            change_game_imgs(:qte1,:life,:pos,[0,-78])
#            change_game_imgs(:qte2,:total,:style,["numbv2c",1])
#            change_game_imgs(:range,:current,:align,2)
#-------------------------------------------------------------------------------
# * < Installation >
#-------------------------------------------------------------------------------
# * Place this script below Materials but above Main!
#-------------------------------------------------------------------------------
# * < Compatibility Info >
#-------------------------------------------------------------------------------
# * No known incompatibilities.
#-------------------------------------------------------------------------------
# * < Known Issues >
#-------------------------------------------------------------------------------
# * No known issues.
#-------------------------------------------------------------------------------
# * < Terms of Use >
#-------------------------------------------------------------------------------
# * Free to use for whatever purposes you want.
# * Credit me (Sixth) in your game, pretty please! :P
# * Posting modified versions of this script is allowed as long as you notice me
#  about it with a link to it!
#===============================================================================
$imported = {} if $imported.nil?
$imported["SixthMiniGameBase"] = true
#===============================================================================
# No settings here! o.o
#===============================================================================

module SixthNum
 
  def self.random(min, max)
    min + rand(max - min + 1)
  end
 
end

module Cache
 
  def self.custom_imgs(filename,folder)
    load_bitmap(folder,filename)
  end
 
end

class Game_Interpreter

  def check_game_result(type,check = true)
    return $game_system.minigames(type)[:result] == check
  end
 
  def game_score(type,stype)
    return $game_system.minigames(type)[:score][stype]
  end
 
  def game_result(type)
    return $game_system.minigames(type)[:result]
  end
 
  def change_game_imgs(game,type,prop,data)
    $game_system.minigames(game)[:imgs][type][prop] = data
  end
 
end

class Game_System
 
  attr_accessor :minigames
 
  def minigames(type)
    @minigames = {} if @minigames.nil?
    init_mini_game(type) if @minigames[type].nil?
    return @minigames[type]
  end
 
  def init_mini_game(type)
    @minigames[type] = {}
    case type
    when :range
      @minigames[type][:imgs] = Marshal.load(Marshal.dump(RangeMiniGame::Images))
    when :qte1
      @minigames[type][:imgs] = Marshal.load(Marshal.dump(QTEGame1::Images))
      @minigames[type][:temp] = {}
      [:fail,:success].each {|tt| @minigames[type][:temp][tt] = 1}
    when :qte2
      @minigames[type][:imgs] = Marshal.load(Marshal.dump(QTEGame2::Images))
      @minigames[type][:temp] = {}
      [:fail,:success].each {|tt| @minigames[type][:temp][tt] = 1}
    end
    score = {}
    [:current,:win,:lose,:total,:high].each {|tt| score[tt] = 0}
    @minigames[type][:score] = score
    @minigames[type][:active] = false
    @minigames[type][:result] = false
  end
 
end

class ScoreDisplay
 
  def initialize(pos,type)
    @pos = pos; @type = type
    case @type
    when :range; @folder = RangeMiniGame::ImgFolder
    when :qte1; @folder = QTEGame1::ImgFolder
    when :qte2; @folder = QTEGame2::ImgFolder
    end
    @imgs = {}
    init_back_img(:sback)
    [:current,:total].each {|type| init_score_sprites(type)}
  end
 
  def init_back_img(type)
    dt = $game_system.minigames(@type)[:imgs][type]
    @imgs[type] = Sprite.new
    @imgs[type].bitmap = Cache.custom_imgs(dt[:img],@folder)
    @imgs[type].opacity = dt[:opa]
    @imgs[type].z = dt[:z]
    @imgs[type].ox = @imgs[type].bitmap.width/2
    @imgs[type].oy = @imgs[type].bitmap.height/2
    @imgs[type].x = @pos[0] + dt[:pos][0]
    @imgs[type].y = @pos[1] + dt[:pos][1]
  end
 
  def init_score_sprites(type)
    dt = $game_system.minigames(@type)[:imgs][type]
    @imgs[type] = Sprite.new
    @imgs[type].bitmap = Bitmap.new(*dt[:size])
    @imgs[type].opacity = dt[:opa]
    @imgs[type].z = dt[:z]
    @imgs[type].ox = @imgs[type].bitmap.width/2
    @imgs[type].oy = @imgs[type].bitmap.height/2
    @imgs[type].x = @imgs[:sback].x + dt[:pos][0]
    @imgs[type].y = @imgs[:sback].y + dt[:pos][1]
    @imgs[type].bitmap.num_style = dt[:style]
    set_score(type)
  end

  def set_score(type)
    num = $game_system.minigames(@type)[:score][type]
    al = $game_system.minigames(@type)[:imgs][type][:align]
    pos = $game_system.minigames(@type)[:imgs][type][:tpos]
    @imgs[type].bitmap.draw_numbers(pos[0],pos[1],num,255,al,true)   
  end
   
  def dispose
    @imgs.each_value {|sp| sp.bitmap.dispose; sp.dispose}
  end
   
end

class FailBar

  def initialize(pos,type)
    @pos = pos; @type = type
    case @type
    when :range; @folder = RangeMiniGame::ImgFolder
    when :qte1; @folder = QTEGame1::ImgFolder
    when :qte2; @folder = QTEGame2::ImgFolder
    end
    @imgs = {}
    [:lback,:life].each {|type| init_images(type)}
    set_life(0.0)
  end
 
  def init_images(type)
    dt = $game_system.minigames(@type)[:imgs][type]
    @imgs[type] = Sprite.new
    @imgs[type].bitmap = Cache.custom_imgs(dt[:img],@folder)
    @imgs[type].opacity = dt[:opa]
    @imgs[type].z = dt[:z]
    @imgs[type].ox = @imgs[type].bitmap.width/2
    @imgs[type].oy = @imgs[type].bitmap.height/2
    @imgs[type].x = @pos[0] + dt[:pos][0]
    @imgs[type].y = @pos[1] + dt[:pos][1]
  end
 
  def set_life(rate)
    rate = 1.0 if rate > 1.0
    @imgs[:life].src_rect.width = @imgs[:life].bitmap.width * rate
  end
 
  def dispose
    @imgs.each_value {|sp| sp.bitmap.dispose; sp.dispose}
  end

end

class ResultPop
 
  attr_reader :phase
 
  def initialize(game,type,pos = nil)
    @game = game; @type = type; @phase = :game
    @in_time = @out_time = 0
    @pos = pos.nil? ? 0 : pos
    @data = $game_system.minigames(@game)[:imgs][@type]
    @in_dt = {}
    [:move,:zoom,:fade].each {|tt| @in_dt[tt] = tt == :fade ? 0 : [0,0]}
    @out_dt = {}
    [:move,:zoom,:fade].each {|tt| @out_dt[tt] = tt == :fade ? 0 : [0,0]}
    case @game
    when :range; @folder = RangeMiniGame::ImgFolder
    when :qte1; @folder = QTEGame1::ImgFolder
    when :qte2; @folder = QTEGame2::ImgFolder
    end
    init_sprite
  end
 
  def init_sprite
    @pop = Sprite.new
    @pop.bitmap = Cache.custom_imgs(@data[:img],@folder)
    @pop.opacity = @data[:opa]
    @pop.z = @data[:z]
    @pop.ox = @pop.bitmap.width/2
    @pop.oy = @pop.bitmap.height/2
    @pop.x = @pos[0] + @data[:pos][0]
    @pop.y = @pos[1] + @data[:pos][1]
    @pop.zoom_x = @data[:zoom][0]
    @pop.zoom_y = @data[:zoom][1]
    if @data[:wave]
      @pop.wave_amp = 4
      @pop.wave_length = 240
      @pop.wave_speed = 360
    end
  end
 
  def update
    case @phase
    when :start
      update_pop_in
    when :wait
      @pop.update
      update_trigger
    when :end
      update_pop_out
    when :dispose
      dispose unless disposed?
    end
  end
 
  def update_trigger
    if Input.trigger?(:C)
      @phase = :end
    end
  end
 
  def update_pop_in
    if @data[:in_time] && @in_time < @data[:in_time]
      if @data[:move_in]
        @in_dt[:move][0] += @data[:move_in][0]/@data[:in_time].to_f
        @in_dt[:move][1] += @data[:move_in][1]/@data[:in_time].to_f
        @pop.x = @pos[0] + @data[:pos][0] + @in_dt[:move][0]
        @pop.y = @pos[1] + @data[:pos][1] + @in_dt[:move][1]
      end
      if @data[:fade_in]
        @in_dt[:fade] += @data[:fade_in]/@data[:in_time].to_f
        @pop.opacity = @data[:opa] + @in_dt[:fade]
      end
      if @data[:zoom_in]
        @in_dt[:zoom][0] += @data[:zoom_in][0]/@data[:in_time].to_f
        @in_dt[:zoom][1] += @data[:zoom_in][1]/@data[:in_time].to_f
        @pop.zoom_x = @data[:zoom][0] + @in_dt[:zoom][0]
        @pop.zoom_y = @data[:zoom][1] + @in_dt[:zoom][1]
      end
      @in_time += 1
    else
      @phase = :wait
    end
  end
 
  def update_pop_out
    if @data[:out_time] && @out_time < @data[:out_time]
      if @data[:move_out]
        @out_dt[:move][0] += @data[:move_out][0]/@data[:out_time].to_f
        @out_dt[:move][1] += @data[:move_out][1]/@data[:out_time].to_f
        @pop.x = @pos[0] + @data[:pos][0] + @in_dt[:move][0] + @out_dt[:move][0]
        @pop.y = @pos[1] + @data[:pos][1] + @in_dt[:move][1] + @out_dt[:move][1]
      end
      if @data[:fade_out]
        @out_dt[:fade] += @data[:fade_out]/@data[:out_time].to_f
        @pop.opacity = @data[:opa] + @in_dt[:fade] + @out_dt[:fade]
      end
      if @data[:zoom_out]
        @out_dt[:zoom][0] += @data[:zoom_out][0]/@data[:out_time].to_f
        @out_dt[:zoom][1] += @data[:zoom_out][1]/@data[:out_time].to_f
        @pop.zoom_x = @data[:zoom][0] + @in_dt[:zoom][0] + @out_dt[:zoom][0]
        @pop.zoom_y = @data[:zoom][1] + @in_dt[:zoom][1] + @out_dt[:zoom][1]
      end
      @out_time += 1
    else
      @phase = :dispose
    end
  end
 
  def dispose
    @pop.bitmap.dispose
    @pop.dispose
  end
 
  def disposed?
    return @pop.disposed?
  end
 
end
#==============================================================================
# !!END OF SCRIPT - OHH, NOES!!
#==============================================================================

Tambien le cambie los start por los game...
avatar
Dails
Novato
Novato

0/3

Créditos 100

Gracias : 20

Volver arriba Ir abajo

RPG Maker VX ACE Re: [Pedido] Pequeña ayuda con 2 scripts

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


Permisos de este foro:
No puedes responder a temas en este foro.