RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Help with script

Started by l[i(Fury)i]l, March 03, 2006, 06:15:13 AM

0 Members and 2 Guests are viewing this topic.

l[i(Fury)i]l

Hi, i am using a animated cbs from minkoff, and i want the character box to be centered and the black part gone. And also i want the monster to be facing the other way, he has it so if you use the character sets for monsters they will face the correct way, i already have monster sets that face the right way so i want that part gone.

Can anyone help me? I am new with scripts are i would do it myself. Here are the scripts i am using.

Animation System Script
#==============================================================================
# ? Sprite_Battler
#------------------------------------------------------------------------------
# Minkoff's Custom Battle System // Thanks, Prexus
#==============================================================================

class Sprite_Battler < RPG::Sprite
 #--------------------------------------------------------------------------
 # ? Initialize
 #--------------------------------------------------------------------------
 alias cbs_initialize initialize
 def initialize(viewport, battler = nil)
   @frame = 0
   @pose = 0
   @default = 0
   @speed = 7
   @frames = 4
   @poses = 10
   @last_time = 0
   @last_move_time = 0
   @stationary_enemies = true
   @stationary_actors = false
   @phasing = true
   cbs_initialize(viewport, battler)
   viewport.z = 99
 end
 #--------------------------------------------------------------------------
 # ? Update
 #--------------------------------------------------------------------------
 alias cbs_update update
 def update
   return unless @battler
   
   # Regular Update
   cbs_update
   
   # Start Routine
   unless @started
     @width = @width / @frames
     @height = @height / @poses
     @battler.display_x = @battler.screen_x
     @battler.display_y = @battler.screen_y
   end
   
   # Setup Sprite
   self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
   self.mirror = @battler.is_a?(Game_Enemy) unless @started
   
   # Position Sprite
   self.x = @battler.display_x
   self.y = @battler.display_y
   self.z = @battler.display_y
   self.ox = @width / 2
   self.oy = @height
   
   # Setup Animation
   time = Graphics.frame_count / (Graphics.frame_rate / @speed)
   if @last_time < time
     @frame = (@frame + 1) % @frames
     if @frame == 0
       if @freeze
         @frame = (@frame - 1) % @frames
         return
       end
       @pose = @default
     end
   end
   @last_time = time
       
   # Set Default Pose
   if @battler.default
     @default = @battler.default
     @pose = @battler.default unless @battler.pose
     @battler.default = nil
   end
   
   # Set Pose
   if @battler.pose
     @pose = @battler.pose
     @freeze = @battler.freeze
     @battler.pose = nil
     @battler.freeze = nil
     @frame = 0
   end

   # Finish Up
   @started = true
   move if @battler.moving
 end
 #--------------------------------------------------------------------------
 # ? Move
 #--------------------------------------------------------------------------
 def move

   # Stationary Battlers
   if (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
      (@battler.is_a?(Game_Actor) and @stationary_actors)
     battler.moving = false
     return
   end

   time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
   if @last_move_time < time
     
     # Pause to Attack
     return if @pose.between?(6, 7)
     
     # Set Running Pose
     @pose = @attacked ? 5 : 4
     
     # Phasing
     d1 = (@battler.display_x - @battler.original_x).abs
     d2 = (@battler.display_y - @battler.original_y).abs
     d3 = (@battler.display_x - @battler.destination_x).abs
     d4 = (@battler.display_y - @battler.destination_y).abs
     self.opacity = [255 - ([(d1 + d2) / 2, (d3 + d4) / 2].min * 5).to_i, 0].max if @phasing

     # Calculate Difference
     difference_x = (@battler.display_x - @battler.destination_x).abs
     difference_y = (@battler.display_y - @battler.destination_y).abs
     
     # Move Back
     if [difference_x, difference_y].max.between?(0, 5) and !@attacked
       @battler.destination_x = @battler.original_x
       @battler.destination_y = @battler.original_y
       @battler.original_x = @battler.display_x
       @battler.original_y = @battler.display_y
       @battler.moving = false
       @attacked = true
       @pose = @default
       return
     end

     # Done? Reset, Stop
     if [difference_x, difference_y].max.between?(0, 5)
       @battler.moving = false
       @attacked = false
       @pose = @default
       return
     end
     
     # Movement Patterns
     if difference_x > difference_y
       increment_x = 1
       increment_y = difference_y <= 2 ? difference_y / 8 : 1 / (difference_x / difference_y) + 0.5
     elsif difference_y > difference_x
       increment_y = 1
       increment_x = difference_x <= 2 ? difference_x / 8 : 1 / (difference_y / difference_x) + 0.5
     else
       increment_x = 1
       increment_y = 1
     end
     incriment_x = (increment_x * 8).to_i
     incriment_y = (increment_y * 8).to_i
     @battler.display_x += incriment_x * (@battler.destination_x - @battler.display_x > 0 ? 1 : -1)
     @battler.display_y += incriment_y * (@battler.destination_y - @battler.display_y > 0 ? 1 : -1)
   end    
   @last_move_time = time
 end
 
 def collapse
   @default = 2
 end
end

#==============================================================================
# ? Game_Battler
#==============================================================================

class Game_Battler
 #--------------------------------------------------------------------------
 # ? Animation Variables
 #--------------------------------------------------------------------------
 attr_accessor :moving # Moving?
 attr_accessor :display_x # Current X
 attr_accessor :display_y # Current Y
 attr_accessor :original_x # Original X
 attr_accessor :original_y # Orginal Y
 attr_accessor :destination_x # Destination X
 attr_accessor :destination_y # Destination Y
 attr_accessor :pose # Sprite Pose
 attr_accessor :freeze # Freeze Sprite?
 attr_accessor :default # Default Pose
 attr_accessor :moved # Moved?
 attr_accessor :cast # Cast?
 #--------------------------------------------------------------------------
 # ? Set Movement
 #--------------------------------------------------------------------------
 def setmove(original_x, original_y, destination_x, destination_y)
   @original_x = original_x
   @original_y = original_y
   @destination_x = destination_x + (self.is_a?(Game_Actor) ? 40 : -40)
   @destination_y = destination_y
   @moving = true
 end
 #--------------------------------------------------------------------------
 # ? Set Pose
 #--------------------------------------------------------------------------
 def setpose(pose, freeze = false)
   @pose = pose
   @freeze = freeze
 end
 #--------------------------------------------------------------------------
 # ? Set Default Pose
 #--------------------------------------------------------------------------
 def setdefault(default)
   @default = default
 end
end

#==============================================================================
# ? Game_Actor
#==============================================================================

class Game_Actor
 #--------------------------------------------------------------------------
 # ? Actor X Coordinate
 #--------------------------------------------------------------------------
 def screen_x
   if self.index != nil
     return self.index * 45 + 450
   else
     return 0
   end
 end
 #--------------------------------------------------------------------------
 # ? Actor Y Coordinate
 #--------------------------------------------------------------------------
 def screen_y
   return self.index * 35 + 200
 end
 #--------------------------------------------------------------------------
 # ? Actor Z Coordinate
 #--------------------------------------------------------------------------
 def screen_z
   return screen_y
 end
end

#==============================================================================
# ? Scene_Battle
#==============================================================================

class Scene_Battle
 #--------------------------------------------------------------------------
 # ? Change Arrow Viewport
 #--------------------------------------------------------------------------
 alias cbs_start_enemy_select start_enemy_select
 def start_enemy_select
   cbs_start_enemy_select
   @enemy_arrow.dispose
   @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
 end
 #--------------------------------------------------------------------------
 # ? Action Animation, Movement
 #--------------------------------------------------------------------------
 alias cbs_update_phase4_step3 update_phase4_step3
 def update_phase4_step3(battler)
   return if battler.moving
   battler.setdefault(0)
   case battler.current_action.kind
   when 0 # Basic
     if battler.moved
       battler.setpose(6 + rand(2))
     elsif battler.guarding?
       battler.setdefault(3)
     else
       for target in battler.target
         battler.setmove(battler.screen_x, battler.screen_y, target.screen_x, target.screen_y)
       end
       battler.moved = true
       return
     end
   when 1 # Skill
     battler.setpose(8)
     for target in battler.target
       battler.cast = (battler.is_a?(Game_Actor) == target.is_a?(Game_Enemy))
     end
   when 2 # Item
     battler.setpose(8)
   end
   cbs_update_phase4_step3(battler)
 end
 #--------------------------------------------------------------------------
 # ? Hit Animation, Reset
 #--------------------------------------------------------------------------
 alias cbs_update_phase4_step4 update_phase4_step4
 def update_phase4_step4(battler)
   for target in battler.target
     target.setpose(1) if (battler.moved or battler.cast) and target.damage != "Miss"
   end
   if battler.moved
     battler.moving = true
   end
   battler.moved = false
   battler.cast = false
   cbs_update_phase4_step4(battler)
 end
 #--------------------------------------------------------------------------
 # ? Victory Animation
 #--------------------------------------------------------------------------
 alias cbs_start_phase5 start_phase5
 def start_phase5
   for actor in $game_party.actors
     return if actor.moving
   end
   for actor in $game_party.actors
     actor.setpose(9, true) unless actor.dead?
   end
   cbs_start_phase5
 end
end

#==============================================================================
# ? Spriteset_Battle
#==============================================================================

class Spriteset_Battle
 #--------------------------------------------------------------------------
 # ? Change Enemy Viewport
 #--------------------------------------------------------------------------
 alias cbs_initialize initialize
 def initialize
   cbs_initialize
   @enemy_sprites = []
   for enemy in $game_troop.enemies.reverse
     @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
   end
 end
end

#==============================================================================
# ? Arrow_Base
#==============================================================================

class Arrow_Base < Sprite
 #--------------------------------------------------------------------------
 # ? Reposition Arrows
 #--------------------------------------------------------------------------
 alias cbs_initialize initialize
 def initialize(viewport)
   cbs_initialize(viewport)
   self.ox = 32
   self.oy = 40
 end
end


Display Script

#==============================================================================
# ? Window_BattleStatus
#------------------------------------------------------------------------------
# English Patch, Pretty HP/MP Bars, Actor Faces, Individual Windows
#==============================================================================

class Window_BattleStatus < Window_Base
 #--------------------------------------------------------------------------
 # ? Initialize
 #--------------------------------------------------------------------------
 def initialize
   super(0, 320, 480, 160)
   self.opacity = 0
   @windows = []
   @faces = []
   for i in 0...$game_party.actors.size
     @windows[i] = Window_ActorStatus.new(i, i * 160)
     @faces[i] = Sprite.new(viewport)
     @faces[i].bitmap = RPG::Cache.picture("Face" + $game_party.actors[i].id.to_s + ".png")
     @faces[i].x = x + i * 160
     @faces[i].y = 320
   end
   @level_up_flags = [false, false, false, false]
   refresh
 end
 #--------------------------------------------------------------------------
 # ? Update
 #--------------------------------------------------------------------------
 def update
   super
   for window in @windows
     window.update
   end
 end
 #--------------------------------------------------------------------------
 # ? Dispose
 #--------------------------------------------------------------------------
 def dispose
   for i in 0...$game_party.actors.size
     @windows[i].dispose
     @faces[i].dispose
   end
   super
 end
 #--------------------------------------------------------------------------
 # ? Refresh
 #--------------------------------------------------------------------------
 def refresh(number = 0)
   if number == 0
     count = 0
     for window in @windows
       window.refresh(@level_up_flags[count])
       count += 1
     end
   else
     @windows[number - 1].refresh(@level_up_flags[number - 1])
   end
 end
 #--------------------------------------------------------------------------
 # ? AT Refresh
 #--------------------------------------------------------------------------
 def at_refresh(number = 0)
   if number == 0
     for window in @windows
       window.at_refresh
     end
   else
     @windows[number - 1].at_refresh
   end
 end
end

#==============================================================================
# ? Window_ActorStatus
#==============================================================================

class Window_ActorStatus < Window_Base
 #--------------------------------------------------------------------------
 # ? Initialize
 #--------------------------------------------------------------------------
 def initialize(id, x)
   @id = id
   super(x, 320, 160, 160)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.back_opacity = 160
   actor  = $game_party.actors[@id]
   @name = actor.name
   @maxhp = actor.maxhp
   @maxsp = actor.maxsp
   @hp = actor.hp
   @sp = actor.sp
   @state = make_battler_state_text(actor, 120, true)
   @windows = []
   for i in 0...5
     @windows.push(Window_DetailsStatus.new(actor, i, x))
   end
   refresh(false)
 end
 #--------------------------------------------------------------------------
 # ? Update
 #--------------------------------------------------------------------------
 def update
   for window in @windows
     window.update
   end
 end
 #--------------------------------------------------------------------------
 # ? Dispose
 #--------------------------------------------------------------------------
 def dispose
   for window in @windows
     window.dispose
   end
   super
 end
 #--------------------------------------------------------------------------
 # ? Refresh
 #--------------------------------------------------------------------------
 def refresh(level_up_flags)
   self.contents.clear
   actor = $game_party.actors[@id]
   @windows[0].refresh(actor) if @name != actor.name
   @windows[1].refresh(actor) if @maxhp != actor.maxhp or @hp != actor.hp
   @windows[2].refresh(actor) if @maxsp != actor.maxsp or @sp != actor.sp
   @windows[3].refresh(actor, level_up_flags) if
     (@state != make_battler_state_text(actor, 120, true) or level_up_flags)
   @name = actor.name
   @maxhp = actor.maxhp
   @maxsp = actor.maxsp
   @hp = actor.hp
   @sp = actor.sp
   @state = make_battler_state_text(actor, 120, true)
 end
 #--------------------------------------------------------------------------
 # ? AT Refresh
 #--------------------------------------------------------------------------
 def at_refresh
   @windows[4].refresh($game_party.actors[@id])
 end
end

#==============================================================================
# ? Window_DetailsStatus
#==============================================================================

class Window_DetailsStatus < Window_Base
 #--------------------------------------------------------------------------
 # ? Initialize
 #--------------------------------------------------------------------------
 def initialize(actor, id, x)
   @status_id = id
   super(x, 320 + id * 26, 160, 64)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface
   self.contents.font.size = $fontsize
   self.opacity = 0
   self.back_opacity = 0
   refresh(actor, false)
 end
 #--------------------------------------------------------------------------
 # ? Refresh
 #--------------------------------------------------------------------------
 def refresh(actor, level_up_flags = false)
   self.contents.clear
   case @status_id
   when 0
     draw_actor_name(actor, 4, 0)
   when 1
     draw_actor_hp(actor, 4, 4, 120)
   when 2
     draw_actor_sp(actor, 4, 4, 120)
   when 3
     if level_up_flags
       self.contents.font.color = normal_color
       self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
     else
       draw_actor_state(actor, 4, 0)
     end
   when 4
     draw_actor_atg(actor, 4, 0, 120)
   end
 end
end

#==============================================================================
# ? Window_Base
#==============================================================================

class Window_Base
 #--------------------------------------------------------------------------
 # ? Draw Actor HP Meter
 #--------------------------------------------------------------------------
 alias cbs_draw_actor_hp draw_actor_hp
 def draw_actor_hp(actor, x, y, width = 146, height = 15)
   bg = Color.new(  0,   0,   0, 160)
   c1 = Color.new(255,   0,   0, 0)
   c2 = Color.new(255, 255,   0, 160)
   self.contents.fill_rect(x, y, width, height, bg)
   width2 = width * actor.hp / actor.maxhp
   gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
   cbs_draw_actor_hp(actor, x, y, width)
 end
 #--------------------------------------------------------------------------
 # ? Draw Actor SP Meter
 #--------------------------------------------------------------------------
 alias cbs_draw_actor_sp draw_actor_sp
 def draw_actor_sp(actor, x, y, width = 146, height = 15)
   bg = Color.new(  0,   0,   0, 160)
   c1 = Color.new(  0,   0, 255, 0)
   c2 = Color.new(  0, 255, 255, 160)
   self.contents.fill_rect(x, y, width, height, bg)
   width2 = width * actor.sp / actor.maxsp
   gradient(x + 1, y + 1, width2 - 2, height - 2, c1, c2)
   cbs_draw_actor_sp(actor, x, y, width)
 end
 #--------------------------------------------------------------------------
 # ? Draw Gradient
 #--------------------------------------------------------------------------
 def gradient(x, y, width, height, c1, c2)
   for i in 1..width
     x2 = x + i - 1
     r = c1.red * (width - i) / width + c2.red * i / width
     g = c1.green * (width - i) / width + c2.green * i / width
     b = c1.blue * (width - i) / width + c2.blue * i / width
     a = c1.alpha * (width - i) / width + c2.alpha * i / width
     self.contents.fill_rect(x2, y, 1, height, Color.new(r, g, b, a))
   end
 end
 #--------------------------------------------------------------------------
 # ? Make State Text
 #--------------------------------------------------------------------------
 def make_battler_state_text(battler, width, need_normal)
   brackets_width = self.contents.text_size("Status: ").width
   text = ""
   for i in battler.states
     if $data_states[i].rating >= 1
       if text == ""
         text = $data_states[i].name
       else
         new_text = text + "/" + $data_states[i].name
         text_width = self.contents.text_size(new_text).width
         if text_width > width - brackets_width
           break
         end
         text = new_text
       end
     end
   end
   if text == ""
     if need_normal
       text = "Status: Normal"
     end
   else
     text = "Status: " + text
   end
   return text
 end
end


Thanks.

ahref

thats a cool sideview battle system shame theres no way to make the battelers bigger.

anyway sorry i cant help with the the problem ive had a look but no idea :)

l[i(Fury)i]l

np, can anyone help me with this?

blueXx

try opening the monster sets in paint , mark them entirely and use the "flip horizonical" option, it will make you a charset that face the other direction and it might just work...

for the rest i am too lazy to even try , but it's not that hard if say you will make the windows of the chars exist only without their stats, it won't look great but it will look better...
i am sure tsu can do it in 5 minutes.. i am too lazy to give it a shot ~.~
(it might take me like 2 hours lol)
holy shit my sig was big!

Neko

I think thats the same.. I did it with a character and just walked as him hoping he would moon walk like micheal jackson, but he did the exact same thing =\
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd

blueXx

maybe you aren't very good using paint? ~.~

import this guy and watch the magic

holy shit my sig was big!

Neko

No, I realizeed You have to start a new game for it to take effect. I was using my saved game and he wolked normal.. I now can Laugh at micheal jackson.. Muhahaha
QuoteZxmelee says: I FUCKED A CHICK GEEZ
Neko says: I doubt it was a girl
Neko says: Was "she" working the corners?
Zxmelee says: Well, I was lying...
Zxmelee says: but, oh man. They were all over me
Neko says: With a few bucks
Neko says: That hapens
Pwnzorz'd