The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: LiLTreLL1217 on December 01, 2006, 07:26:25 PM

Title: Reflection
Post by: LiLTreLL1217 on December 01, 2006, 07:26:25 PM
i search after i tried for hours and failed with events and switches. so can somebody please show me how to make it so when somebody attacks you its reflects their attack @ them.
i made it so when u have the "Reflection" status effect, somebody's attack will be reflected back to them but i cant make the attack reflect back @ them. i tried forced action and a lot more stuff. please help.
Title: Re: Reflection
Post by: Arrow on December 01, 2006, 07:29:57 PM
Which version of the program are you using? If you are using XP, then Blizzard has made a script that should suit your needs perfectly.
Title: Re: Reflection
Post by: LiLTreLL1217 on December 01, 2006, 08:51:29 PM
Quote from: arrowone on December 01, 2006, 07:29:57 PM
Which version of the program are you using? If you are using XP, then Blizzard has made a script that should suit your needs perfectly.

yes i am using xp and what should i search? and thank u in advance in case i find it before u post.  ;D
Title: Re: Reflection
Post by: Arrow on December 01, 2006, 09:06:01 PM
Well, Blizzard made it, so it should be in that topic that...I think BOE made...I'll go check it out. Edit when found.

EDIT: The link in the topic died, but I know it's still around here somewhere. Look for this:

Full Reflection System v1.0b  Blizzard
Title: Re: Reflection
Post by: LiLTreLL1217 on December 02, 2006, 03:41:49 AM
Quote from: arrowone on December 01, 2006, 09:06:01 PM
Well, Blizzard made it, so it should be in that topic that...I think BOE made...I'll go check it out. Edit when found.

EDIT: The link in the topic died, but I know it's still around here somewhere. Look for this:

Full Reflection System v1.0b  Blizzard
i searched and all it found was this thread we're typing in right now. :(
Title: Re: Reflection
Post by: Arrow on December 02, 2006, 05:26:30 AM
And that is bizzarre. I'll find the topic in the morning.
Title: Re: Reflection
Post by: Blizzard on December 02, 2006, 01:22:32 PM
You can always use the search button if you can't find something. If you're looking for script, it's always a good idea to check out the Scripts Database first.

http://rmrk.net/index.php/topic,7197.0.html
Title: Re: Reflection
Post by: LiLTreLL1217 on December 05, 2006, 01:44:56 AM
ok i loaded in the script but i get this error what i did was i change verything that said "_ID" to "_17" for te status effect ID. and i get this 1 error everytime so heres the script and come somebody configure it for me.

NOTE: The IDs are there. before the script


#==============================================================================
# Full Reflection System by Blizzard
# Version: 1.0b
# Date: 5.9.2006
#
#
# Compatiblity:
#
# Is compatible with nearly everything. You might experience problems with
# exotic CBS-es
#
#
# Configuration:
#
# Make a status effect and call it "Reflect". Remember the ID number. Now make
# an animation that should be displayed when reflecting magic.
#
# REFLECT_ID - the ID of the reflect status
# REFLECT_ANIMATION - the ID of animation displayed when magic is being
#                     reflected
#
# Note:
# A magical skill is considered a skill that has a ATK-F equal to zero and
# either INT-F greater than zero or MDEF-F greater than zero. Create
# unreflectable skills by just setting ATK-F greater than zero.
#
# Important note:
# It is better if you don“t use sounds and screen/target flashing in the
# animation for the reflecting effect.
#
#==============================================================================

REFLECT_ID = 17
REFLECT_ANIMATION = 101

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
  attr_accessor :reflect_flag
 
  alias init_reflect_later initialize
  def initialize
    init_reflect_later
    @reflect_flag = false
  end
 
  alias skill_effect_reflect_later skill_effect
  def skill_effect(user, skill)
    @reflect_flag = false if not self.states.include?(REFLECT_ID)
    if not self.test_reflection(skill)
      return self.skill_effect_reflect_later(user, skill)
    end
  end
 
  def test_reflection(skill)
    if self.states.include?(REFLECT_17) and @reflect_flag
      return true if (skill.int_f > 0 or skill.mdef_f > 0) and skill.atk_f == 0
    end
    return false
  end
   
end

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle

  def update_phase4_step4
    for i in 0...@target_battlers.size
      if @skill != nil and @target_battlers[i].test_reflection(@skill)
        @target_battlers[i].animation_id = REFLECT_ANIMATION
        @target_battlers[i] = swap_targets(@target_battlers[i], @active_battler)
        target = @target_battlers[i]
        dam = 0
        dam = target.damage if target.damage.is_a?(Numeric)
        target.skill_effect(@active_battler, @skill)
        target.damage += dam if target.damage.is_a?(Numeric)
      end
      @target_battlers[i].animation_id = @animation2_id
      @target_battlers[i].animation_hit = (@target_battlers[i].damage != "Miss")
    end
    for actor in $game_party.actors
      actor.reflect_flag = true if actor.states.include?(REFLECT_ID)
    end
    for enemy in $game_troop.enemies
      enemy.reflect_flag = true if enemy.states.include?(REFLECT_ID)
    end
    @wait_count = 6
    @phase4_step = 5
  end
 
  def swap_targets(battler1, battler2)
    if battler1.is_a?(Game_Enemy) and battler2.is_a?(Game_Enemy)
      actors = []
      for actor in $game_party.actors
        actors.push(actor) if actor.exist?
      end
      battler3 = actors[rand(actors.size)]
    elsif battler1.is_a?(Game_Actor) and battler2.is_a?(Game_Actor)
      enemies = []
      for enemy in $game_troop.enemies
        enemies.push(enemy) if enemy.exist?
      end
      battler3 = enemies[rand(enemies.size)]
    else
      battler3 = battler2
    end
    return battler3
  end
 
  alias battle_end_reflect_later battle_end
  def battle_end(result)
    for actor in $game_party.actors
      actor.reflect_flag = false
    end
    battle_end_reflect_later(result)
  end
 
end
Title: Re: Reflection
Post by: Falcon on December 05, 2006, 08:11:51 AM
What error do you get?
Title: Re: Reflection
Post by: Blizzard on December 05, 2006, 01:52:02 PM
Lol change the number, not the name of the constant:

REFLECT_ID = 17

Change it to:

REFLECT_ID = 18

or

REFLECT_ID = 19

or...

As I said, the number has to be changed.
Title: Re: Reflection
Post by: LiLTreLL1217 on December 05, 2006, 10:21:05 PM
Quote from: Blizzard on December 05, 2006, 01:52:02 PM
Lol change the number, not the name of the constant:

REFLECT_ID = 17

Change it to:

REFLECT_ID = 18

or

REFLECT_ID = 19

or...

As I said, the number has to be changed.

u mean change the number to 18 or 19 and put it in "REFLECT_ID" TO "REFLECT_18 or w/e number"
or do you mean where i put the numbers at before the script?
because i changed all the "_ID" to "_18" and it still doesnt work.
Title: Re: Reflection
Post by: Blizzard on December 06, 2006, 12:35:21 PM
No, don't touch REFLECT_ID, just change the number.