Better Screen Shake control?

Discussion in 'RGSS3 Script Requests' started by nio kasgami, Sep 26, 2014.

  1. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,600
    Likes Received:
    2,358
    Location:
    Canada / Quebec
    First Language:
    French
    Hi people :3

    I just wounder if they exist a script who allow to control your shake screen?

    I mean like I want to be able to shake in every sens I want 

    or also to not  limite my screen shaking to a certain time but time I want or also they always shake until I call it to stop shaking

    I hope people thinked to create this kind of script? 

    because I want to be in a train so the screen shake smoothly until the ''train'' stop moving

    thanks if people can help : D!
     
    #1
    Evan Finkel likes this.
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,816
    Likes Received:
    11,523
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Isn't there a bug with the current screen shake? There might be a fix in the new version or in the bug fixes thread. If you have that, does it make it any better?


    I have a scene that's a ride inside a wagon, and you can see the scrolling parallax through transparent areas on the map. For the screen shaking, I think I used a parallel process event that did a screen shake for X seconds (there might have been a Wait X seconds as well, if the Shake Screen doesn't have a Wait option), and then repeats. It executes the effect quite nicely.
     
    #2
  3. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,600
    Likes Received:
    2,358
    Location:
    Canada / Quebec
    First Language:
    French
    they have a fix for this? i am not sure if I have the bug fix 

    but for the way you explain i am sorry i have dificulty to ''understand'' how to do this if 

    I understand I should use a parrallel process

    after I input exemple a ''shake'' sequence ? 

    after for repeat I wounder I should add a Loop or something like that? 

    Sorry if I am not clear of what I said I try to be sure I understand...
     
    #3
  4. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Credit Neonblack as well.

    Code:
    #vertical_shake(power, speed, duration, wait)#vertical_shake and horizontal_shake class Game_Interpreter  def vertical_shake(power, speed, duration, pause = false)    screen.start_shake_vert(power, speed, duration)    wait(duration) if pause  end   def horizontal_shake(power, speed, duration, pause = false)    screen.start_shake(power, speed, duration)    wait(duration) if pause  end   def command_225    screen.start_shake(@params[0], @params[1], @params[2])    wait(@params[2]) if @params[3]  endend class Spriteset_Map  alias aliased_update_viewports update_viewports  def update_viewports    @viewport1.oy = $game_map.screen.shake2    aliased_update_viewports  endend class Game_Screen  attr_reader :shake2   alias aliased_clear_shake clear_shake  def clear_shake    aliased_clear_shake    @shake_power2 = 0    @shake_speed2 = 0    @shake_duration2 = 0    @shake_direction2 = 1    @shake2 = 0  end   def start_shake_vert(power, speed, duration)    @shake_power2 = power    @shake_speed2 = speed    @shake_duration2 = duration  end   alias aliased_update_shake update_shake  def update_shake    aliased_update_shake    if @shake_duration2 > 0 || @shake2 != 0      delta = (@shake_power2 * @shake_speed2 * @shake_direction2) / 10.0      if @shake_duration2 <= 1 && @shake2 * (@shake2 + delta) < 0        @shake2 = 0      else        @shake2 += delta      end      @shake_direction2 = -1 if @shake2 > @shake_power2 * 2      @shake_direction2 = 1 if @shake2 < - @shake_power2 * 2      @shake_duration2 -= 1    end  endend
     
    Last edited by a moderator: Sep 26, 2014
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,816
    Likes Received:
    11,523
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I don't have my game with me nio, but if nobody else replies before I get home, I'll take a screenshot of the event and will post it here. It's a really simple one, just a few lines. To be honest, I can't even remember if it has a loop or if it just uses the default looping of the parallel process.
     
    #5
  6. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,600
    Likes Received:
    2,358
    Location:
    Canada / Quebec
    First Language:
    French
     this is also allow me to have a unlimited time to shake :3?...hu wait...when I think just have to put a numerous number of time in it and this is should work :3! 

    thanks don't worry :3!! 

    if no one answer for help me don't hesit to send me the solution in Pm :3! 
     
    #6
  7. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    That script already included wait fix so no worries :)
     
    #7
  8. nio kasgami

    nio kasgami VampCat Veteran

    Messages:
    8,600
    Likes Received:
    2,358
    Location:
    Canada / Quebec
    First Language:
    French
    okai so if I understand if I put 0 this will not stop playing right?
     
    #8
  9. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,636
    Likes Received:
    14,384
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    uh, put a long wait time.
     
    #9
  10. ZirconStorms

    ZirconStorms VX & VX Ace Scripts Veteran

    Messages:
    332
    Likes Received:
    108
    First Language:
    English
    Primarily Uses:
    RMVXA
    sorry for necro. Fixed Archeia's code snippet above

    Code:
    #vertical_shake(power, speed, duration, wait)
    #vertical_shake and horizontal_shake
    #Code by Archeia and Neon Black.
    
    class Game_Interpreter 
      def vertical_shake(power, speed, duration, pause = false)   
        screen.start_shake_vert(power, speed, duration)   
        wait(duration) if pause
      end 
      def horizontal_shake(power, speed, duration, pause = false) 
        screen.start_shake(power, speed, duration)
        wait(duration) if pause
      end
      def command_225   
        screen.start_shake(@params[0], @params[1], @params[2])   
        wait(@params[2]) if @params[3]
      end
    end
    class Spriteset_Map 
      alias aliased_update_viewports update_viewports
      def update_viewports   
        @viewport1.oy = $game_map.screen.shake2
        aliased_update_viewports 
      end
    end
    class Game_Screen
      attr_reader :shake2   
      alias aliased_clear_shake clear_shake
      def clear_shake   
        aliased_clear_shake
        @shake_power2 = 0   
        @shake_speed2 = 0   
        @shake_duration2 = 0   
        @shake_direction2 = 1   
        @shake2 = 0 
      end
      def start_shake_vert(power, speed, duration)
        @shake_power2 = power 
        @shake_speed2 = speed   
        @shake_duration2 = duration
      end   
      alias aliased_update_shake update_shake
      def update_shake   
        aliased_update_shake
        if @shake_duration2 > 0 || @shake2 != 0   
          delta = (@shake_power2 * @shake_speed2 * @shake_direction2) / 10.0 
          if @shake_duration2 <= 1 && @shake2 * (@shake2 + delta) < 0   
            @shake2 = 0   
          else       
            @shake2 += delta   
          end     
          @shake_direction2 = -1 if @shake2 > @shake_power2 * 2     
          @shake_direction2 = 1 if @shake2 < - @shake_power2 * 2   
          @shake_duration2 -= 1   
        end
      end
    end
     
    #10
    Ebanyle likes this.

Share This Page