RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[MISSING] Soul Rage System + Soul Limit System v4.4b

0 Members and 1 Guest are viewing this topic.

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
That's cool, thanks. ;D
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Updated the code. You can now either disable Soul Rage or Soul Limit or just use both. :)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
I just looked at the code. It's nice, man, very awesome!
Project: Assult

Developed by: Phoenix studios.

Release Date: 2008 [Scheduled]

Game Engine: Irrlicht Engine (Graphics Engine) (Gameplay Engine unconfirmed)

**
Rep: +0/-0Level 89
Quote
# $game_actors[X].sr = Y
#
# - X is the ID of the hero in the database
# - Y is the new value of the SR

I have a soul limit that increases the SR of party members.  It sets their SR to the value of Y.  Is there a way to make it ADD the value of Y to their existing SR?

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Either

Code: [Select]
$game_actors[X].sr = $game_actors[X].sr + Y

or

Code: [Select]
$game_actors[X].sr += Y
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

**
Rep: +0/-0Level 89
The second one worked.  I actually fiddled around with similar statements, thinking that adding a + or replacing the = with a + might work, but I put the + after the = and not before it.

Progress is starting to come along nicely now thanks to your scripts.  I'd gotten bored with gamemaking for a while and this has got me all inspired and stuff.

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Nice to hear that. ;D Then keep up working on your game. :)
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*****
Rep:
Level 89
I'm back again. Again.
This is a wicked script. It works fine and I understand it(finally), so I can make some pretty good moves.

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
I came to say if there's a way to fix a sorta problem, The Bar for Soul-Rage/Limit doesn't appear when I have the bars from the Ad-Ons. Sorta thought to say that if theres a way to fix it. =]

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Delete the code for the bars from the SR script. It goes from

Code: [Select]
if BAR_STYLES

to the double end:

Code: [Select]
end
end

Thing is that this code is still version 3.0 while the one in the add-ons is 4.0.
Removing this part should make it work.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
Done. but I get the "Sintax Error" whenever I start the game <sigh>

So I left the Bar's style in Flase, where The "Menu" Glitch/bug is fixed I still don't get the Soul-Charge/Limit/Rage Bar. <sigh>

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
You need to remove the code including the line I posted and both ends. Are you sure, you have removed all of them? Also have you tried to set the constant BAR_STLYES to false?
« Last Edit: December 18, 2006, 05:00:04 PM by Blizzard »
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
You need to remove the code including the line I posted and both ends. Are you sure, you have removed all of them? Also have you tried to set the constant BAR_STLYES to false?
Bar Styles set to false, and removed the codes, all of it...Yet no bars. =/ <sigh>

***
Rep:
Level 88
I AM THAT IS.
Um...I am wondering how to add normal skills with weapons. Yes, I have followed that code and I know that there is a problem with the SP precentage thing. I was wondering, have you fixed that and can you tell me how to fix it thxs.

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
What exactly is wrong? You can add skills to weapons that work like SR skills. Can you be more specific?

Bar Styles set to false, and removed the codes, all of it...Yet no bars. =/ <sigh>

I can't fix it right now, but attach your Scripts.rxdata to a post and I will fix it as soon as possible. Or some other scripter if he finds the time and mood to do it.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
I AM THAT IS.
K, totally disregard my last question, I fixed it, but I have a new one ;D. I added a skill to my weapon but when ever I use it, there is no animation or damage. Why is this?

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
When you have the Time & Mood:

Code: [Select]
#==============================================================================
# Soul Rage System + Soul Limit System by Blizzard
# Version: 4.2b
# Date: 08.09.2006
# Date v4.2: 3.11.2006
#
#
# Compatibility:
#
# 99% chance of full compatibility with SDK, not tested altough. WILL corrupt
# your old savegames. Can cause incompatibilty issues with following scripts
# and/or systems:
# - exotic CBS-es
# - Limit Break systems
# - Custom Equipment systems (i.e. 2 accessories) (can be EASILY merged)
# - needs the 4.0b version of the Scene_SoulRage add-on if you use one
#
# Complexity:
# - average to high
#
# Special knowledge REQUIRED:
# - reading long and boring instructions
#
# Special knowledge RECOMMENED:
# - using the "Call script" event command
#
#
# Features:
#
# - configure your database easily
# - optional gradient bar drawing with 2 different styles
# - contains universal font fix, never ever "I can´t see the letters"
# - use multiple skills per equipment part
# - new Soul Limit add-on (you can configure it or not use it at all)
# - configure Soul Limit for each character
#
# v4.2:
#
# - 5 new barstyles
# - option to disable Soul Rage
#
# Advantages compared to older versions:
#
# - shorter code
# - maximized compatibilty
# - configurable gradient script
# - moving Soul Rage command in defineable color and a faster animated cursor
# - moving Soul Limit command in defineable color and a faster animated cursor
# - defineable gradient style
# - extremly simple gradient script, also possible to use it to display other
#   stats like HP, SP, EXP, etc.
# - cycle through Soul Rage skills with LEFT/RGIHT
# - Soul Limit now configurable for each character
#
#
# Instructions:
#
#
# ...::: Soul Rage :::...
#
# - Explanation:
# This script allows the player equipment to have built-in skills. If enemies
# attack a character a value (the Soul Rage or SR) will be increased. With
# a certain ammount of SR it is possible to perform special skills, that are
# implemented into equipment. Sould Rage is also known as "Ikari skill" from
# "Lufia 2 - Rise of the Sinistrals" for the SNES.
#
# - NEW in v3.0:
# Additional to ordinary SR skills, it is now possible to bound more than only
# one skill to an equipment part with overall.
#
# - NEW in v4.0:
# No $sr_element anymore. Also now there is a possibility of using a super
# skill (Soul Limit skill) if certain conditions are met. You can configure
# what conditions needs to be met for each character and what stats are going
# to be consumed
#
#
# - Configuration:
# Press CRTL+SHIFT+F and type into the window: SR DATABASE
# You can jump now to the database directly. There are more instructions.
# Also please configure the following global variable found below:
#
# ALLOW_RAGE - set this value to false to disable Rage (if you do so you
#              don´t need to configure ANYTHING connected to Soul Rage)
#              (Side-Note: It's pointless to disable both)
# SRS_rate -  set the filling rate of the SR, 1000 is standard, 500 is 2
#             times slower and 2000 would be 2 times faster
# RAGE_COLOR - set the values in the () to numbers between 0-255, also note
#              that they determine the color ammount in the color like this
#              example: (RED, GREEN, BLUE, ALPHA) - note: alpha = opacity
#
# DRAW_BAR - set this value to false if you don´t want an SR bar at all
# $bar_style - set it from 0 to 6 to use one out of seven bar styles
# $bar_opaccity - set it from 0 to 255 to define the bar's opacity
# BAR_STYLES - set this value to false to use another bar script;
#              DO NOT SET THIS VALUE TO FALSE IF DRAW_BAR IS TRUE AND YOU DON'T
#              HAVE A SEPARATE BAR SCRIPT!
#
# Additional info:
#
# If you want to change the value of the SR bar ingame use the "Call script"
# event command and use this syntax:
#
# $game_actors[X].sr = Y
#
# - X is the ID of the hero in the database
# - Y is the new value of the SR
#
# You can also use another syntax:
#
# $game_party.actors[X].sr = Y
#
# - X is the position of the hero in the party
# - Y is the new value of the SR
#
# Note that X starts from 0 and NOT 1. The ammount is shown as 100,0%, this is
# 1000 SR. i.e. 59,1% would be 591 SR.
# If you are upgrading your script from version 2.0 or lower, be sure to apply
# the new SR skill database format.
#
# Also if you want to use my gradient script, it is the class called "Bitmap"
#
#
# ...::: Soul Limit :::...
#
# Soul Limit is a special attack an actor can use if he has either low HP, high
# SR, etc. You can compare Soul Limit to a sort of Limit Break / Overdrive,
# but connected to the Soul Rage. Configure the Limit part below like in this
# template:
#
# ALLOW_LIMIT - set this value to false to disable Limit (if you do so you
#               don´t need to configure ANYTHING connected to Soul Limit)
# LIMIT_COLOR - set the values in the () to numbers between 0-255, also
#               note that they determine the color ammount in the color
#               like this example: (RED, GREEN, BLUE, ALPHA)
#               note: alpha = opacity
#
# @limit_name - the name of the command that will be displayed as Soul Limit
#               regardless of the Soul Limit skill name
# @limit_id - the Soul Limit skill ID in the normal database
# @min_sr_rate - how much SR (in %) is minimal needed for Limit to be available
#                (set to 0 to disable this condition)
# @max_hp_rate - how much HP (in %) is maximal needed for Limit to be available
#                (set to 100 to disable this condition)
# @max_sp_rat - how much SP(%) is maximal needed for Limit to be available
#                (set to 100 to disable this condition)
# @sr_consume - how much SR(%) will be consumed if Limit is used
#               (set to 0 to disable the consuming of this stat)
# @hp_consume - how much HP(%) will be consumed if Limit is used
#               (set to 0 to disable the consuming of this stat)
# @sp_consume - how much SP(%) will be consumed if Limit is used
#               (set to 0 to disable the consuming of this stat)
# @allow_suicide - set this value to false if you don´t want that a character
#                  can die when using Limit, because of decreasing the HP
#
# The database can be found by pressing CTRL+F and typing Limit Database.
#
# Additional info:
#
# Soul Limit is more superior than Limit Break as you can involve HP, SR and
# even SP conditions as well as consuming. You can create a game where a
# character can use his Limit skill as long as his HP are under 20% without
# consuming any stats. (i.e. Final Fantasy VIII) or create a game where the
# using of a Limit skill requires suicide just by setting the character´s
# @hp_consume value to 100.
# If you want to change the Soul Limit skill ID and/or command ingame use the
# "Call script" event command and use this syntax:
#
# $game_actors[X].set_new_limit("STRING", ID)
#
# - X is the ID of the hero in the database and Y the ammount
# - STRING is the new name for the SL command
# - ID is the ID of the new SL skill in the database
#
# You can also use another syntax:
#
# $game_party.actors[X].set_new_limit("STRING", ID)
#
# X is the postion of the hero in the party. Note that X starts from 0 (NOT 1)!
#
# Note:
# Using Soul Rage skills as normal skills is not recommened, because of the
# SP/SR cost. It is better you create a different skill if you want to use it
# as Soul Rage. But then again, you don´t have to... In the other hand Soul
# Limit skills can be used as normal skills without any problems.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/index.php?showtopic=54
# or send me an e-mail:
# boris_blizzard@yahoo.de
#
#==============================================================================

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Soul Rage Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

ALLOW_RAGE = true # set to false to disable Soul Rage
SRS_rate = 1000 # SR bar fill rate
RAGE_COLOR = Color.new(240, 0, 0, 255) # Color of the SR command (R, G, B, A)

DRAW_BAR = true # set to "true" if you want a bar else set it to "false"
$bar_style = 5 # SR bar drawing style (from 0 to 6)
$bar_opacity = 255 # SR bar opacity (from 0 to 255)
BAR_STYLES = false # set to "false" if you want to use another bar script

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Soul Rage Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Soul Limit Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

ALLOW_LIMIT = true # set to false to disable Soul Limit
LIMIT_COLOR = Color.new(0, 240, 0, 255) # Color of the SL command (R, G, B, A)

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Soul Limit Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_Actor
#==============================================================================

class Game_Actor < Game_Battler

  attr_reader :sr
  attr_reader :limit_name
  attr_reader :limit_id
 
  alias setup_srs_later setup   
  def setup(actor_id)
    setup_srs_later(actor_id)
    get_limits(actor_id) if ALLOW_LIMIT
    @sr = 0
  end

  def sr=(sr)
    @sr = sr
    @sr = 1000 if @sr > 1000
    @sr = 0 if @sr < 0
  end
 
  def can_use_sr?(id)
    return ($data_skills[id].sp_cost <= self.sr / 10)
  end

  if ALLOW_LIMIT
   
  def get_limits(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# START Soul Limit Database
#
# This is your Soul Limit Database. Below you can configure the Special attack
# and the command name of the Soul Limit.
# Use following syntax to setup the Soul Limit for each character:
#
#  when ACTOR_ID
#    @limit_name = "STRING"
#    @limit_id = SKILL_ID
#    @sr_rate, @hp_rate, @sp_rate = VAL1, VAL2, VAL3
#    @sr_consume, @hp_consume, @sp_consume = VAL4, VAL5, VAL6
#    @allow_suicide = EXPR
#
# ACTOR_ID - the ID of the character in the normal database
# STRING - the name the command should have
# SKILL_ID - the ID of the Soul Limit skill in the normal database
# VAL1 - minimum SR (in %) needed to make the Soul Limit skill available
# VAL2 - maximum HP (in %) needed to make the Soul Limit skill available
# VAL3 - maximum SP (in %) needed to make the Soul Limit skill available
# VAL4 - SR (in %) cunsumed if Soul Limit is used
# VAL5 - HP (in %) cunsumed if Soul Limit is used
# VAL6 - SP (in %) cunsumed if Soul Limit is used
# EXPR - true or false
#
# Example:
#
#  when 2
#    @limit_name = "Saturn Cannon"
#    @limit_id = 101
#    @sr_rate, @hp_rate, @sp_rate = 80, 50, 100
#    @sr_consume, @hp_consume, @sp_consume = -10, 10, 50
#    @allow_suicide = false
#
# (let´s say skill number 101 is called "Last Judgement")
#
# Character number 2 needs minimum 80% SR, his HP must be less than or equal to
# 50% and his SP must be less than or equal to 100% (in other words, SP don´t
# affect the availability of the SL skill of character number 2). If he uses
# the Soul Limit command displayed as "Saturn Cannon", he will use the skill
# "Last Judgement" (ID number 101). He will gain 10% of his maximum SR, lose
# 10% of his maximum HP and lose 50% of his maximum SP. If his HP are less than
# or equal to 10% he will not die, but his HP will only decrease to 1.
#
# Side-notes:
# The VAL values can be from 0 to 100 (since it is in %). Every value over 100
# is automatically limited to 100. Negative values will cause stat gaining
# instead of losing. (You can create skills, that heal the user AND attack the
# enemies without a common event call). If you set the values VAL1, VAL2 and/or
# VAL3 to a negative number, this character will have no Soul Limit.
#
# Notes:
# - you have the possibility to i.e. set a command to "Bahamut", but the actual
#   skill name that will be displayed during its animation will be "Mega Flare"
# - to change a Soul Limit skill during the game read the instructions at the
#   beginning of the script
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
    when 1
      @limit_name = "Final Judgment"
      @limit_id = 81
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = 100, 0, 0
      @allow_suicide = true
    when 2
      @limit_name = "Absolute-Zero"
      @limit_id = 82
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = 20, 100, 0
      @allow_suicide = true
    when 3
      @limit_name = "Torrential Tribute"
      @limit_id = 83
      @sr_rate, @hp_rate, @sp_rate = 80, 80, 50
      @sr_consume, @hp_consume, @sp_consume = 20, 100, 50
      @allow_suicide = false
    when 4
      @limit_name = "Unlimited Blade's Work"
      @limit_id = 84
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 80
      @sr_consume, @hp_consume, @sp_consume = 50, 0, -50
      @allow_suicide = true
    when 5
      @limit_name = "Holy Explosion"
      @limit_id = 85
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = -20, 20, -20
      @allow_suicide = true
    when 6
      @limit_name = "Terra Blaster"
      @limit_id = 86
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = 100, 0, 0
      @allow_suicide = true
    when 7
      @limit_name = "Swords of Light"
      @limit_id = 87
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = 100, 0, 0
      @allow_suicide = true
    when 8
      @limit_name = "None"
      @limit_id = 88
      @sr_rate, @hp_rate, @sp_rate = 100, 100, 100
      @sr_consume, @hp_consume, @sp_consume = 100, 0, 0
      @allow_suicide = true
     
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Soul Limit Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    else
      @limit_name = ""
      @limit_id = 1
      @sr_rate, @hp_rate, @sp_rate = -1, -1, -1
      @sr_consume, @hp_consume, @sp_consume = 0, 0, 0
      @allow_suicide = true
    end
  end

  def can_use_limit?
    return (self.sr / 10 >= @sr_rate and
        100 * self.hp / self.maxhp <= @hp_rate and
        100 * self.sp / self.maxsp <= @sp_rate)
  end
 
  def use_limit
    self.sr -= @sr_consume * 10
    self.hp -= @hp_consume * self.maxhp / 100
    self.hp = 1 if self.hp == 0 and not @allow_suicide
    self.sp -= @sp_consume * self.maxsp / 100
  end
 
  def set_new_limit(name, id)
    @limit_name = name
    @limit_id = id
  end
 
  end
 
end
 
#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
   
  alias attack_effect_srs_later attack_effect
  def attack_effect(attacker)
    last_hp = self.hp
    save = attack_effect_srs_later(attacker)
    if self.damage.is_a?(Numeric) and self.damage > 0 and
        self.is_a?(Game_Actor) and self.hp != 0
      self.sr += self.damage * SRS_rate / last_hp
    end
    self.sr = 0 if self.is_a?(Game_Actor) and self.dead?
    return save
  end 
   
  alias skill_effect_srs_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    save = skill_effect_srs_later(user, skill)
    if self.damage.is_a?(Numeric) and self.damage > 0 and
        self.is_a?(Game_Actor) and self.hp != 0
      self.sr += self.damage * SRS_rate / last_hp
    end
    self.sr = 0 if self.is_a?(Game_Actor) and self.dead?
    return save
  end

end

#==============================================================================
# Bitmap
#==============================================================================
#==============================================================================
# Window_Base
#==============================================================================

class Window_Base < Window
 
  def draw_actor_sr_no_bar(actor, x, y, width = 144)
    self.contents.font.color = normal_color
    width = 120 unless $scene.is_a?(Scene_Menu)
    sr_text = (actor.sr/10).to_s + "," + (actor.sr%10).to_s + "%"
    self.contents.draw_text(x, y, width, 32, sr_text, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y-16, width, 64, "SR", 0)
  end
 
  def draw_actor_sr(actor, x, y, w = 148)
    w -= 12
    rate = actor.sr.to_f / 1000
    color1 = Color.new(80, 0, 0, 192)
    color2 = Color.new(240, 0, 0, 192)
    color3 = Color.new(80, 0, 0, 192)
    self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
    if $scene.is_a?(Scene_Battle)
      draw_actor_sr_no_bar(actor, x, y, w)
    else
      draw_actor_sr_no_bar(actor, x, y)
    end
  end

  def draw_item_name2(item, x, y, color)
    return if item == nil
    opacity = self.contents.font.color == normal_color ? 255 : 128
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.font.color = color
    self.contents.draw_text(x + 28, y, 288, 32, item.name)
  end
 
end

#==============================================================================
# Window_SoulRage
#==============================================================================

class Window_SoulRage < Window_Selectable

  attr_accessor :index
  attr_accessor :index0
  attr_accessor :index1
  attr_accessor :index2
  attr_accessor :index3
  attr_accessor :index4
 
  def initialize(actor)
    super(0, 128, 640, 384)
    x = 0
    y = 0
    @skill_ids = [[0], [0], [0], [0], [0]]
    @column_max = 1
    @actor = actor
    @index = 0
    @alt_index = [0, 0, 0, 0, 0]
    refresh
    @index = 0
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
 
  def update_actor(actor)
    @actor = actor
    refresh 
  end
 
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    if @actor != nil
      @item_max = 5
      self.contents = Bitmap.new(width - 42, row_max * 42)
      if $fontface != nil
        self.contents.font.name = $fontface
      elsif $defaultfonttype != nil
        self.contents.font.name = $defaultfonttype
      end
      self.contents.font.size = 24
      for i in 0...5
        draw_item(i)
      end
    end
  end
 
  def draw_item(index)
    y = index * 42
    case index
    when 0
      equip = $data_weapons[@actor.weapon_id]
      @skill_ids[0] = database(@actor.weapon_id, true)
    when 1
      equip = $data_armors[@actor.armor1_id]
      @skill_ids[1] = database(@actor.armor1_id)
    when 2
      equip = $data_armors[@actor.armor2_id]
      @skill_ids[2] = database(@actor.armor2_id)
    when 3
      equip = $data_armors[@actor.armor3_id]
      @skill_ids[3] = database(@actor.armor3_id)
    when 4
      equip = $data_armors[@actor.armor4_id]
      @skill_ids[4] = database(@actor.armor4_id)
    end
    id = @skill_ids[index][@alt_index[index]]
    skill = $data_skills[id] if id != 0
    if skill != nil
      if @actor.can_use_sr?(skill.id)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      rect = Rect.new(x, y, self.width / @column_max - 42, 42)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(skill.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x+300, y+8, bitmap, Rect.new(0, 0, 24, 24), opacity)
      self.contents.draw_text(x+300 + 28, y, 204, 42, skill.name, 0)
      unless skill.sp_cost == 0
        self.contents.draw_text(x+300 + 216, y, 64, 42, skill.sp_cost.to_s + "%", 2)
      end
      if @skill_ids[index].size > 1
        self.contents.draw_text(x+300 - 16, y, 32, 42, "«")
        self.contents.draw_text(x+300 + 264, y, 32, 42, "»", 2)
      end
    else
      self.contents.font.color = disabled_color
      self.contents.draw_text(x+300 + 28, y, 204, 42, "not available", 0)
    end
    if id == 0
      color = disabled_color
    else
      color = disabled_color
      color = normal_color if @actor.can_use_sr?(id)
    end
    if @actor.equippable?(equip)
      draw_item_name2(equip, x+4, y+4, color)
    else
      self.contents.font.color = disabled_color
      self.contents.draw_text(x, y, 288, 42, "Nothing equipped")
    end
  end
 
  alias upd_srs_later update
  def update
    upd_srs_later
    size = @skill_ids[@index].size
    if Input.trigger?(Input::RIGHT)
      old_index = @alt_index[@index]
      @alt_index[@index] = (@alt_index[@index] + 1) % size
      if old_index != @alt_index[@index]
        $game_system.se_play($data_system.cursor_se)
      end
      refresh
      return
    end
    if Input.trigger?(Input::LEFT)
      old_index = @alt_index[@index]
      @alt_index[@index] = (@alt_index[@index] + size - 1) % size
      if old_index != @alt_index[@index]
        $game_system.se_play($data_system.cursor_se)
      end
      refresh
      return
    end
  end
 
  def top_row
    return self.oy / 42
  end
 
  def top_row=(row)
    row = 0 if row < 0
    row = row_max - 1 if row > row_max - 1
    self.oy = row * 42
  end
 
  def page_row_max
    return (self.height - 42) / 42
  end
 
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
      return
    end
    row = @index / @column_max
    self.top_row = row if row < self.top_row
    if row > self.top_row + (self.page_row_max - 1)
      self.top_row = row - (self.page_row_max - 1)
    end
    cursor_width = self.width / @column_max - 42
    x = @index % @column_max * (cursor_width + 42)
    y = @index / @column_max * 42 - self.oy
    self.cursor_rect.set(x, y, cursor_width, 42)
  end
 
  def update_help
    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  end
 
  def skill
    id = @skill_ids[@index][@alt_index[@index]]
    return $data_skills[id] if id != 0
  end
 
  def database(equip_id, weapon = false)
    skill_ids = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# START SR Database
#
# This is your equipment Soul Rage database. To add a new Soul Rage skill to a
# weapon is very simple. Add another "when"-branch in the script snipplet below
# (they have comments next to it). Configure it like this template:
#
# when WEAPON_ID
#   skill_ids.push(SOULRAGE_SKILL_ID)
#   skill_ids.push(SOULRAGE_SKILL_ID)
#
# The same works for armors:
#
# when ARMOR_ID
#   skill_ids.push(SOULRAGE_SKILL_ID)
#   skill_ids.push(SOULRAGE_SKILL_ID)
#
# The lines are commented below so you should have no problems with the script.
#
# To determine the percentage of Soul Rage consumed to use a skill, set the SP
# to the percentage. e.g. 33SP would mean 33% of the Soul Rage bar.
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    if weapon
      case equip_id # weapon IDs
      when 1
        skill_ids.push(89)
        skill_ids.push(7)
      when 10
        skill_ids.push(8)
      end
   else
      case equip_id # armor IDs
      when 6
        skill_ids.push(1)
      when 18
        skill_ids.push(25)
      end
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END SR Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return skill_ids if skill_ids.size > 0
    return [0]
  end
 
end

#==============================================================================
# Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base

  def refresh
    self.contents.clear
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_name(actor, actor_x, -8)
      draw_actor_hp(actor, actor_x, 14, 120)
      draw_actor_sp(actor, actor_x, 44, 120)
      draw_actor_sr(actor, actor_x, 74, 120) if DRAW_BAR == true
      draw_actor_sr_no_bar(actor, actor_x, 74, 120) if DRAW_BAR == false
      if @level_up_flags[i]
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 100, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, actor_x, 100)
      end
    end
  end
 
end

#==============================================================================
# Window_Command
#==============================================================================

class Window_Command < Window_Selectable
 
  attr_accessor :commands
  attr_accessor :actor
 
  alias initialize_srs_later initialize
  def initialize(width, commands)
    initialize_srs_later(width, commands)
    @SRcommand = "Soul Rage"
  end
 
  def set_player_command
    @Limitcommand = @actor.limit_name if @commands[0] != @actor.limit_name
    refresh
  end
 
  def swap_commands
    temp = @commands[1]
    @commands[1] = @SRcommand
    @SRcommand = temp
    refresh
  end
 
  def swap_commands_2
    if @commands[0] == @actor.limit_name or @Limitcommand == @actor.limit_name
      temp = @commands[0]
      @commands[0] = @Limitcommand
      @Limitcommand = temp
      refresh
    end
  end
 
  alias refresh_srs_later refresh
  def refresh
    if $fontface != nil
      self.contents.font.name = $fontface
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
    end
    self.contents.font.size = 24
    if @actor != nil and ALLOW_LIMIT and @commands[0] == @actor.limit_name
      for j in 0...6
        self.contents.clear
        self.contents.font.color = LIMIT_COLOR
        rect = Rect.new(164 - j * 32, 0, self.contents.width - 8, 32)
        self.contents.draw_text(rect, @commands[0])
        self.contents.font.color = normal_color
        for i in 0...@item_max
          unless @commands[i] == @actor.limit_name
            draw_item(i, normal_color)
          end
        end
        if $scene.is_a?(Scene_Battle) and ALLOW_RAGE
          self.contents.font.size += 4
          self.contents.font.color = normal_color
          self.contents.draw_text(0, 31, width - 32, 32, "›› ", 2)
          self.contents.font.size -= 4
        end
        Graphics.update
      end
    elsif ALLOW_RAGE and @commands[1] == "Soul Rage"
      for j in 0...6
        self.contents.clear
        self.contents.font.color = RAGE_COLOR
        rect = Rect.new(164 - j * 32, 32, self.contents.width - 8, 32)
        self.contents.draw_text(rect, @commands[1])
        self.contents.font.color = normal_color
        for i in 0...@item_max
          unless @commands[i] == "Soul Rage"
            draw_item(i, normal_color)
          end
        end
        if ALLOW_LIMIT and $scene.is_a?(Scene_Battle) and @actor != nil and
            @actor.can_use_limit?
          self.contents.font.size += 4
          self.contents.font.color = normal_color
          self.contents.draw_text(0, -1, width - 32, 32, "›› ", 2)
          self.contents.font.size -= 4
        end
        Graphics.update
      end
    else
      refresh_srs_later
      if $scene.is_a?(Scene_Battle)
        if ALLOW_RAGE
          self.contents.font.size += 4
          self.contents.font.color = normal_color
          self.contents.draw_text(0, 31, width - 32, 32, "›› ", 2)
          self.contents.font.size -= 4
        end
        if ALLOW_LIMIT and @actor != nil and @actor.can_use_limit?
          self.contents.font.size += 4
          self.contents.font.color = normal_color
          self.contents.draw_text(0, -1, width - 32, 32, "›› ", 2)
          self.contents.font.size -= 4
        end
      end
    end
  end
 
  def test_limit
    return (@actor != nil and @actor.can_use_limit? and @index == 0)
  end
 
end

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

class Scene_Battle
 
  alias main_srs_later main
  def main
    main_srs_later
    @rage_window.dispose if @rage_window != nil
  end
   
  alias phase3_setup_command_window_srs_later phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_srs_later
    @actor_command_window.actor = @active_battler
    @actor_command_window.set_player_command
  end
 
  alias update_phase3_srs_later update_phase3
  def update_phase3
    if @rage_window != nil and @rage_window.visible
      @rage_window.update
      update_phase3_rage_select
      return
    end
    update_phase3_srs_later
  end
 
  alias update_phase3_enemy_select_srs_later update_phase3_enemy_select
  def update_phase3_enemy_select
    if Input.trigger?(Input::B)
      end_rage_select_plus
    end
    update_phase3_enemy_select_srs_later
  end

  alias update_phase3_actor_select_srs_later update_phase3_actor_select
  def update_phase3_actor_select
    if Input.trigger?(Input::B)
      end_rage_select_plus
    end
    update_phase3_actor_select_srs_later
  end

  alias phase3_next_actor_srs_later phase3_next_actor
  def phase3_next_actor
    end_rage_select if @rage_window != nil
    phase3_next_actor_srs_later
  end

  def update_phase3_rage_select
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      end_rage_select if @rage_window.visible
      return
    end
    if Input.trigger?(Input::C)
      @skill = @rage_window.skill
      if @skill == nil or not @active_battler.can_use_sr?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @active_battler.current_action.skill_id = @skill.id
      @rage_window.visible = false
      if @skill.scope == 1
        start_enemy_select
      elsif @skill.scope == 3 or @skill.scope == 5
        start_actor_select
      else
        phase3_next_actor
      end
      return
    end
  end
 
  def start_rage_select
    @rage_window = Window_SoulRage.new(@active_battler)
    @rage_window.help_window = @help_window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
 
  def end_rage_select
    end_rage_select_plus
    @actor_command_window.swap_commands
    @rage_window.dispose
    @rage_window = nil
    @help_window.visible = false
  end
 
  def end_rage_select_plus
    if @rage_window != nil
      if @rage_window.visible
        @actor_command_window.active = true
        @actor_command_window.visible = true
        @help_window.visible = false
      else
        @rage_window.active = true
        @rage_window.visible = true
      end
    end
  end
 
  alias update_phase4_step2_srs_later update_phase4_step2
  def update_phase4_step2
    update_phase4_step2_srs_later
    make_rage_action_result if @active_battler.current_action.kind == 3
    make_sl_action_result if @active_battler.current_action.kind == 9
  end
 
  def make_rage_action_result
    @skill = $data_skills[@active_battler.current_action.skill_id]
    unless @active_battler.current_action.forcing
      unless @active_battler.can_use_sr?(@skill.id)
        $game_temp.forcing_battler = nil
        @phase4_step = 1
        return
      end
    end
    @active_battler.sr -= @skill.sp_cost * 10
    @status_window.refresh
    @help_window.set_text(@skill.name, 1)
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    @common_event_id = @skill.common_event_id
    set_target_battlers(@skill.scope)
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
 
  def make_sl_action_result
    @skill = $data_skills[@active_battler.current_action.skill_id]
    @active_battler.use_limit
    @status_window.refresh
    @help_window.set_text(@skill.name, 1)
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    @common_event_id = @skill.common_event_id
    set_target_battlers(@skill.scope)
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
 
  alias update_phase3_basic_command_srs_later update_phase3_basic_command
  def update_phase3_basic_command
    if ALLOW_LIMIT
      if @actor_command_window.test_limit and Input.press?(Input::RIGHT)
        if @actor_command_window.commands[0] !=
            @actor_command_window.actor.limit_name
          $game_system.se_play($data_system.decision_se)
          skill = $data_skills[@actor_command_window.actor.limit_id]
          @help_window.set_text(skill.description, 1)
          @actor_command_window.swap_commands_2
        end
        if not Input.trigger?(Input::UP) and not Input.trigger?(Input::DOWN)
          @actor_command_window.update
        end
      else
        if @actor_command_window.commands[0] ==
            @actor_command_window.actor.limit_name
          $game_system.se_play($data_system.cancel_se)
          @actor_command_window.swap_commands_2
          @help_window.set_text("", 1)
          @help_window.visible = false
        end
      end
      if @actor_command_window.commands[0] ==
          @actor_command_window.actor.limit_name and Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 9
        @active_battler.current_action.skill_id = @actor_command_window.actor.limit_id
        @skill = $data_skills[@active_battler.current_action.skill_id]
        @help_window.visible = false
        if @skill.scope == 1
          start_enemy_select
          @actor_command_window.swap_commands_2
        elsif @skill.scope == 3 or @skill.scope == 5
          start_actor_select
          @actor_command_window.swap_commands_2
        else
          @actor_command_window.swap_commands_2
          phase3_next_actor
        end
        return
      end
    end
    if ALLOW_RAGE
      if @actor_command_window.index == 1 and Input.press?(Input::RIGHT)
        if @actor_command_window.commands[1] != "Soul Rage"
          $game_system.se_play($data_system.decision_se)
          @actor_command_window.swap_commands
        end
        if not Input.trigger?(Input::UP) and not Input.trigger?(Input::DOWN)
          @actor_command_window.update
        end
      else
        if @actor_command_window.commands[1] == "Soul Rage"
          $game_system.se_play($data_system.cancel_se)
          @actor_command_window.swap_commands
        end
      end
      if @actor_command_window.commands[1] == "Soul Rage" and
          Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 3
        start_rage_select
        return
      end
    end
    update_phase3_basic_command_srs_later
  end

end

or some Scripter sees this, hope he can see the problem.
« Last Edit: December 21, 2006, 01:05:15 PM by Blizzard »

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
Many thank's Blizzard ^_^

Your a saviour.

***
Rep:
Level 88
Menu & Battle System Guru
damn this guy's good. somebody throw an RMXP-Emmy statue his way.... 8)

***
Rep:
Level 88
Menu & Battle System Guru
blizz, is it possible to increase the SR rate when a character is in a certain state?

Would it be something like this:

if $game_actor[X].state == 3 #Raged or what have you
  $SRS_rate.actor[X] = 2000
  else $SRS_rate = 1000

Also, is it possible to only enable Soul Limit if an accesory is equipped?

thanks man!
« Last Edit: January 23, 2007, 12:07:16 AM by blazinhandle »

***
Rep:
Level 88
Menu & Battle System Guru
errr excuse the double post please, wait make that a triple :o...and also all of the questions :police:

I'm using a weapon leveling script and was wondering if I could plug in "if weapon_lvl = whatever" into the Soul Rage system so that they could only use a skill if the weapon has acquired the skill.
Or better yet, just define the leveling script to check if the skill has been learned because doesn't the SR system give the skills based on what is equipped rather than if the skill has actually been learned?

once again, I don't mean to be a nag  :lol:
« Last Edit: January 23, 2007, 12:28:27 AM by blazinhandle »

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
1.

Find these methods at the beginning:

Code: [Select]
  def attack_effect(attacker)
...
  def skill_effect(user, skill)

Now find the line (or a very similar) in both methods that says:

Code: [Select]
self.sr += self.damage * SRS_rate / last_hp

Copy-paste the line and add this addition at the end of the line:

Code: [Select]
if @states.include?(ID)

So it should be like:

Code: [Select]
self.sr += self.damage * SRS_rate / last_hp if @states.include?(ID)

Change ID to the state you want. The actual code might vary a little bit from this here, because this here is from my own game and I use version 2.7b, not 4.xb. It just suits me better.
Also, this will increase it exactly by 100%. If you want another rate, you need kind of this:

Code: [Select]
self.sr += self.damage * SRS_rate * PERC / (100 * last_hp) if @states.include?(ID)

where you need to change PERC to the additional percentage increase. You know... If you change it to 50, the state will make you gain 50% additional SR. If you make it 170, the state will make you gain 170% additional SR.

2.

Find this method:

Code: [Select]
  def can_use_limit?
    return (self.sr / 10 >= @sr_rate and
        100 * self.hp / self.maxhp <= @hp_rate and
        100 * self.sp / self.maxsp <= @sp_rate)
  end

Replace it with this one:

Code: [Select]
  def can_use_limit?
    return (self.sr / 10 >= @sr_rate and
        100 * self.hp / self.maxhp <= @hp_rate and
        100 * self.sp / self.maxsp <= @sp_rate or
        @armor4_id == XX)
  end

Change XX to the ID of the accessory in the database.

3.

Ok, for the last part, you need to change the SR database itself. Find the method:

Code: [Select]
  def database(equip_id, weapon = false)
    skill_ids = []
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# START SR Database
#
# This is your equipment Soul Rage database. To add a new Soul Rage skill to a
# weapon is very simple. Add another "when"-branch in the script snipplet below
# (they have comments next to it). Configure it like this template:
#
# when WEAPON_ID
#   skill_ids.push(SOULRAGE_SKILL_ID)
#   skill_ids.push(SOULRAGE_SKILL_ID)
#
# The same works for armors:
#
# when ARMOR_ID
#   skill_ids.push(SOULRAGE_SKILL_ID)
#   skill_ids.push(SOULRAGE_SKILL_ID)
#
# The lines are commented below so you should have no problems with the script.
#
# To determine the percentage of Soul Rage consumed to use a skill, set the SP
# to the percentage. e.g. 33SP would mean 33% of the Soul Rage bar.
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    if weapon
      case equip_id # weapon IDs
      when 6
        skill_ids.push(10)
        skill_ids.push(11)
        skill_ids.push(12)
      when 10
        skill_ids.push(8)
      end
    else
      case equip_id # armor IDs
      when 6
        skill_ids.push(1)
      when 18
        skill_ids.push(25)
      end
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END SR Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return skill_ids if skill_ids.size > 0
    return [0]
  end
 
end

Ok, to make a WEAPON have an additional skill if a certain level is acquired this part here:

Code: [Select]
    if weapon
      case equip_id # weapon IDs
      when 6
        skill_ids.push(10)
        skill_ids.push(11)
        skill_ids.push(12)
      when 10
        skill_ids.push(8)
      end

has to look like this:

Code: [Select]
    if weapon
      case equip_id # weapon IDs
      when 6
        skill_ids.push(10)
        skill_ids.push(11)
        skill_ids.push(12) if $data_weapons[equip_id].level >= 5
      when 10
        skill_ids.push(8)
      end

Since I don't know the weapon level script, it could also be like this:

Code: [Select]
    if weapon
      case equip_id # weapon IDs
      when 6
        skill_ids.push(10)
        skill_ids.push(11)
        skill_ids.push(12) if @actor.weapon_lvl >= 5
      when 10
        skill_ids.push(8)
      end

Best is you try it out and tell me if it works. If it doesn't, post a link to the topic where you got the script or post the script itself. When I have taken a look at it, I will know what to do.

BTW, need an item that extends SR capacity from 100% to i.e. 150%?

Change:

Code: [Select]
  def sr=(sr)
    @sr = sr
    @sr = 1000 if @sr > 1000
    @sr = 0 if @sr < 0
  end

to

Code: [Select]
  def sr=(sr)
    @sr = sr
    @sr = maxsr if @sr > maxsr
    @sr = 0 if @sr < 0
  end
 
  def maxsr
    base = 1000
    base += EXTRA if @armor4_id == ID
    return base
  end

Change ID to the accessory ID and EXTRA to 10 times the extra percentage. So, if you want 180%, change EXTRA to 800. If you want 10%, change it to 100.
Now just above should be:

Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

*
A man chooses,
Rep:
Level 92
a slave obeys
Project of the Month winner for April 2008
Is there a way to make an Ability to recover The Soul Bar? I want to use it for one of the specials of one character  :=:

***
Rep:
Level 88
Menu & Battle System Guru
yo thanks a lot blizz,

1:I couldn't get the first one to work.

2:I did get the second one to work! I wanted the Soul Limit to only be availible when a character had their accessory equipped so i did this:

  def can_use_limit?
    if @armor4_id >= 86 #with each characters' acc. being 86 or higher
    return (self.sr / 10 >= @sr_rate and
        100 * self.hp / self.maxhp <= @hp_rate and
        100 * self.sp / self.maxsp <= @sp_rate)
    end
  end

3: This worked too!

One more thing though Blizz, I'm using Minkoff's Animated Battlers which moves the characters in battle. It works by using a grid of 8x4 sprites (8 poses, 4 movements per pose) and it calls a movement when you select attack, skill, defend, item, etc. However, when I use SR or SL it shutsdown b/c there isn't a pose set for those. Is it possible to set the pose to use Skill? Anyways, if you get a chance, here's the script for it:

[code]#==============================================================================
# ** Animated Battlers - Enhanced   ver. 5.0                       (12-23-2006)
#------------------------------------------------------------------------------
#  Animated Battlers by Minkoff
#  Enhancements by DerVVulfman       
#  Low percentage and Status Poses
#     Concept & Base coding by Twin Matrix
#  Stationary Enemies requested by jens009
#  Continuous Victory Looping for actors requested by Skyla Doragono
#  Actors readying themselves before battle requested by Clive
#  Default Battlers for Enemies requested for by WithViolence
#  Mixed Default and Spritesheet Battlers requested for by SteveE22
#  Hero & Enemy z.depth concept by Min-Chan and Caldaron ( totally redone :) )
#  Stationary Poses suggested by Twin Matrix
#  Critical Hit animation requested by Mimi-Chan
#  Both Enemy and Actor's individual Frames per Pose requested by creiz
#  Expandable Battle Parties beyond 4 requested by Leknaat
#  Additional value call added for compatability with Battle Cry script
#  Removed dependancy on $game_system for the Sideview Mirror system
#  Fixed the 'Blocking during Victory State' bug discovered by Kaze950
#  Collapse stack-error found by JirbyTaylor(fixed) / Code by SephirothSpawn

#==============================================================================
#
#   ADDITIONAL CALLS AVAILABLE PRIOR TO COMBAT:
#
#------------------------------------------------------------------------------
#  SIDEVIEW MIRROR:     This value switches  the positions  of both enemies and
#                       heroes to opposite ends of the screen.
#
#   Script : $sideview_mirror = [number]
#   number : a value indicating whether the hero & enemy positions are switched
#            0 = Default:  Enemies on the left, Heroes on the right
#            1 = Switched: Heroes on the left, Enemies on the right
#
#------------------------------------------------------------------------------
#  BATTLER FORMATIONS:  This value changes the way your heroes line up when the
#                       battle starts.
#
#   Script : $formation_style = [number]
#   number : a value indicating the type of formation your heroes will use
#            0 = Diagonal (Default)    4 = Column Pattern 1
#            1 = Diagonal Pattern 2    5 = Column Pattern 2
#            2 = Slanted Pattern 1     6 = Wave Formation 1
#            3 = Slanted Pattern 2     7 = Wave Formation 2
#
#            8 = Randomized (system will choose from 0 to 7)
#
#------------------------------------------------------------------------------
#  FORMATION OPTIONS:   These values  may expand your system  to go beyond the
#                       default four player system.
#
#   Script : $formation_max_member = [number]
#   number : A value indicating the maximum number of members in your party.
#             (default = 4)
#             
#   Script : $formation_max_height = [number]
#   number : A value indicating (in pixels) the top height of your party shown
#            in the Battle Screen.  The higher the number, the lower the party
#            on the screen. (default = 220)
#
#   Script : $formation_max_width  = [number]
#   number : The left/right width of the party's formation.  (default = 128)
#
#   Script : $battlestatus_height = [number]
#   number : The actual height of your battlestatus window. (default = 160)
#
#  NOTE: The combined $formation_max_height and $battlestatus_height determines
#        the vertical distance between battlers in their formation.
#
#==============================================================================


# Things added since original version by Minkoff:
#   Can reverse the battler positions
#   Editable spritesheet layout in script
#   Able to define total/max frames per pose
#   Can define individual # of frames per each pose
#   Can use 'red-out' RTP death or 'battler death' pose
#   Can show battler falling before death.
#   'Casting' pose now available for RTAB/Skill Timing users
#   Can show battler celebrating before victory pose
#   Can tag battlers who's victory pose loops indefinitely
#   Can show actor battlers get ready before battle starts.
#   Separate poses for 'skills', 'items' or 'weapons' based on their id
#   Can allow the battlers to step forward before using items & skills (FFVII+)
#   Attacking battlers rush towards their targets while item & skill users don't
#   Certain weapons can force the battler NOT to move
#   Certain items & skills can force battlers to 'rush' the enemy
#   Certain skills or items can force movement to the center of the screen
#   Stationary enemies. In case enemies do NOT move when they attack.
#   Adjustable 'low health' checker. Set your low health to 25%... 30%... 10%...
#   Poses now available for status ailments
#   Dead revert to 'victory' pose bug fixed.
#   Default battlers now available for actors and/or enemies
#   Default battlers now usable by ID number (had to rewrite red-out for that)
#   Escaping Enemies bug found by SteveE22.  Fixed just as fast.
#   Hero Formations (total of 8 hardwired -& 1 random- ... add at your own risk)
#   Z-Depth for attack overlapping purposes
#   Corrected attack overlap offset routine.  Overlap now based on battler size
#   Certain skills and items can now prevent movement
#   Can allow battlers to take step forward before performing 'attack' pose.(FF)
#   Certain weapons can move battlers to center screen instead of a full move.
#   Escaping Enemies can now have a pose before disappearing (was a rush pose)
#   Redesigned Scene_Battle's movement routine
#   Added pose for Critical Hits
#   Added the enemy's hash for frame number based on poses
#   Added the actor's hash for frame number based on poses
#   Re-Tooled the formations to go beyond the default four party system
#   Minor value added for compatability with Delissa's Battle Cry script
#   Default Collapse Stack-Error fixed(code by SephirothSpawn) found JirbyTaylor
#   Removed dependancy on $game_system for the Sideview Mirror system
#   Fixed the 'Blocking during Victory State' bug discovered by Kaze950
#   Includes an Adaptation Switch for use with RTAB's Connected Attacking script
#   
#   40 counted.

#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display the battler.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler < RPG::Sprite
 
  attr_accessor :battler_offset         # Degree of action forcing 
  attr_accessor :skill_used             # Degree of action forcing 
  attr_accessor :item_used              # Degree of action forcing 
 
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias cbs_initialize initialize
  def initialize(viewport, battler = nil)

    # * Configuration System *
   
    # * Default Battler Style Switches
    #--------------------------------------------------------------------------       
    $default_enemy = true               # If true, these switches allows the use
    $default_actor = false              # of default battlers for actors/enemies
    $default_enemy_id = []             # Ids of enemies using default battlers
    $default_actor_id = []              # Ids of actors using default battlers
    @default_collapse_actor   = false   # If true, restores the old 'red fade'
    @default_collapse_enemy   = true    #   collapse effect (using spritesheets)
   
   
    # * Animation Frames and Animation Speed
    #--------------------------------------------------------------------------   
    @speed              = 4      # Framerate speed of the battlers
    @poses              = 11     # Maximum # of poses (stances) in the template
    @frames             = 4      # Maximum # of frames in each pose
    @frames_standard    = 4      # Standard # of frames played in each pose.
    @low_hp_percentage  = 0.25   # Determines health% of battler for WOOZY pose.
 
 
    # * Poses Control
    #--------------------------------------------------------------------------   
   
    # Editable Template (Some people wanted to change their template design)
    $p1   =   0   # Sets the 'Ready Pose'  ($p1) to be pose  #1 in your template
    $p2   =   1   # Sets the 'Struck Pose' ($p2) to be pose  #2 in your template
    $p3   =   2   # Sets the 'Woozy Pose'  ($p3) to be pose  #3 in your template
    $p4   =   3   # Sets the 'Block Pose'  ($p4) to be pose  #4 in your template
    $p5   =   4   # Sets the 'Charge Pose' ($p5) to be pose  #5 in your template
    $p6   =   5   # Sets the 'Retreat Pose'($p6) to be pose  #6 in your template
    $p7   =   6   # Sets the 'Attack Pose' ($p7) to be pose  #7 in your template
    $p8   =   7   # Sets the 'Item Pose'   ($p8) to be pose  #8 in your template
    $p9   =   8   # Sets the 'Skill Pose'  ($p9) to be pose  #9 in your template
    $p10  =   9   # Sets the 'Victory Pose'($p10)to be pose #10 in your template
    $p11  =  10   # Sets the 'Defeat Pose' ($p11)to be pose #11 in your template
    # Non-Default Poses (can expand beyond the default 11 poses here)
    @poses_setup         = nil         # Choose animation pose for 'preparation'
    @poses_casting       = nil         # Set casting pose to 'Block' for example
    $poses_escaping      = nil         # Set 'coward' pose for fleeing monsters)   
    $poses_critical      = nil         # Set 'critical' hit pose for BIG hits.
    @poses_dying         = nil         # Choose animation pose for dying throws.
    @poses_winning       = nil         # Set winning dance to 'block' for examp.
    @poses_winning_loops = [7]         # Set victory non-freezing actor as #7
    # Non-Default Pose Hashes (poses dependant on .id values)
    @poses_status  = {3 => 2, 4 => 3}  # Default: #3(Venom)&#4(Dazzle) is 'Woozy'
    $poses_skills  = {57 => 6}         # Default: #57(Cross Cut) does 'Attack'
    $poses_items   = {13 => 3}         # Default: #13(Sharp Stone) does 'Block'
    $poses_weapons = {}                # Didn't set any weapons to any poses
 
 
    # * Frames Control
    #--------------------------------------------------------------------------   
    @frames_per_pose    = {0 => 2}            # Set #of frames to pose(by index)

    # Advanced Individual Pose/Frame Hashes   # Advanced Individual Poses  uses
                                              # hashes within hashes. As a demo
    $poses_actor = {7 => {0 => 4}}            # you can see that enemy #1 has 2
    $poses_enemy = {1 => {0 => 2, 3 => 2}}    # sets of controls:  index 0 (for
                                              # a ready pose is set to 1 frame,
    # while index 3 (block) is set to 'two' frames.   Likewise, for the actor's
    # hash, Actor #7 (Gloria) has only 1 control hash.   It sets index pose '0'
    # (the ready pose again) to use four frames of animation (even though I had
    # set the ready pose to just use '2' with the @frames_per_pose hash earlier.
   
   
    # Individual Battler Settings
    @mirror_enemies     = true     # Enemy battlers use reversed image
    @stationary_enemies = false    # If the enemies don't move while attacking
    @stationary_actors  = false    # If the actors don't move while attacking
    @calculate_speed    = false    # System calculates a mean/average speed
    @phasing            = true     # Characters fade in/out while attacking
   
   
    # * Movement Settings (Step-Forward / Final Fantasy-Style)
    #--------------------------------------------------------------------------   
    $rush_offset        = 0        # How much additional space between battlers
    $rush_attack        = false    # If true, battler steps forward to attack
    $rush_skill         = true     # If true, battler steps forward to use skill
    $rush_item          = true     # If true, battler steps forward to use item
   
   
    # * Movement Arrays (Arrays for skill/weapon/item IDs that affect movement)
    #--------------------------------------------------------------------------   
    $moving_item_atk    = [1]     # Examples are items that need to be applied.
    $moving_skill_atk   = [57,61] # Examples are martial-arts and sneak attacks
    $move2center_atk    = []      # Moves battler to center based on weapon id!
    $move2center_item   = [5]     # Moves battler to center for a big item atk!
    $move2center_skill  = [7]     # Moves battler to center for a big skill atk!
 
 
    # * Stationary Arrays (Arrays for skill/weapon/item IDs that halt movement)
    #--------------------------------------------------------------------------   
    # Array that holds the id # of skills, items or weapons that affect movement
    $stationary_enemyid = []       # Enemies that don't RUN during melee attacks
    @stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
    @stationary_skills  = []       # (examples are bows & guns)
    @stationary_items   = []       # (examples are bows & guns)
   
    # Adaptation Switches
    $RTAB_Connected_Attacking = false  # Needed to be on if RTAB and Con. Attk.
   
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
    @frame, @pose = 0, 0
    @last_time = 0
    @last_move_time = 0
    @battler_offset = 0
    @skill_used = 0
    @item_used = 0
    $casted = false
    $casting = false
    @dying   = true
    @s_pose  = false
    $victory = false
    @winning = true
    cbs_initialize(viewport, battler)
    viewport.z = 99
    $formation = $formation_style
    # Setting values called from EVENT scripts
    $sv_mirror = $sideview_mirror
    $sv_mirror = 0 if $sideview_mirror == nil
    $max_member = $formation_max_member
    $max_member = 4 if $formation_max_member == nil
    $formation_top = $formation_max_height
    $formation_top = 220 if $formation_max_height == nil
    $formation_width = $formation_max_width
    $formation_width = 128 if $formation_max_width == nil
    $battlestat_height = $battlestatus_height
    $battlestat_height = 160 if $battlestatus_height == nil
    $formation = $formation_style
    $formation = 0 if $formation_style == nil
    # if Formation is random
    if $formation == 8 then
      $formation = rand(8).to_i
    end
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias cbs_update update
  def update
    return unless @battler
    # Regular Update
    cbs_update
    # Reset hash for Advanced Pose/Frames
    pose_temp = {}
    # Start Routine
    unless @started
      @pose = state
     
      if @battler.is_a?(Game_Enemy)
        if not $default_enemy
          if $default_enemy_id == nil
            # Set up Spritesheet Standards 
            @width = @width / @frames
            @height = @height / @poses
          else
            if not $default_enemy_id.include?(@battler.id)
              @width = @width / @frames
              @height = @height / @poses
            end
          end
        end
      end
 
      if @battler.is_a?(Game_Actor)
        if not $default_actor
          if $default_actor_id == nil
            # Set up Spritesheet Standards 
            @width = @width / @frames
            @height = @height / @poses
          else
            if not $default_actor_id.include?(@battler.id)
              @width = @width / @frames
              @height = @height / @poses
            end
          end
        end
      end
     
      @battler_offset = @width * 0.75
   
      @display_x = @battler.screen_x
      @display_y = @battler.screen_y
      @display_z = @battler.screen_z
      @destination_x = @display_x
      @destination_y = @display_y
      @destination_z = @display_z
      self.opacity = 0
      @started = true
    end
 
    # Cut Out Frame
    # Enemy Battler Routine
    if @battler.is_a?(Game_Enemy)
      if $default_enemy
        self.src_rect.set(@width * 0, @height * 0, @width, @height)
      else
        if $default_enemy_id !=nil
          if $default_enemy_id.include?(@battler.id)
            self.src_rect.set(@width * 0, @height * 0, @width, @height)
          else
            self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
          end
        else
          self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
        end
      end
    end
   
    # Actor Battler Routine
    if @battler.is_a?(Game_Actor)
      if $default_actor
        self.src_rect.set(@width * 0, @height * 0, @width, @height)
      else
        if $default_actor_id !=nil
          if $default_actor_id.include?(@battler.id)
            self.src_rect.set(@width * 0, @height * 0, @width, @height)
          else
            self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
          end
        else
          self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
        end
      end
    end
   
    # Position Sprite
    self.x = @display_x
    self.y = @display_y
    self.z = @display_z
    self.ox = @width / 2
    self.oy = @height
   
    # Adjust sprite direction if facing the other way...
    if $sv_mirror == 1
      if @battler.is_a?(Game_Actor)
        self.mirror = !!battler
      else
        if not @mirror_enemies
          self.mirror = !!battler
        end
      end
    else
      if @battler.is_a?(Game_Enemy)
        if @mirror_enemies
          self.mirror = !!battler
        end
      end
    end
   
    # Setup Frames per Pose
    poseframe = @frames_standard
    poseframe = @frames_per_pose[@pose] if @frames_per_pose.include?(@pose)
    # Set Advanced Poses for Actors
    if @battler.is_a?(Game_Actor)
      pose_temp = $poses_actor[@battler.id] if $poses_actor.include?(@battler.id)
      poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
    end   
    # Set Advanced Poses for Enemies
    if @battler.is_a?(Game_Enemy)
      pose_temp = $poses_enemy[@battler.id] if $poses_enemy.include?(@battler.id)
      poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
    end
 
    # Setup Animation
    time = Graphics.frame_count / (Graphics.frame_rate / @speed)
    if @last_time < time
      @frame = (@frame + 1) % poseframe
      if @frame == 0
        if @freeze
          @frame = poseframe - 1
          return
        end
        @pose = state
      end
    end
    @last_time = time
    # Setup Dying Animation
    if @battler.dead?
      if @dying == true
        @pose = state
        @dying = false
      end
    else
      if @battler.is_a?(Game_Actor)
        if @poses_setup != nil
          if @s_pose == false
            @pose = @poses_setup
            @s_pose = true
          end
        end
        if $victory == true
          if @winning == true
            @pose = state
            @winning = false
          end
        end
      end
    end
   
    # Move It
    move if moving
  end
 
  #--------------------------------------------------------------------------
  # * Current State
  #--------------------------------------------------------------------------
  def state
    # Damage State
    if [nil,{}].include?(@battler.damage)
      # Battler Fine
      @state = $p1
      # Battler Wounded
      @state = $p3 if @battler.hp < @battler.maxhp * @low_hp_percentage
      # Battler Status-Effect
      for i in @battler.states
        @state = @poses_status if @poses_status.include?(i)
      end
      # If Battler Dead
      if @battler.dead?
        # If using default battlers or default collapse
        if (@default_collapse_actor and @battler.is_a?(Game_Actor)) or
          (@default_collapse_enemy and @battler.is_a?(Game_Enemy)) or
          ($default_actor and @battler.is_a?(Game_Actor)) or
          ($default_enemy and @battler.is_a?(Game_Enemy)) or
          ($default_enemy_id.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or
          ($default_actor_id.include?(@battler.id) and @battler.is_a?(Game_Actor))
          # Do absolutely nothing :)
        else
          # Use Poses system
          if @poses_dying != nil
            if @dying == true
              @state = @poses_dying
            else
              @state = $p11
            end
          else
            @state = $p11
          end
          # Fix Opacity
          self.opacity = 255     
        end
      end
    end
 
    # Casting State
    if $casted
      if @battler.rtp != 0
        if @poses_casting != nil
        @state = @poses_casting
        end
      end
    end
   
    # Victory State
    if @battler.is_a?(Game_Actor)
      if $victory
        if @poses_winning != nil
          if @winning == true
            if not @battler.dead?
              @state = @poses_winning
            end
          else
            if not @battler.dead?
            @state = $p10
              if not @poses_winning_loops.include?(@battler.id)
                @freeze = true
              end
            end
          end
        else
          if not @battler.dead?
            @state = $p10
            if not @poses_winning_loops.include?(@battler.id)
              @freeze = true
            end
          end
        end       
      end
    end
   
   
    # Guarding State (not if dead OR in victory)
    if not @battler.dead?
      if not $victory
        @state = $p4 if @battler.guarding?
      end
    end
    # Moving State
    if moving
    # Adjust sprite direction if facing the other way...
      if $sv_mirror == 1
        # If enemy battler moving
        if @battler.is_a?(Game_Enemy)
          # Battler Moving Left
          @state = $p5 if moving.eql?(0)
          # Battler Moving Right
          @state = $p6 if moving.eql?(1)
        # Else actor battler moving
        else
          # Battler Moving Left
          @state = $p6 if moving.eql?(0)
          # Battler Moving Right
          @state = $p5 if moving.eql?(1)
        end
      else     
        # If enemy battler moving
        if @battler.is_a?(Game_Enemy)
          # Battler Moving Left
          @state = $p6 if moving.eql?(0)
          # Battler Moving Right
          @state = $p5 if moving.eql?(1)
        # Else actor battler moving
        else
          # Battler Moving Left
          @state = $p5 if moving.eql?(0)
          # Battler Moving Right
          @state = $p6 if moving.eql?(1)
        end
      end
    end
    # Return State
    return @state
  end
 
  #--------------------------------------------------------------------------
  # * Move
  #--------------------------------------------------------------------------
  def move
    time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
    if @last_move_time < time
      # Pause for Animation
      return if @pose != state
      # Phasing
      if @phasing
        d1 = (@display_x - @original_x).abs
        d2 = (@display_y - @original_y).abs
        d3 = (@display_x - @destination_x).abs
        d4 = (@display_y - @destination_y).abs
        self.opacity = [255 - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
      end
      # Calculate Difference
      difference_x = (@display_x - @destination_x).abs
      difference_y = (@display_y - @destination_y).abs
      difference_z = (@display_z - @destination_z).abs 
      # Done? Reset, Stop
      if [difference_x, difference_y].max.between?(0, 8)
        @display_x = @destination_x
        @display_y = @destination_y
        @display_z = @destination_z
        @pose = state
        return
      end
     
      # Calculate Movement Increments
      increment_x = increment_y = 1
      if difference_x < difference_y
        increment_x = 1.0 / (difference_y.to_f / difference_x)
      elsif difference_y < difference_x
        increment_y = 1.0 / (difference_x.to_f / difference_y)
      end
      increment_z = increment_y
 
      # Calculate Movement Speed
      if @calculate_speed
        total = 0; $game_party.actors.each{ |actor| total += actor.agi }
        speed = @battler.agi.to_f / (total / $game_party.actors.size)
        increment_x *= speed
        increment_y *= speed
        increment_z *= speed
      end
     
      # Multiply and Move
      multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8)
      multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8)
      multiplier_z = (@destination_z - @display_z > 0 ? 8 : -8)     
      @display_x += (increment_x * multiplier_x).to_i
      @display_y += (increment_y * multiplier_y).to_i
      @display_z += (increment_z * multiplier_z).to_i
     
    end
    @last_move_time = time
  end
 
  #--------------------------------------------------------------------------
  # * Set Movement
  #--------------------------------------------------------------------------
  def setmove(destination_x, destination_y, destination_z)
    unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
           (@battler.is_a?(Game_Actor) and @stationary_actors)
      unless @stationary_weapons.include?(@battler.weapon_id) or
             @stationary_skills.include?(@skill_used) or
             @stationary_items.include?(@item_used)
        @original_x = @display_x
        @original_y = @display_y
        @original_z = @display_z         
        @destination_x = destination_x
        @destination_y = destination_y
        @destination_z = destination_z
      end
    end
  end
 
  #--------------------------------------------------------------------------
  # * Movement Check
  #--------------------------------------------------------------------------
  def moving
    if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
      return (@display_x > @destination_x ? 0 : 1)
    end
  end
 
  #--------------------------------------------------------------------------
  # * Set Pose
  #--------------------------------------------------------------------------
  def pose=(pose)
    @pose = pose
    @frame = 0
  end
 
  #--------------------------------------------------------------------------
  # * Freeze
  #--------------------------------------------------------------------------
  def freeze
    @freeze = true
  end
 
  #--------------------------------------------------------------------------
  # * Fallen Pose
  #--------------------------------------------------------------------------
  if @derv_anim_bat_stack.nil?
    @derv_anim_bat_stack = true
    alias cbs_collapse collapse
    def collapse
      if @default_collapse_enemy
        cbs_collapse if @battler.is_a?(Game_Enemy)
      end
      if @default_collapse_actor
        cbs_collapse if @battler.is_a?(Game_Actor)
      end
      if $default_enemy
        cbs_collapse if @battler.is_a?(Game_Enemy)
      end
      if $default_actor
        cbs_collapse if @battler.is_a?(Game_Actor)
      end
      if $default_enemy_id != nil
        if $default_enemy_id.include?(@battler.id)
          cbs_collapse if @battler.is_a?(Game_Enemy)
        end
      end
      if $defend_actor.id != nil
        if $default_actor_id.include?(@battler.id)
          cbs_collapse if @battler.is_a?(Game_Actor)
        end   
      end
    end
  end
end 
 
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :sideview_mirror
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_cbs_customize initialize
  def initialize
    # Call original initialization process
    initialize_cbs_customize
    @sideview_mirror = 0
  end
end 
 

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Actor X Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Determine minimum horizontal space between battlers
    x_spacer = $formation_width / $max_member
    if self.index != nil
      case $formation
      when 0                                    # DIAGONAL PATTERN 1
        if $sv_mirror == 1
          return self.index * -x_spacer + (($max_member+1)*x_spacer) #202       
        else
          return self.index * x_spacer + (640-(($max_member+1)*x_spacer))#450
        end         
      when 1                                    # DIAGONAL PATTERN 2   
        if $sv_mirror == 1
          return self.index * x_spacer + x_spacer #64       
        else
          return self.index * -x_spacer + (640-x_spacer*2) #576
        end       
      when 2                                    # 2-ROW SLANT
        if $sv_mirror == 1
          if self.index < ($max_member/2)
            return self.index + (($max_member+1)*x_spacer) + (x_spacer * self.index)
          else
            return self.index + (x_spacer * self.index) - x_spacer * 0.5
          end
        else
          if self.index < ($max_member/2)
            return self.index + (640-(($max_member+1)* x_spacer)) + (-x_spacer * self.index)
          else
            return self.index + (640-((x_spacer*0.5)-x_spacer)) + (-x_spacer * self.index)
          end
        end
      when 3                                    # 2 ROW - SLANT
        if $sv_mirror == 1
          if self.index < ($max_member/2)
            return self.index + (x_spacer/2)+(($max_member+1)* x_spacer) + (-x_spacer * self.index)
          else
            return self.index + (($max_member+1)* x_spacer) + (-x_spacer * self.index)
          end       
        else
          if self.index < ($max_member/2)
            return self.index + 442 + (x_spacer * self.index)
          else
            return self.index  + 430 + (x_spacer * self.index)
          end       
        end
      when 4                                    # Column Pattern 1       
        if $sv_mirror == 1
          if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
            return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
          else
            return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
          end       
        else
          if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
            return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
          else
            return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
          end       
        end
      when 5                                    # Column Pattern 2
        if $sv_mirror == 1
          if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
            return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1))
          else
            return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index)
          end       
        else
          if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )
            return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1))
          else
            return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index)
          end     
        end
      when 6                                    # Wave Formation 1
        if $sv_mirror == 1
          if self.index < ($max_member/2)
            return 170
          else
            return  90
          end       
        else
          if self.index < ($max_member/2)
            return 470
          else
            return 550
          end       
        end
      else                                      # Wave Formation 2
        if $sv_mirror == 1
          if self.index < ($max_member/2)
            return 170
          else
            return  90
          end       
        else
          if self.index < ($max_member/2)
            return 470
          else
            return 550
          end       
        end
      end
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Y Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    # Determine minimum vertical space between battlers
    y_spacer = (480 - $battlestat_height - $formation_top) / $max_member
    if self.index != nil
      case $formation
      when 0
        return self.index * (y_spacer*1.25) + $formation_top
      when 1
        return self.index * (y_spacer*1.25) + $formation_top
      when 2
        if self.index < ($max_member/2)
          return $formation_top + ((y_spacer*2.5) * self.index)
        else
          return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) #was 60
        end       
      when 3
        if self.index < ($max_member/2)
          return $formation_top + ((y_spacer*2.5) * self.index)
        else
          return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) # was 60
        end
      when 4
        if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )           
          return $formation_top + ($battlestat_height/2)
        else
          return $formation_top + ($battlestat_height/6)
        end
      when 5
        if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 )           
          return $formation_top + ($battlestat_height/6)
        else
          return $formation_top + ($battlestat_height /2)
        end
      when 6
        if self.index < ($max_member/2)
          return $formation_top + (y_spacer * 2.5 * self.index)
        else
          return $formation_top + (y_spacer * 2.5 * ((self.index) - ($max_member/2)))
        end 
      else
        if self.index < ($max_member/2)
          return $formation_top + (y_spacer*2.5*(($max_member/2)-1))+ (y_spacer * 2.5 * -self.index)
        else
          return $formation_top + (y_spacer*2.5*(($max_member/2)-1)) + (y_spacer * 2.5 * -((self.index) - ($max_member/2)))
        end 
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Z Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    return screen_y
  end
end


#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemies. It's used within the Game_Troop class
#  ($game_troop).
#==============================================================================

class Game_Enemy < Game_Battler
  def screen_x
    if self.index != nil
      if $sv_mirror == 1
        return 640 - $data_troops[@troop_id].members[@member_index].x
      else
        return $data_troops[@troop_id].members[@member_index].x
      end
    end
  end
end 
 

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
 
  #--------------------------------------------------------------------------
  # * Make Skill Action Results (alias used to determine skill used)
  #--------------------------------------------------------------------------
  alias make_skill_action_result_anim make_skill_action_result
  def make_skill_action_result(battler = @active_battler, plus_id = 0)
    @rtab = !@target_battlers
    if $RTAB_Connected_Attacking
      make_skill_action_result_anim(battler, plus_id)
    else
      @rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
    end
    @skill_used = @skill.id
  end
 
  #--------------------------------------------------------------------------
  # * Make Item Action Results (alias used to determine item used)
  #--------------------------------------------------------------------------
  alias make_item_action_result_anim make_item_action_result
  def make_item_action_result(battler = @active_battler)
    @rtab = !@target_battlers
    @rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim
    @item_used = @item.id
    @item_usage = @item.scope
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation) (Casting Routine)
  #--------------------------------------------------------------------------
  alias update_phase4_step1_anim update_phase4_step1
  def update_phase4_step1(battler = @active_battler)
    @rtab = !@target_battlers
    if $rtab_detected == true
      update_phase4_step1_anim(battler)
      if battler.current_action.kind == 1 and
        (not battler.current_action.forcing or @force != 2)
        if battler.rtp != 0   
          $casted = true
        end
      end
    else
      update_phase4_step1_anim
    end
  end
 
  #--------------------------------------------------------------------------
  # * Action Animation, Movement
  #--------------------------------------------------------------------------
  alias cbs_update_phase4_step3 update_phase4_step3
  def update_phase4_step3(battler = @active_battler)
    @rtab = !@target_battlers
    target = (@rtab ? battler.target : @target_battlers)[0]

    # If enemy is a default battler
    if battler.is_a?(Game_Enemy)
      if $default_enemy
        if @rtab then battler.white_flash = true end
        if @rtab then battler.wait = 10 end
      end
      if $default_enemy_id != nil
        if $default_enemy_id.include?(@battler.id)
          if @rtab then battler.white_flash = true end
          if @rtab then battler.wait = 10 end
        end
      end       
    end
    # If actor is a default battler
    if battler.is_a?(Game_Actor)
      if $default_actor
        if @rtab then battler.white_flash = true end
        if @rtab then battler.wait = 10 end
      end
      if $default_actor_id != nil
        if $default_actor_id.include?(@battler.id)
          if @rtab then battler.white_flash = true end
          if @rtab then battler.wait = 10 end
        end
      end               
    end

    # Set values and poses based on Action
    case battler.current_action.kind
    when 0  # Attack
      rush_type = $rush_attack
      full_moving = true ; if rush_type; full_moving = false; end
      if $move2center_atk.include?(battler.weapon_id); center_move=true ; end
      if $stationary_enemyid.include?(battler.id) and battler.is_a?(Game_Enemy)
        full_moving = false
        center_move = false
        rush_type = false
      end
      if battler.current_action.basic == 2
        # If escaping, disable all movement
        full_moving = false
        center_move = false
        rush_type = false       
      end
      base_pose = $p7
      base_pose = $poses_weapons[battler.weapon_id] if $poses_weapons.include?(battler.weapon_id)     
      if battler.current_action.basic == 2
        base_pose = $poses_escaping if $poses_escaping != nil
      end
     
    when 1  # Skill
      rush_type = $rush_skill
      if $moving_skill_atk.include?(@skill_used) ; full_moving = true ; end
      if $move2center_skill.include?(@skill_used) ; center_move = true ; end       
      base_pose = $p9
      base_pose = $poses_skills[@skill_used] if $poses_skills.include?(@skill_used)
    when 2  # Item
      rush_type = $rush_item
  &n
« Last Edit: January 23, 2007, 07:09:46 PM by blazinhandle »

****
When the dawn breaks...
Rep:
Level 88
...tonight will be just another memory.
You should edit your post and put it all in a code box! It will make it easier to copy and paste, etc. Also, what went wrong after the first one? Same problem?