Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: ThallionDarkshine on November 02, 2012, 08:58:49 pm

Title: [XP] Battler Transitions
Post by: ThallionDarkshine on November 02, 2012, 08:58:49 pm
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




Screenshots
Spoiler: ShowHide
(http://i1202.photobucket.com/albums/bb363/ThallionDarkshine/Transitions1.png)
(http://i1202.photobucket.com/albums/bb363/ThallionDarkshine/Transitions2.png)
(http://i1202.photobucket.com/albums/bb363/ThallionDarkshine/Transitions3.png)
(http://i1202.photobucket.com/albums/bb363/ThallionDarkshine/Transitions4.png)



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




Author's Notes

You'll need my transitions module (http://pastebin.com/raw.php?i=P6YDaVzU) for this script to work (that's the script that actual makes the cool transitions).
Also, you'll need this  (https://www.box.com/s/ykkt0r1bsfz84p6khvq5) dll for the script.
Title: Re: [XP] Battler Transitions
Post by: G_G on November 02, 2012, 10:46:32 pm
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.
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on November 03, 2012, 08:04:01 am
Alright, I fixed it. The dll is in the author's notes.
Here (https://www.box.com/s/ykkt0r1bsfz84p6khvq5) is the link.
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on November 17, 2012, 02:37:56 pm
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.
Title: Re: [XP] Battler Transitions
Post by: Blizzard on November 17, 2012, 02:44:33 pm
Quote from: ThallionDarkshine on November 17, 2012, 02:37:56 pm
The script is finally done:


Yet the version stays 0.1? xD
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on February 01, 2013, 08:10:15 pm
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.
Title: Re: [XP] Battler Transitions
Post by: d0m0a on February 27, 2013, 12:14:58 pm
sorry for ask, but... where I put the Rgss_addon?
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on February 27, 2013, 01:27:50 pm
Put it in the same folder as Game.exe.
Title: Re: [XP] Battler Transitions
Post by: d0m0a on February 27, 2013, 01:40:46 pm
and what I made with this error?

Script'transitions module' line 660: RuntimeError ocurred.

LoadLibrary: rgss_addon
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on February 28, 2013, 01:25:46 pm
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.
Title: Re: [XP] Battler Transitions
Post by: Wecoc on March 04, 2013, 04:03:06 am
Why don't you use Caesar's Graphics Toolkit? It seems to do more or less the same, without dll.
Title: Re: [XP] Battler Transitions
Post by: ThallionDarkshine on March 05, 2013, 01:37:35 pm
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.