A word to an animation...?

Started by Jragyn, August 12, 2009, 09:45:02 pm

Previous topic - Next topic

Jragyn

August 12, 2009, 09:45:02 pm Last Edit: August 13, 2009, 04:00:33 pm by Aqua
I found a script that allows for specific elemental reflection, rather than full magical reflection as in blizz's script.

One thing that bothers me is that when a spell or skill is reflected...the word "Reflect" pops up.
Mind you, the word can be changed to whatever other letters I want, but...what if I want an animation instead?

Here, hopefully someone can look at this and see the error of Hima's ways:

Spoiler: ShowHide
#==============================================================================
# * Hima's Elemental Reflector v. 1.3
#------------------------------------------------------------------------------
#     This script will allow you to set your character or enemies to reflect any element
#    you want. You can also create armors or skills that create elemental reflector.
#
#    Version History
#    ---------------------------------------------------------
#    1.0    -    First Released
#    1.1    -    Fixed infinite reflect problem
#    1.2    -    More features added
#                a.) You can now choose to reflect any physical or magical skill.
#                b.) Physical reflect will also reflect any basic attack.
#                c.) Basic attack with element will also be reflected from elemental reflector.
#    1.3    -    Fixed some bugs that occur when you don't put all the ELEMENTS you defined into the database.
# ---------------------------------------------------------
# contact : ninomiya_mako@hotmail.com
#==============================================================================
module HIMA_REFLECT
   #--------------------------------------------------------------------------
 # - Customize Point -
   # ELEMENTS     - This is where you create the name of element you want to reflect. This is how it works
   #           {Name => Reflected Element ID, Name => Reflected Element ID, ...}
   #           The name can be anything, and ID is ID of the element that this will reflect. You have to
   #           create a new element that match what you input here.
   #           Special Element ID are as follows :
   #
   #    "Physical" -> For any physical skill, with atk_f greater than 0, attacks
   #    "Magic"    -> For any magic skill, with int_f (mind_f) greater than 0
   #
   #    WORD             - Message that will pop up when reflection occurs.
 #--------------------------------------------------------------------------
   ELEMENTS = {"Reflect Physical" => "Physical",
               "Reflect Heat" => 2,
               "Reflect Cold" => 3,
               "Reflect Thunder" => 4,
               "Reflect Ground" => 5,
               "Reflect Air" => 6,
               "Reflect Energy" => 7,
               "Reflect Void" => 8,
               "Reflect Magic" => "Magic"}
   WORD = "Reflect"
end

module RPG
   class Skill
       def type_of_skill
           if @int_f > 0
               return "Magic"
           elsif @atk_f > 0
               return "Physical"
           else
               return nil
           end
       end
   end
end

class Game_Battler
 attr_accessor :reflect                   # Reflect Flag
   alias hima_reflect_init initialize
   def initialize
       @reflect = 0    #0 = no reflect, 1 = basic_attack, 2 = skill_effect
   hima_reflect_init
   end
   
   alias hima_reflect_attack_effect attack_effect
   def attack_effect(attacker)
       # Check for reflect basic attack
       element_to_reflect = HIMA_REFLECT::ELEMENTS.index("Physical")
       reflect_id = $data_system.elements.index(element_to_reflect)
       if reflect_id != nil
           if self.element_reflect(reflect_id) == 1
               if attacker.element_reflect(reflect_id) == 1
                   self.damage = "BLOCK"
                   self.reflect = 0
                 else
                   self.damage = HIMA_REFLECT::WORD
                   self.reflect = 1
               end
               return false
           end
       end
       # End of reflect basic attack
       
       # Check for reflect element of basic attack
       for q in 0...attacker.element_set.size
           element_id = attacker.element_set[q]
           element_to_reflect = HIMA_REFLECT::ELEMENTS.index(element_id)
           if element_to_reflect != nil
               reflect_id = $data_system.elements.index(element_to_reflect)
               if self.element_reflect(reflect_id) == 1
         if attacker.element_reflect(reflect_id) == 1
             self.damage = "Block"
             self.reflect = 0
         else
             self.damage = HIMA_REFLECT::WORD
             self.reflect = 1
         end
         return false
               end
           end
       end #end for        
       # End of reflect element of basic attack
       hima_reflect_attack_effect(attacker)
   end
   
   alias hima_reflect_skill_effect skill_effect
 def skill_effect(user, skill)
       # Reflect physical or magic skill
       if skill.type_of_skill != nil
           element_id = skill.type_of_skill
           element_to_reflect = HIMA_REFLECT::ELEMENTS.index(element_id)
           if element_to_reflect != nil
               reflect_id = $data_system.elements.index(element_to_reflect)
               if reflect_id != nil
                   if self.element_reflect(reflect_id) == 1
                       if user.element_reflect(reflect_id) == 1
                               self.damage = "Block"
                               self.reflect = 0
                       else
                               self.damage = HIMA_REFLECT::WORD
                               self.reflect = 2
                       end
                       return false
                   end
               end
           end
       end
       
       # Reflect specific element
       for q in 0...skill.element_set.size
           element_id = skill.element_set[q]
           element_to_reflect = HIMA_REFLECT::ELEMENTS.index(element_id)
           if element_to_reflect != nil
               reflect_id = $data_system.elements.index(element_to_reflect)
               if reflect_id != nil
                   if self.element_reflect(reflect_id) == 1
                       if user.element_reflect(reflect_id) == 1
                               self.damage = "Block"
                               self.reflect = 0
                       else
                               self.damage = HIMA_REFLECT::WORD
                               self.reflect = 2
                       end
                       return false
                   end
               end
           end
       end #end for
       hima_reflect_skill_effect(user,skill)
 end
   
   def element_reflect(element_id)
       if self.is_a?(Game_Actor)
       result = $data_classes[self.class_id].element_ranks[element_id]

           for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
               armor = $data_armors[i]
               if armor != nil and armor.guard_element_set.include?(element_id)
                   result = 1
               end
           end
   
           for i in @states
               if $data_states[i].guard_element_set.include?(element_id)
                   result = 1
               end
           end
       else
           result = $data_enemies[self.enemy_id].element_ranks[element_id]
           for i in @states
               if $data_states[i].guard_element_set.include?(element_id)
                   result = 1
               end
           end
       end
   # Method end
   return result
 end
end

class Game_Enemy < Game_Battler
   attr_accessor        :enemy_id
end

class Scene_Battle
   alias hima_update_phase4_step5 update_phase4_step5
 def update_phase4_step5
       hima_update_phase4_step5
   reflect = 0
       for target in @target_battlers
         if target.reflect != 0
               reflect = target.reflect
               target.reflect = 0
     end
   end
       if reflect > 0
     @target_battlers = []
           @target_battlers.push(@active_battler)
           case reflect
               when 1
                   @active_battler.attack_effect(@active_battler)
               when 2
                   @active_battler.skill_effect(@active_battler,@skill)
           end #case
           @phase4_step = 4
       else
     @phase4_step = 6
   end
 end
end


Very useful script, almost emulates the Shin Megami style of battles what with their strengths and weaknesses...but the word reflect, in my opinion, should be replaced with at least a picture.
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Blizzard

Why don't you simply use the Full Reflection script and exclude all skill IDs of skills without elements by adding them to the BREAK_REFLECT array? That way all skills without elements won't be reflected.

And if you want the word "Reflect" to pop up in my script, just make an animation with the word "Reflect".
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.

Jragyn

I choose the Hima reflect over the full reflect because I am trying to mimic the strategy aspect of reflecting specific elements...

ie:
with this script, you can make a monster reflect only the thunder and holy element, but take damage or whaetevr to all the other elements...
while from what I've managed so far, full reflect...reflects magic, with the exception of the reflect breaker spells.


Perhaps I made it a bit hazy, but I -don't- want the word 'Reflect' to pop up in this script.
I'd like it to pop an animation instead.

Oh, and thank you Blizzard. You for the most part always have answers to my questions, and I appreciate the assistance you provide :)

A bright light can either illuminate or blind, but how will you know which until you open your eyes?