Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: Heretic86 on February 18, 2014, 06:38:00 am

Title: Are there any Earthquake Scripts?
Post by: Heretic86 on February 18, 2014, 06:38:00 am
XP has a screen shake function, but I had to do some tricky eventing to pull off an Earthquake.  Just wondering if there were any scripts out there for it.  Things like Fade In Quake and Fade Out Quake...
Title: Re: Are there any Earthquake Scripts?
Post by: G_G on February 18, 2014, 09:42:31 am
http://forum.chaos-project.com/index.php/topic,105.0.html

ToA has a Screen Tremble add-on.
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 18, 2014, 06:09:02 pm
While we're at it, how about shaking the screen during an animation? I thought that was a feature in other RPG Makers. I have an idea on how to create it, but just wanted to know if someone has heard of something like this already.
Title: Re: Are there any Earthquake Scripts?
Post by: Heretic86 on February 19, 2014, 07:51:18 am
Not during an animation, but that would be interesting.  XP's Animations are quite limited...

(edit)

Here's an idea.  Screen Shake might need to come from a script call in a Common Event, not the animation itself.  The skill itself would call the common event, which can run the script call.  Unfortunately it also means that just running the animation wouldnt cause a Screen Shake to run.  Probably still simpler to do it this way than trying to tie it to Animation ID's in the script itself, probably...
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 20, 2014, 02:48:38 am
I was thinking more along the lines of manipulating the Screen Flash function. Set the opacity to 0 and the script now reads it as a Shake Screen command. Red sets the power, Green sets the speed. Set the duration and what frame you want it to pop up on and *boom*.

Also was thinking of ways to move the enemy battler around in much the same way. Take a skill like Piledriver, which sends the enemy up off screen and then crashing back down.
Title: Re: Are there any Earthquake Scripts?
Post by: G_G on February 20, 2014, 08:39:03 am
That'd be pretty cool KK20. And it could universally effect the screen or the battler sprites.
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 20, 2014, 06:00:22 pm
I guess I could whip something up in my spare time. I kinda need a script like this anyways. I should also consider making an "application" to create the animation effects easier (probably would get confusing reading flash colors as directions. Plus, you can't really test the animation unless you playtest after every change.)

Glad you think it's a cool idea :)
Title: Re: Are there any Earthquake Scripts?
Post by: ForeverZer0 on February 20, 2014, 06:39:28 pm
Could you not just create an alias method to add a shake to "animation" in RPG::Sprite, with a configuration to determine which animations use screen shake, how long, strength, etc.?
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 20, 2014, 07:03:54 pm
I guess you could, but I would like to be able to change the level of shaking throughout the animation. So if the configuration was something like
[ [frame, power, speed, duration], ...]
it could work that way I think. I'm just not sure if users would prefer that way or not.
Title: Re: Are there any Earthquake Scripts?
Post by: ForeverZer0 on February 20, 2014, 07:45:22 pm
It seems to me that it would offer even more flexibility using your own method than using a screen color change. The whole script could literally be two methods, one alias, and another for configuration.
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 21, 2014, 01:14:52 am
Or keep the screen flash and the script would just be one aliased method :P (if you wanna talk numbers)
Poll, anyone? What would you guys prefer?
Title: Re: Are there any Earthquake Scripts?
Post by: Zexion on February 21, 2014, 01:21:39 am
I think KK20's because it works from the editor with sliders?
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 21, 2014, 01:27:06 am
The basic idea is this:

class RPG::Sprite
   def animation_process_timing(timing, hit)
     if (timing.condition == 0) or
        (timing.condition == 1 and hit == true) or
        (timing.condition == 2 and hit == false)
       if timing.se.name != ""
         se = timing.se
         Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
       end
       case timing.flash_scope
       when 1
         self.flash(timing.flash_color, timing.flash_duration * 2)
       when 2
#=================================================================
         if self.viewport != nil
            if timing.flash_color.alpha != 0
              self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
            else
              $game_screen.start_shake(timing.flash_color.red, timing.flash_color.green, timing.flash_duration * 2)
            end
         end
#=================================================================
       when 3
         self.flash(nil, timing.flash_duration * 2)
       end
     end
   end
end

If I can make an "application" via another RPG Maker project, I can access the Animations.rxdata, translate the movement changes into Screen Flash, and save the file. Otherwise, I'd have to make a textfile output the configuration options that the user would have to copy-paste in their project. Not to mention, I don't know how I'd be able to transfer the current configurations over to this application to interpret.
Title: Re: Are there any Earthquake Scripts?
Post by: ForeverZer0 on February 21, 2014, 03:22:53 pm
Very simple script to allow adding a shake to an animation:

Spoiler: ShowHide
module AnimationEx
  #-----------------------------------------------------------------------------
  # * Define screen shakes that will be used during specific animations
  #     animation_id : ID of the animation
  #-----------------------------------------------------------------------------
  def self.shake(animation_id)
    return case animation_id
    # when ANIMATION_ID then [POWER, SPEED, DURATION]
    when 1 then [5, 5, 5]
    when 2 then [10, 10, 10]
    when 3 then [2, 8, 30]
    when 4 then [8, 3, 15]
    when 5 then [10, 2, 40]
    end
  end
end

class RPG::Sprite
 
  alias animation_ex animation
  def animation(animation, hit)
    # Get user-defined data based on the animation being used
    shake = AnimationEx.shake(animation.id)
    # Start screen shake if defined
    if shake != nil
      $game_screen.start_shake(*shake)
    end
    # Execute normal animation
    animation_ex(animation, hit)
  end
end
Title: Re: Are there any Earthquake Scripts?
Post by: G_G on February 22, 2014, 11:36:39 am
I don't think you understand what he's trying to accomplish here. He wants to give users more control than that.

I know that he would like the screen to shake at specific frames, not just at the start of the animation and I know he'd also like to allow the shaking to be applied to battler sprites. I think using the slider tools to allow shakes would be cool. Because that window also lets you choose the target. So you can choose the target or the screen and have the shake happen at a certain frame. And allow to only happen if the target has been hit for example, etc..
Title: Re: Are there any Earthquake Scripts?
Post by: ForeverZer0 on February 22, 2014, 12:11:23 pm
I understand the idea, I was merely showing the idea. A slightly more complicated edit can be done to the actual animation method for timing, and "hit" is passed to the method, so only shaking on hit is a simple check.

As for battler sprites, they are inherit from RPG::Sprite, so that wouldn't affect anything.
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 23, 2014, 02:18:59 pm
Quote from: ForeverZer0 on February 22, 2014, 12:11:23 pm
As for battler sprites, they are inherit from RPG::Sprite, so that wouldn't affect anything.

Not sure what you mean.

Anyways, I'll continue with the slider method and see what I can come up with.
Title: Re: Are there any Earthquake Scripts?
Post by: Heretic86 on February 24, 2014, 04:36:51 am
I was just looking for something for a full screen shake, but battler sprite shaking is an interesting concept.  Just a quake_fade_in, then maintain that shake until quake_fade_out or quake_stop.
Title: Re: Are there any Earthquake Scripts?
Post by: KK20 on February 26, 2014, 01:01:31 am
While thinking about it, Animations could be so much more advanced than what the RMXP editor allows. I've drawn some pictures of what this RMXP application could do. Not only will I include the shake and movement of the enemy sprite, but I can also allow more than 16 sprites, hit/miss conditions to various things, layers (because trying to click sprite #1 is a pain in the ass when everything is on top of it), more than 200 frames, etc.

I'm much too busy at the moment to work on it though. Maybe a summer thing?