[XP] Battler Transitions

Started by ThallionDarkshine, November 02, 2012, 08:58:49 pm

Previous topic - Next topic

ThallionDarkshine

November 02, 2012, 08:58:49 pm Last Edit: June 14, 2015, 05:18:23 pm by ThallionDarkshine
Battler Transitions
Authors: ThallionDarkshine
Version: 2.1
Type: Graphical Battle Add-on
Key Term: Battle Add-on



Introduction

I just finished playing through Blizz's game "Chaos Project", and I saw a ton of cool scripted addons he made for it. Well now, you can use one of the best features of his game in yours. This script allows you to insert exit transitions for the enemies, such as slicing apart, simply fading out, 3d spin, and many more. And thus begins my quest to replicate every amazing feature of CP.

In this new version, I'm proud to announce that the default transition graphics can be used to transition sprites out. I've also separated out the transitions module that was originally included in this script so I can more easily work on the module script. This is not a new dependency for this script, it's just something that was originally included and is now a separate script.



Features


  • Many amazing transitions for enemies.

  • Can use the default transition graphics to transition out enemies.




Screenshots
Spoiler: ShowHide






Demo

None yet.


Script

Spoiler: ShowHide

#===================================================================
#
#           BATTLER TRANSITIONS
#           Author - ThallionDarkshine
#           Version - 2.1
#
#===================================================================

module Battler_Trans
 # Example Animations
 #   parameters: (animation_type, animation_duration, animation_parameters, ease)
 #            or (animation_type, animation_duration, ease)
 #   note - the script no longer uses this set of animations, it is just in the script
 #     to show the different effects
 @trans = [
   # Slicing Animations (Animation #0)
   #   parameters: (amount_movement)
   [0, 40],
   [0, 20],
   [0, 20, [0.6]],
   # Fading Animations (Animation #1)
   #   parameters: none
   [1, 20],
   [1, 30],
   # Zooming Animations (Animation #2)
   #   parameters: (x_zoom, y_zoom) or (zoom)
   [2, 30],
   [2, 20, [1.2]],
   [2, 30, [1, 0]],
   [2, 30, [0, 1]],
   [2, 30, [1.8, 0.2]],
   [2, 30, [0.2, 1.8]],
   [2, 30, [0.2]],
   # Zooming and Spinning Animations (Animation #3)
   #   parameters: (x_zoom, y_zoom, spin_degrees) or (zoom, spin_degrees)
   [3, 20],
   [3, 40, [1.8, 0.2, 720]],
   [3, 40, [0.2, 810]],
   [3, 40, [0.2, 1.8, 720]],
   # 3D Spin Animations (Animation #4)
   #   parameters: (zoom, num_rotations)
   [4, 40],
   [4, 40, [0, 4]],
   [4, 40, [0.5, 6]],
   [4, 30, [0.7, 2]],
   # Slide-In Animations (Animation #5)
   #   parameters: (slide_direction)
   [5, 24],
   [5, 24, [-1]],
   # Fold Animations (Animation #6)
   #   parameters: none
   [6, 30],
   # Shaking Animations (Animation #7)
   #   parameters: (x_strength, x_speed, y_strength, y_speed) or (x_intensity, y_intensity)
   [7, 40],
   [7, 40, [6..9, 4..7]],
   # Ripple/Distort Animations (Animation #8)
   #   parameters: (x_amplitude, x_wavelength, num_x_ripples, y_amplitude, y_wavelength, num_y_ripples) or (x_amount, num_x_ripples, y_amount, num_y_ripples)
   [8, 40],
   [8, 40, [40, 10, 0.5, 10, 10, 2]],
   [8, 40, [10, 10, 2, 40, 10, 0.5]],
   [8, 40, [10, 40, 2, 10, 10, 2]],
   [8, 40, [10, 10, 2, 10, 40, 2]],
   [8, 40, [10, 10, 3, 10, 10, 2]],
   [8, 40, [10, 10, 2, 10, 10, 3]],
   [8, 10, [10, 40, 0.5, 10, 10, 0.5]],
   [8, 10, [10, 10, 0.5, 10, 40, 0.5]],
   # Dissolve to Sprite Animations (Animation #9)
   #   parameters: (fade_duration)
   #            or (fade_duration, x_size, y_size, negative?, tint_amount,
   #                tint_red, tint_green, tint_blue)
   #            or (fade_duration, x_size, y_size, negative?, tint_amount,
   #                tint_red, tint_green, tint_blue, grayscale_amount)
   #   note - use a float for x_size or y_size to specify it as a fraction
   #     example - 1.0 for the width of the sprite, 0.5 for half the width, and so on
   [9, 40],
   [9, 40, [10, 1.0, 1, false, 50, 200, 50, 50]],
   [9, 40, [10, 5, 5, true, 50, 100, 200, 200]],
   [9, 40, [10, 1, 1.0, false, 0, 0, 0, 0, 100]],
   # Dissolve Animations (Animation #10)
   [10, 40],
   [10, 40, [1, 1.0]],
   [10, 40, [5, 5]],
   [10, 20, [10, 10]],
   # Transition Graphic Animations (Animation #11)
   #   parameters: (transition_graphic_name, fade_duration)
   #     fade_duration - how long it takes for each individual pixel of the
   #       sprite to fade out
   [11, 100],
   [11, 40, ['001-Blind01', 5]],
 ]
 
 # Setup for Enemy-Specific Transitions
 #     Delete the line that reads "when 0 then return @trans".
 #     Add this code for every enemy you want to have a specific set of
 #       transitions:
 #        when ENEMY_ID then return [
 #            TRANSITION_1,
 #            TRANSITION_2,
 #            TRANSITION_3,
 #            etc...
 #          ]
 # where ENEMY_ID is the id of the enemy whose transitions you are setting,
 #   and TRANSITION_1, 2, and so on are the possible transitions you want it
 #   to use
 def self.transitions(enemy_id)
   case enemy_id
   when 0 then return @trans
   else return @trans
   end
 end
 
 def self.trans=(val)
   @trans = val
 end
 
 def self.trans
   @trans
 end
end

unless Object.const_defined?(:Transitions)
 raise 'This script requires ThallionDarkshine\'s Transitions Module'
end

class Sprite_Battler
 attr_accessor :pos
 
 alias tdks_transitions_collapse collapse
 def collapse
   trans = Battler_Trans.transitions(@battler.id)
   if trans.length > 0
     rnd = rand(trans.length)
     rnd = trans[rnd].map { |i| (i.is_a?(Array) ? i.clone : i) }
     Transitions.transition_out(self, *rnd)
     @pos = [self.x, self.y]
   else
     tdks_transitions_collapse
   end
 end
 
 alias tdks_transitions_update update
 def update
   tdks_transitions_update
   if defined?(@pos)
     self.x, self.y = *@pos
   end
 end
end



Instructions

See script for instructions.


Compatibility

I don't think there would be any compatibility problems, but you might have some with some 3d battle camera like the one in CP.


Credits and Thanks


  • ThallionDarkshine

  • Blizzard, for giving me the idea and making the script this is based off of.




Author's Notes

You'll need my transitions module for this script to work (that's the script that actual makes the cool transitions).
Also, you'll need this dll for the script.

G_G

Next time, spoiler your screenshots please.

And you do realize that no one can use this script right? The script calls for "rgss_addon" dll and in nowhere do you mention a link to this dll or requirements for another script. Or anything of the sort. Other than that, neat idea. I hope to see more.

ThallionDarkshine

Alright, I fixed it. The dll is in the author's notes.
Here is the link.

ThallionDarkshine

The script is finally done: I made it possible to have different sets of transitions for different enemies, but if you haven't configured any enemy, the script will use the original method of randomly choosing one of the big array of transitions.

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ThallionDarkshine

February 01, 2013, 08:10:15 pm #5 Last Edit: February 17, 2013, 11:56:19 am by ThallionDarkshine
Mega update! In v2.0, you can transition enemies out using transition graphics. I've also separated out the transitions module that was originally included in this script so I can more easily work on the module script. This is not a new dependency for this script, it's just something that was originally included and is now a separate script. Also, a new parameter has been added for transitions: ease. You can set it to a negative for ease-in, or a positive for ease-out. Or maybe the other way round. Just try it and you'll find out.

Edit - And update to v2.1. The battle will now wait until the transition finishes to resume the battle. Also, this script is now compatible with my 3d battle camera script.

d0m0a

sorry for ask, but... where I put the Rgss_addon?

ThallionDarkshine

Put it in the same folder as Game.exe.

d0m0a

and what I made with this error?

Script'transitions module' line 660: RuntimeError ocurred.

LoadLibrary: rgss_addon

ThallionDarkshine

February 28, 2013, 01:25:46 pm #9 Last Edit: February 28, 2013, 01:46:18 pm by ThallionDarkshine
I updated the transitions module. Try it now.

And if it still doesn't work, then you'll probably be best off telling enterbrain about it, because several other people have had the same problem.

Wecoc

Why don't you use Caesar's Graphics Toolkit? It seems to do more or less the same, without dll.

ThallionDarkshine

March 05, 2013, 01:37:35 pm #11 Last Edit: April 25, 2013, 08:14:16 pm by ThallionDarkshine
The thing is, the reason I use a dll is that it's much too slow to execute these functions every frame if they're written in pure ruby like Caesars Graphics Toolkit.

Edit - For example, a negative effect on the title graphic takes 4.75 seconds. My dll can execute 100 negative effects in that time.

Grayscale Effect - 5.7 seconds
Pixelize Effect - 9.5 seconds
Blur Effect - More than 10 seconds (script is hanging error)
Shake Effect - 0.02 seconds
Change Brightness - 3.1 seconds
Change Contrast - 4.1 seconds
Threshold - 5.4 seconds
Emboss - 9.7 seconds
Swap Colors - 5.5 seconds


Edit:

And everyone, I am proud to announce that I fixed the dll problem. The new version is uploaded and now users with Windows XP Professional will be able to use it properly.

Edit:

Update to v2.1. Added code to help my battler transitions script check compatibility.