public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Need Help With Script

BMM_Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Need Help With Script
  • Original author: shadow7396
  • Original date: July 6, 2015
  • Source thread: https://forums.rpgmakerweb.com/threads/need-help-with-script.41981/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSSx Script Support

Summary

Hey Guys, I need help! I have a script Called KHAS Awesome Light Effect that im having trouble with! Here is The script: Spoiler #------------------------------------------------------------------------------- # * [ACE] Khas Awesome Light Effects

Archived First Post

Hey Guys, I need help! I have a script Called KHAS Awesome Light Effect that im having trouble with! Here is The script:

#-------------------------------------------------------------------------------
# * [ACE] Khas Awesome Light Effects
#-------------------------------------------------------------------------------
# * By Khas Arcthunder - arcthunder.site40.net
# * Version: 1.0 EN
# * Released on: 17/01/2012
#
#-------------------------------------------------------------------------------
# * Terms of Use
#-------------------------------------------------------------------------------
# When using any Khas script, you agree with the following terms:
# 1. You must give credit to Khas;
# 2. All Khas scripts are licensed under a Creative Commons license;
# 3. All Khas scripts are for non-commercial projects. If you need some script
# for your commercial project (I accept requests for this type of project),
# send an email to nilokruch@live.com with your request;
# 4. All Khas scripts are for personal use, you can use or edit for your own
# project, but you are not allowed to post any modified version;
# 5. You can’t give credit to yourself for posting any Khas script;
# 6. If you want to share a Khas script, don’t post the direct download link,
# please redirect the user to arcthunder.site40.net
#
#-------------------------------------------------------------------------------
# * Features
#-------------------------------------------------------------------------------
# - Realistic Light
# - Light does not pass over walls, blocks and roofs
# - Static Light Sources
# - Dynamic Light Sources (like a player's lantern)
# - Multiple effects
# - Easy to use (comments)
#
#-------------------------------------------------------------------------------
# * WARNING - Performance
#-------------------------------------------------------------------------------
# This script may be too heavy to old processors! The Awesome Light Effects was
# tested on a Core 2 Duo E4500 and on a Core i5, without any lag. However,
# there's other factors that may influence the script performance:
#
# 1. Map size
# This script searches surfaces on the map, in order to cut the light pictures.
# In a huge map, the number of surfaces may increase a lot, affecting the
# DYNAMIC LIGHT SOURCE only. Map size does not influence the static sources.
#
# 2. Number of effects
# This script draws the effects on the screen, but before drawing, it checks
# if the effect is out of screen (in this case, the script will skip the
# light drawing). Too much effects may cause lag, but this is just a prevision.
#
# 3. Effect's picture size
# The picture size of the DYNAMIC LIGHT SOURCE influences directly on your
# game's performace. The bigger is the picture, the slower it will be to
# draw it dynamically. The recommended maximum size is 200x200 pixels
#
#-------------------------------------------------------------------------------
# * WARNING - Light pictures
#-------------------------------------------------------------------------------
# In order to run this script correctly, the light pictures MUST obey the
# following conditions:
# 1. The picture's size MUST be multiple of 2. Example: 150x150
# 2. The picture's width MUST be equal to it's height. Example: 156x156
# 3. The picture's colors MUST be inverted! This is necessary because
# the script inverts the colors to draw the effect. The black color
# will be transparent!
#
#-------------------------------------------------------------------------------
# * Instructions - 1. Setup your effects!
#-------------------------------------------------------------------------------
# In order to setup your static effects, go to the setup part and define your
# effects inside the Effects hash. Do as the following mode:
#
# X => [picture,opacity,variation,cut], <= Remember to put a comma here!
#
# Where:
# picture => Picture's name, inside the Graphics/Lights folder;
# opacity => Effect's opacity;
# variation => Effect's opacity variation;
# cut => Put true to cut the effect or false to don't;
# X => The effect's ID, it will be used on events.
#
# Check the default effects to understand how they work.
#
#-------------------------------------------------------------------------------
# * Instructions - 2. Use your effects!
#-------------------------------------------------------------------------------
# In order to use a effect, put the following comment on a event:
#
# [light x]
#
# Where x must be the Effect's ID.
#
#-------------------------------------------------------------------------------
# * Instructions - 3. Use an awesome lantern!
#-------------------------------------------------------------------------------
# The dynamic light source (lantern) is initialized invisible by default.
# You may call the following commands:
#
# l = $game_map.lantern
# Gets the lantern into a variable

# l.set_graphic(i)
# Sets the lantern's graphic to i, where i must be the picture's file name on
# Graphics/Lights folder.
#
# l.set_multiple_graphics(h)
# Sets the lantern's graphics to h, where h must be a hash with the following
# structure:
#
# h = {2=>"ld",4=>"ll",6=>"lr",8=>"lu"}
#
# Where:
# "ld" is the name of the picture when the lantern's owner is looking down;
# "ll" is the name of the picture when the lantern's owner is looking left;
# "lr" is the name of the picture when the lantern's owner is looking right;
# "lu" is the name of the picture when the lantern's owner is looking up.
#
# l.change_owner(char)
# Sets the lantern's owner to char. Char must be ONE of the following commands:
# $game_player <= The player itself;
# self_event <= The event where the command was called;
# $game_map.events[x] <= The event ID x.
#
# l.set_opacity(o,p)
# Sets the lantern's opacity, where:
# o is the opacity itself;
# p is the opacity variation.
#
# l.show
# After setting the lantern with the commands above, you may set it to visible
# using this command.
#
# l.hide
# Use this command to set the lantern as invisible.
#
#-------------------------------------------------------------------------------
# * Instructions - 4. Use the effect's surface!
#-------------------------------------------------------------------------------
# The Awesome Light Effects draws the effects on a surface. In order to make
# the effects visible, the effect's surface MUST be visible. The Effect's
# Surface is initialized with it's opacity set to zero. You can call the
# following commands:
#
# s = $game_map.effect_surface
# Gets the Effect's Surface into a variable
#
# s.set_color(r,g,
# Changes the Effect's Surface color instantly, where:
# r => red level;
# g => green level;
# b => blue level;
#
# s.set_alpha(a)
# Changes the Effect's Surface opacity instantly to a.
#
# s.change_color(time,r,g,
# Changes the Effect's Surface color ONLY in a certain time, where:
# time => The change's time (frames);
# r => red level;
# g => green level;
# b => blue level;
#
# s.change_color(time,r,g,b,a)
# Changes the Effect's Surface color and it's opacity in a certain time, where:
# time => The change's time (frames);
# r => red level;
# g => green level;
# b => blue level;
# a => opacity
#
# s.change_alpha(time,a)
# Changes the Effect's Surface opacity in a certain time, where:
# time => The change's time (frames);
# a => opacity
#
#-------------------------------------------------------------------------------
# * Instructions - 5. Use the effect's surface with Tone command!
#-------------------------------------------------------------------------------
# You can access the Effect's Surface with the "Screen Tone" command. In order
# to turn this feature on, set the "Surface_UE" constant to true.
#
# If you decided to use this feature, please note some details:
# 1. The colors values must be between 0 and 255;
# 2. The time is in frames;
# 3. The "gray" value will be sent as the opacity value
#
#-------------------------------------------------------------------------------
# * Instructions - 6. Setup your Tileset Tags!
#-------------------------------------------------------------------------------
# In order to cut the effect's picture correctly, there's 3 types of behavior
# for a tile: wall, block and roof. Walls will make shadows as real walls,
# blocks as blocks and roofs as roofs. So, the tileset tags MUST be configured.
# Check the demo to understand how this system works. If the tilesets aren't
# configured correctly, the script won't cut the effects correctly.
#
#-------------------------------------------------------------------------------
# * Setup Part
#-------------------------------------------------------------------------------
module Light_Core
Effects = { # <= DON'T change this!
#-------------------------------------------------------------------------------
# PUT YOUR EFFECTS HERE!
#-------------------------------------------------------------------------------
0 => ["light",255,0,true],
1 => ["torch",200,20,true],
2 => ["torch_m",180,30,true],
3 => ["light_s",255,0,true],

#-------------------------------------------------------------------------------
# End of effecs configuration
#-------------------------------------------------------------------------------
} # <= DON'T change this!

# Z coordinate of the Effect's Surface
Surface_Z = 180

# Enable Effect's Surface control by "Screen Tone" command?
Surface_UE = true

# Roof behavior tag
Roof_Tag = 5
# Wall behavior tag
Wall_Tag = 6
# Block behavior tag
Block_Tag = 7

# Don't change this!
ACC = Math.tan(Math:I/26)
end
#-------------------------------------------------------------------------------
# Script
#-------------------------------------------------------------------------------
module Cache
def self.light(filename)
load_bitmap("Graphics/Lights/", filename)
end
end
module Light_Bitcore
include Light_Core
def self.initialize
@@buffer = {}
Effects.values.each { |effect| Light_Bitcore.push(effect[0])}
end
def self::[](key)
return @@buffer[key]
end
def self.push(key)
return if @@buffer.keys.include?(key)
@@buffer[key] = Cache.light(key)
end
end
Light_Bitcore.initialize
class Light_SSource
attr_reader :real_x
attr_reader :real_y
attr_reader :range
attr_accessor :bitmap
attr_reader :w
attr_reader :h
attr_reader :hs
def initialize(char,bitmap,opacity,plus,hs)
sync(char)
@key = bitmap
@bitmap = Light_Bitcore[@key].clone
@range = @bitmap.width/2
@w = @bitmap.width
@h = @bitmap.height
@mr = @range - 16
@opacity = opacity
@plus = plus
@hs = hs
render if @hs
end
def render
tx = x
ty = y
tsx = x + @range
tsy = y + @range
dr = @range*2
for s in $game_map.surfaces
next if !s.visible?(tsx,tsy) || !s.within?(tx,tx+dr,ty,ty+dr)
s.render_shadow(tx,ty,tsx,tsy,@range,@bitmap)
end
end
def restore
return unless @bitmap.nil?
@bitmap = Light_Bitcore[@key].clone
render if @hs
end
def opacity
@plus == 0 ? @opacity : (@opacity + rand(@plus))
end
def sx
return $game_map.adjust_x(@real_x)*32-@mr
end
def sy
return $game_map.adjust_y(@real_y)*32-@mr
end
def sync(char)
@real_x = char.real_x
@real_y = char.real_y
end
def x
return (@real_x*32 - @mr).to_f
end
def y
return (@real_y*32 - @mr).to_f
end
def dispose
return if @bitmap.nil?
@bitmap.dispose
@bitmap = nil
end
end
class Light_DSource < Light_SSource
attr_reader :bitmap
attr_reader :visible
def initialize
@key = nil
@bitmap = nil
@opacity = 255
@plus = 0
@char = $game_player
@visible = false
end
def set_opacity(o,p)
@opacity = o
@plus = p
end
def set_graphic(sb)
dispose
@key = {2=>sb,4=>sb,6=>sb,8=>sb}
Light_Bitcore.push(sb)
@bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
@range = @bitmap[2].width/2
@w = @bitmap[2].width
@h = @bitmap[2].height
@mr = @range - 16
end
def set_multiple_graphics(ba)
dispose
@key = ba
@key.values.each {|key| Light_Bitcore.push(key)}
@bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
@range = @bitmap[2].width/2
@w = @bitmap[2].width
@h = @bitmap[2].height
@mr = @range - 16
end
def get_graphic
return @bitmap[@char.direction].clone
end
def show
return if @bitmap.nil?
@visible = true
end
def hide
@visible = false
end
def restore
return if @key.nil?
@key.values.each {|key| Light_Bitcore.push(key)}
@bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
end
def dispose
return if @bitmap.nil?
@bitmap.values.each { |b| b.dispose }
@bitmap = nil
end
def change_owner(char)
@char = char
end
def render
end
def sx
return $game_map.adjust_x(@char.real_x)*32-@mr
end
def sy
return $game_map.adjust_y(@char.real_y)*32-@mr
end
def x
return (@char.real_x*32 - @mr).to_f
end
def y
return (@char.real_y*32 - @mr).to_f
end
end
class Light_Surface
def initialize
@ta = @a = 0
@tr = @r = 255
@tg = @g = 255
@tb = @b = 255
@va = @vr = @vg = @vb = 0.0
@timer = 0
end
def refresh
return if @timer == 0
@a += @va
@r += @vr
@g += @vg
@b += @vb
$game_map.light_surface.opacity = @a
@timer -= 1
end
def change_color(time,r,g,b,a=nil)
r = 0 if r < 0; r = 255 if r > 255
g = 0 if g < 0; g = 255 if g > 255
b = 0 if b < 0; b = 255 if b > 255
unless a.nil?
a = 0 if a < 0; a = 255 if a > 255
end
@timer = time
@tr = 255-r
@tg = 255-g
@tb = 255-b
@va = (a.nil? ? 0 : (a-@a).to_f/@timer)
@vr = (@tr - @r).to_f/@timer
@vg = (@tg - @g).to_f/@timer
@vb = (@tb - @ .to_f/@timer
end
def change_alpha(time,a)
a = 0 if a < 0; a = 255 if a > 255
@timer = time
@ta = a
@vr = @vg = @vb = 0.0
@va = (a-@a).to_f/@timer
end
def set_color(r,g,
r = 0 if r < 0; r = 255 if r > 255
g = 0 if g < 0; g = 255 if g > 255
b = 0 if b < 0; b = 255 if b > 255
@tr = @r = 255-r
@tg = @g = 255-g
@tb = @b = 255-b
@va = @vr = @vg = @vb = 0.0
@timer = 0
end
def set_alpha(a)
a = 0 if a < 0; a = 255 if a > 255
@ta = @a = a
$game_map.light_surface.opacity = @a
@va = @vr = @vg = @vb = 0.0
@timer = 0
end
def alpha
return @a
end
def color
return Color.new(@r,@g,@
end
end
class Game_Map
include Light_Core
attr_accessor :light_surface
attr_accessor :light_sources
attr_accessor :surfaces
attr_accessor :effect_surface
attr_accessor :lantern
alias kbl_setup_events setup_events
alias kbl_initialize initialize
alias kbl_update update
def initialize
kbl_initialize
@effect_surface = Light_Surface.new
@lantern = Light_DSource.new
end
def update(arg)
@effect_surface.refresh if arg
kbl_update(arg)
end
def first_tag(x,y)
tag = tileset.flags[tile_id(x,y,0)] >> 12
return tag > 0 ? tag : 0
end
def setup_events
@light_sources.nil? ? @light_sources = [] : @light_sources.clear
setup_surfaces
merge_surfaces
kbl_setup_events
end
def setup_surfaces
@surfaces = []
for x in 0..(width-1)
for y in 0..(height-1)
tag = first_tag(x,y)
if tag == Wall_Tag
i = tile_id(x,y,0)
if i & 0x02 == 0x02
@surfaces << Block_SD.new(x*32,y*32,x*32+32,y*32)
end
if i & 0x04 == 0x04
@surfaces << Block_WR.new(x*32+31,y*32,x*32+31,y*32+32)
@surfaces << Block_IL.new(x*32+32,y*32,x*32+32,y*32+32)
end
if i & 0x01 == 0x01
@surfaces << Block_IR.new(x*32-1,y*32,x*32-1,y*32+32)
@surfaces << Block_WL.new(x*32,y*32,x*32,y*32+32)
end
elsif tag == Roof_Tag
i = tile_id(x,y,0)
@surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if i & 0x02 == 0x02
@surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if i & 0x04 == 0x04
@surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if i & 0x01 == 0x01
elsif tag == Block_Tag
f = tileset.flags[tile_id(x,y,0)]
@surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if f & 0x02 == 0x02
@surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if f & 0x04 == 0x04
@surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if f & 0x08 == 0x08
end
end
end
end
def merge_surfaces
new_surfaces = []
hs = []; vs = []
ws = []; is = []
for surface in @surfaces
if surface.type & 0x05 == 0
hs << surface
else
if surface.type & 0x010 == 0
vs << surface
else
if surface.type & 0x08 == 0
ws << surface
else
is << surface
end
end
end
end
for surface in hs
surface.ready ? next : surface.ready = true
for s in hs
next if s.ready || s.y1 != surface.y1 || surface.type != s.type
if s.x2 == surface.x1
surface.x1 = s.x1
s.trash = true
s.ready = true
surface.ready = false
elsif s.x1 == surface.x2
surface.x2 = s.x2
s.trash = true
s.ready = true
surface.ready = false
end
end
end
hs.each { |s| @surfaces.delete(s) if s.trash}
for surface in vs
surface.ready ? next : surface.ready
for s in vs
next if s.ready || s.x1 != surface.x1
if s.y2 == surface.y1
surface.y1 = s.y1
s.trash = true
s.ready = true
surface.ready = false
elsif s.y1 == surface.y2
surface.y2 = s.y2
s.trash = true
s.ready = true
surface.ready = false
end
end
end
vs.each { |s| @surfaces.delete(s) if s.trash}
for surface in ws
surface.ready ? next : surface.ready
for s in ws
next if s.ready || s.x1 != surface.x1
if s.y2 == surface.y1
surface.y1 = s.y1
s.trash = true
s.ready = true
surface.ready = false
elsif s.y1 == surface.y2
surface.y2 = s.y2
s.trash = true
s.ready = true
surface.ready = false
end
end
end
ws.each { |s| @surfaces.delete(s) if s.trash}
for surface in is
surface.ready ? next : surface.ready
for s in is
next if s.ready || s.x1 != surface.x1
if s.y2 == surface.y1
surface.y1 = s.y1
s.trash = true
s.ready = true
surface.ready = false
elsif s.y1 == surface.y2
surface.y2 = s.y2
s.trash = true
s.ready = true
surface.ready = false
end
end
end
is.each { |s| @surfaces.delete(s) if s.trash}
end
end
class Game_Event < Game_Character
alias kbl_initialize initialize
alias kbl_setup_page setup_page
def initialize(m,e)
@light = nil
kbl_initialize(m,e)
end
def setup_page(np)
kbl_setup_page(np)
setup_light(np.nil?)
end
def setup_light(dispose)
unless @light.nil?
$game_map.light_sources.delete(self)
@light.dispose
@light = nil
end
unless dispose && @list.nil?
for command in @list
if command.code == 108 && command.parameters[0].include?("[light")
command.parameters[0].scan(/\[light ([0.0-9.9]+)\]/)
effect = Light_Core::Effects[$1.to_i]
@light = Light_SSource.new(self,effect[0],effect[1],effect[2],effect[3])
$game_map.light_sources << self
return
end
end
end
end
def draw_light
sx = @light.sx
sy = @light.sy
w = @light.w
h = @light.h
return if sx > 544 && sy > 416 && sx + w < 0 && sy + h < 0
$game_map.light_surface.bitmap.blt(sx,sy,@light.bitmap,Rect.new(0,0,w,h),@light.opacity)
end
def dispose_light
@light.dispose
end
def restore_light
@light.restore
end
end
if Light_Core::Surface_UE
class Game_Interpreter
def command_223
$game_map.effect_surface.change_color(@params[1],@params[0].red,@params[0].green,@params[0].blue,@params[0].gray)
wait(@params[1]) if @params[2]
end
end
end
class Game_Interpreter
def self_event
return $game_map.events[@event_id]
end
end
class Block_Surface
include Light_Core
attr_accessor :x1
attr_accessor :y1
attr_accessor :x2
attr_accessor :y2
attr_accessor :ready
attr_accessor :trash
def initialize(x1,y1,x2,y2)
@x1 = x1
@y1 = y1
@x2 = x2
@y2 = y2
@ready = false
@trash = false
end
def within?(min_x,max_x,min_y,max_y)
return @x2 > min_x && @x1 < max_x && @y2 > min_y && @y1 < max_y
end
end
class Block_SL < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x01
end
def visible?(sx,sy)
return sx < @x1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = sy - @m1*sx
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
for x in @x1..(sx+range)
init = shadow_iy(x)
bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_SR < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x04
end
def visible?(sx,sy)
return sx > @x1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = sy - @m1*sx
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
for x in (sx-range).to_i..@x1
init = shadow_iy(x)
bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_IL < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x019
end
def visible?(sx,sy)
return sx < @x1 && sy > @y1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = @y1 - @m1*@x1
@m2 = (@y2-sy)/(@x2-sx)
@m2 = 0 if @m2 > 0
@n2 = @y2 - @m2*@x2
for x in @x1..(sx+range)
init = shadow_iy(x).floor
bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_IR < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x01c
end
def visible?(sx,sy)
return sx > @x1 && sy > @y1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = @y1 - @m1*@x1
@m2 = (@y2-sy)/(@x2-sx)
@m2 = 0 if @m2 < 0
@n2 = @y2 - @m2*@x2
for x in (sx-range).to_i..@x1
init = shadow_iy(x).floor
bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_WL < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x011
end
def visible?(sx,sy)
return sx < @x1 && sy < @y2
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = sy - @m1*sx
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
for x in @x1..(sx+range)
init = shadow_iy(x)
bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_WR < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x014
end
def visible?(sx,sy)
return sx > @x1 && sy < @y2
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
@m1 = (@y1-sy)/(@x1-sx)
@n1 = sy - @m1*sx
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
for x in (sx-range).to_i..@x1
init = shadow_iy(x)
bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
end
end
def shadow_iy(x)
return @m1*x+@n1
end
def shadow_fy(x)
return @m2*x+@n2
end
end
class Block_SU < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x02
end
def visible?(sx,sy)
return sy < @y1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
if @x1 == sx
@m1 = nil
else
@m1 = (@y1-sy)/(@x1-sx)
@m1 += ACC if @m1 < -ACC
@n1 = @y1 - @m1*@x1
end
if @x2 == sx
@m2 = nil
else
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
end
for y in @y1..(sy+range)
init = shadow_ix(y)
bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
end
end
def shadow_ix(y)
return @m1.nil? ? @x1 : (y-@n1)/@m1
end
def shadow_fx(y)
return @m2.nil? ? @x2 : (y-@n2)/@m2
end
end
class Block_SD < Block_Surface
attr_reader :type
def initialize(x1,y1,x2,y2)
super(x1,y1,x2,y2)
@type = 0x08
end
def visible?(sx,sy)
return sy > @y1
end
def render_shadow(phx,phy,sx,sy,range,bitmap)
if @x1 == sx
@m1 = nil
else
@m1 = (@y1-sy)/(@x1-sx)
@m1 -= ACC if @m1 > ACC
@n1 = sy - @m1*sx
end
if x2 == sx
@m2 = nil
else
@m2 = (@y2-sy)/(@x2-sx)
@n2 = sy - @m2*sx
end
for y in (sy-range).to_i..@y1
init = shadow_ix(y)
bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
end
end
def shadow_ix(y)
return @m1.nil? ? @x1 : (y-@n1)/@m1
end
def shadow_fx(y)
return @m2.nil? ? @x2 : (y-@n2)/@m2
end
end
class Spriteset_Map
include Light_Core
alias kbl_initialize initialize
alias kbl_update update
alias kbl_dispose dispose
def initialize
setup_lights
kbl_initialize
end
def update
kbl_update
update_lights
end
def dispose
kbl_dispose
dispose_lights
end
def dispose_lights
$game_map.lantern.dispose
$game_map.light_sources.each { |source| source.dispose_light }
$game_map.light_surface.bitmap.dispose
$game_map.light_surface.dispose
$game_map.light_surface = nil
end
def update_lights
$game_map.light_surface.bitmap.clear
$game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
$game_map.light_sources.each { |source| source.draw_light }
return unless $game_map.lantern.visible
@btr = $game_map.lantern.get_graphic
x = $game_map.lantern.x
y = $game_map.lantern.y
r = $game_map.lantern.range
sx = x + r
sy = y + r
dr = r*2
$game_map.surfaces.each { |s| s.render_shadow(x,y,sx,sy,r,@btr) if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) }
$game_map.light_surface.bitmap.blt($game_map.lantern.sx,$game_map.lantern.sy,@btr,Rect.new(0,0,dr,dr),$game_map.lantern.opacity)
end
def setup_lights
@btr = nil
$game_map.lantern.restore
$game_map.light_sources.each { |source| source.restore_light }
$game_map.light_surface = Sprite.new
$game_map.light_surface.bitmap = Bitmap.new(544,416)
$game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
$game_map.light_surface.blend_type = 2
$game_map.light_surface.opacity = $game_map.effect_surface.alpha
$game_map.light_surface.z = Surface_Z
end
end
I also have some other Scripts such as:

  • DT's Autosave - http://rmrk.net/index.php?topic=46290.0
  • Yanfly's Party System - (Note: I couldn't find this script anywhere so I couldn't post a link)
    #==============================================================================
    #
    # ▼ Yanfly Engine Ace - Party System v1.08
    # -- Last Updated: 2012.01.23
    # -- Level: Normal
    # -- Requires: n/a
    #
    #==============================================================================
    $imported = {} if $imported.nil?
    $imported["YEA-PartySystem"] = true
    #==============================================================================
    # ▼ Updates
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # 2012.01.23 - Bug fixed: Party members are now rearranged when newly added.
    # 2012.01.14 - New Feature: Maximum Battle Members Variable added.
    # 2012.01.07 - Bug fixed: Error with removing members.
    # 2012.01.05 - Bug fixed: Escape skill/item effects no longer counts as death.
    # 2011.12.26 - Compatibility Update: New Game+
    # 2011.12.17 - Updated Spriteset_Battle to have updated sprite counts.
    # 2011.12.13 - Updated to provide better visual display when more than 5 pieces
    # of equipment are equipped on an actor at a time.
    # 2011.12.05 - Added functionality to display faces in the Party Select Window.
    # - Fixed bug that doesn't refresh the caterpillar when new members
    # join the party.
    # 2011.12.04 - Started Script and Finished.
    #
    #==============================================================================
    # ▼ Introduction
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # RPG Maker VX Ace comes with a very nice party system. However, changing the
    # maximum number of members isn't possible without the aid of a script. This
    # script enables you the ability to change the maximum number of party members,
    # change EXP rates, and/or open up a separate party menu (if desired). In
    # addition to that, you can lock the position of actors within a party and
    # require other actors to be in the active party before continuing.
    #
    #==============================================================================
    # ▼ Instructions
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # To install this script, open up your script editor and copy/paste this script
    # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
    #
    # -----------------------------------------------------------------------------
    # Script Calls - These commands are used with script calls.
    # -----------------------------------------------------------------------------
    # *IMPORTANT* These script calls require the new party menu to be enabled to
    # use them. Otherwise, nothing will happen.
    #
    # lock_actor(x)
    # unlock_actor(x)
    # This will lock actor x in its current position in the party if the actor is
    # in the current party. The actor is unable to switch position and must remain
    # in that position until the lock is removed. Use the unlock script call to
    # remove the locked status. This script requires the actor to have joined and
    # in the current party before the script call will work.
    #
    # require_actor(x)
    # unrequire_actor(x)
    # This will cause the party to require actor x in order to continue. If the
    # actor isn't in the current party but is in the reserve party, the party menu
    # will open up and prompt the player to add the required actor into the party
    # before being able to continue. This script call will not function unless the
    # specific actor has joined the party, whether it is in the current or reserve.
    #
    # call_party_menu
    # This will open up the party menu. This script call requires for the party
    # menu to be enabled to use.
    #
    #==============================================================================
    # ▼ Compatibility
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
    # it will run with RPG Maker VX without adjusting.
    #
    #==============================================================================
    module YEA
    module PARTY
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General Party Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # In this section, you can adjust the general party settings for your game
    # such as the maximum amount of members and whatnot, the EXP rate for
    # party members in the reserve, etc.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    MAX_BATTLE_MEMBERS = 5 # Maximum party members. Default: 4
    SPLIT_EXP = false # Splits EXP with more members in the party.
    RESERVE_EXP_RATE = 0.50 # Reserve EXP Rate. Default: 1.00
    # If you wish to be able to change the maximum number of battle members
    # during the middle of your game, set this constant to a variable ID. If
    # that variable ID is a number greater than 0, that variable will determine
    # the current maximum number of battle members. Be cautious about using
    # this during battle.
    MAX_MEMBERS_VARIABLE = 0
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Party Menu Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This section contains various menu settings for those who wish to use a
    # menu separate for the party system. Here, adjust the menu command order,
    # icons used, and other settings.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    ENABLE_MENU = true # Enables party menu. Default: false
    COMMANDS =[ # The order at which the menu items are shown.
    # [:command, "Display"],
    [ :change, "Change",],
    [ :remove, "Remove",],
    [ :revert, "Revert",],
    [ :finish, "Finish",],
    ] # Do not remove this.
    COMMAND_ALIGN = 1 # 0:Left Align, 1:Center Align, 2:Right Align
    # These settings here are used for the upper right window: the Party Select
    # window where the player selects a member to swap out or remove.
    PARTY_FONT_SIZE = 20 # Font size used for party member names.
    LOCK_FIRST_ACTOR = false # Lock the first actor by default?
    LOCKED_ICON = 125 # Icon used for locked members.
    REQUIRED_ICON = 126 # Icon used for required members.
    EMPTY_TEXT = "-Empty-" # Text used when a member isn't present.
    DISPLAY_FACE = false # Display faces instead of sprites?
    # These settings here are used for the lower left window: the Party List
    # window where the player selects a member to replace.
    REMOVE_ICON = 185 # Icon used for removing members.
    REMOVE_TEXT = "-Remove-" # Text used for remove member command.
    ACTOR_Y_BUFFER = 12 # Amount the actor graphic be adjusted by.
    # These settings here are used for the lower right window: the Party Status
    # window where info about a selected actor is shown.
    NO_DATA = "- No Data -" # Text used for when no actor is shown.
    IN_PARTY_COLOUR = 6 # Text colour used for in party members.
    STAT_FONT_SIZE = 20 # Font size used for stats.
    EQUIP_TEXT = "Equipment" # Text used to display equipment.
    end # PARTY
    end # YEA
    #==============================================================================
    # ▼ Editting anything past this point may potentially result in causing
    # computer damage, incontinence, explosion of user's head, coma, death, and/or
    # halitosis so edit at your own risk.
    #==============================================================================
    #==============================================================================
    # ■ Icon
    #==============================================================================
    module Icon
    #--------------------------------------------------------------------------
    # self.locked_party
    #--------------------------------------------------------------------------
    def self.locked_party; return YEA:ARTY::LOCKED_ICON; end
    #--------------------------------------------------------------------------
    # self.required_party
    #--------------------------------------------------------------------------
    def self.required_party; return YEA:ARTY::REQUIRED_ICON; end
    #--------------------------------------------------------------------------
    # self.remove_party
    #--------------------------------------------------------------------------
    def self.remove_party; return YEA:ARTY::REMOVE_ICON; end
    end # Icon
    #==============================================================================
    # ■ Variable
    #==============================================================================
    module Variable
    #--------------------------------------------------------------------------
    # self.max_battle_members
    #--------------------------------------------------------------------------
    def self.max_battle_members
    default = YEA:ARTY::MAX_BATTLE_MEMBERS
    return default if YEA:ARTY::MAX_MEMBERS_VARIABLE <= 0
    return default if $game_variables[YEA:ARTY::MAX_MEMBERS_VARIABLE] <= 0
    return $game_variables[YEA:ARTY::MAX_MEMBERS_VARIABLE]
    end
    end # Variable
    #==============================================================================
    # ■ Numeric
    #==============================================================================
    class Numeric
    #--------------------------------------------------------------------------
    # new method: group_digits
    #--------------------------------------------------------------------------
    unless $imported["YEA-CoreEngine"]
    def group; return self.to_s; end
    end # $imported["YEA-CoreEngine"]
    end # Numeric
    #==============================================================================
    # ■ Game_Actor
    #==============================================================================
    class Game_Actor < Game_Battler
    #--------------------------------------------------------------------------
    # public instance variables
    #--------------------------------------------------------------------------
    attr_accessor :locked
    attr_accessor :required
    #--------------------------------------------------------------------------
    # alias method: setup
    #--------------------------------------------------------------------------
    alias game_actor_setup_ps setup
    def setup(actor_id)
    game_actor_setup_ps(actor_id)
    @locked = false
    @required = false
    end
    #--------------------------------------------------------------------------
    # overwrite method: final_exp_rate
    #--------------------------------------------------------------------------
    def final_exp_rate
    n = exr * (battle_member? ? 1 : reserve_members_exp_rate)
    if $game_party.in_battle
    n /= [$game_party.battle_members.size, 1].max if YEA:ARTY::SPLIT_EXP
    end
    return n
    end
    #--------------------------------------------------------------------------
    # overwrite method: reserve_members_exp_rate
    #--------------------------------------------------------------------------
    def reserve_members_exp_rate
    $data_system.opt_extra_exp ? YEA:ARTY::RESERVE_EXP_RATE : 0
    end
    end # Game_Actor
    #==============================================================================
    # ■ Game_Party
    #==============================================================================
    class Game_Party < Game_Unit
    #--------------------------------------------------------------------------
    # public instance variables
    #--------------------------------------------------------------------------
    attr_accessor :battle_members_array
    #--------------------------------------------------------------------------
    # alias method: initialize
    #--------------------------------------------------------------------------
    alias game_party_initialize_ps initialize
    def initialize
    game_party_initialize_ps
    @battle_members_array = nil
    end
    #--------------------------------------------------------------------------
    # overwrite method: max_battle_members
    #--------------------------------------------------------------------------
    def max_battle_members; return Variable.max_battle_members; end
    #--------------------------------------------------------------------------
    # alias method: setup_starting_members
    #--------------------------------------------------------------------------
    alias setup_starting_members_ps setup_starting_members
    def setup_starting_members
    setup_starting_members_ps
    initialize_battle_members
    return unless YEA:ARTY::LOCK_FIRST_ACTOR
    return if members[0].nil?
    members[0].locked = true
    end
    #--------------------------------------------------------------------------
    # alias method: setup_battle_test_members
    #--------------------------------------------------------------------------
    alias setup_battle_test_members_ps setup_battle_test_members
    def setup_battle_test_members
    setup_battle_test_members_ps
    return unless YEA:ARTY::LOCK_FIRST_ACTOR
    return if members[0].nil?
    members[0].locked = true
    end
    #--------------------------------------------------------------------------
    # overwrite method: battle_members
    #--------------------------------------------------------------------------
    def battle_members
    initialize_battle_members if initialize_battle_members?
    array = []
    for actor_id in @battle_members_array
    break if array.size > max_battle_members
    next if actor_id.nil?
    next if $game_actors[actor_id].nil?
    next unless $game_actors[actor_id].exist?
    array.push($game_actors[actor_id])
    end
    return array
    end
    #--------------------------------------------------------------------------
    # new method: initialize_battle_members?
    #--------------------------------------------------------------------------
    def initialize_battle_members?
    return true if @battle_members_array.nil?
    return @battle_members_array.size != max_battle_members
    end
    #--------------------------------------------------------------------------
    # new method: initialize_battle_members
    #--------------------------------------------------------------------------
    def initialize_battle_members
    @battle_members_array = []
    for i in 0...max_battle_members
    @battle_members_array.push(@actors) unless @actors.nil?
    @battle_members_array.push(0) if @actors.nil?
    end
    $game_player.refresh
    end
    #--------------------------------------------------------------------------
    # alias method: add_actor
    #--------------------------------------------------------------------------
    alias game_party_add_actor_ps add_actor
    def add_actor(actor_id)
    game_party_add_actor_ps(actor_id)
    return if @battle_members_array.include?(actor_id)
    return unless @battle_members_array.include?(0)
    index = @battle_members_array.index(0)
    @battle_members_array[index] = actor_id
    $game_player.refresh
    $game_map.need_refresh = true
    rearrange_actors
    end
    #--------------------------------------------------------------------------
    # alias method: remove_actor
    #--------------------------------------------------------------------------
    alias game_party_remove_actor_ps remove_actor
    def remove_actor(actor_id)
    game_party_remove_actor_ps(actor_id)
    return unless @battle_members_array.include?(actor_id)
    index = @battle_members_array.index(actor_id)
    @battle_members_array[index] = 0
    $game_player.refresh
    $game_map.need_refresh = true
    rearrange_actors
    end
    #--------------------------------------------------------------------------
    # new method: rearrange_actors
    #--------------------------------------------------------------------------
    def rearrange_actors
    initialize_battle_members if @battle_members_array.nil?
    array = []
    for actor_id in @battle_members_array
    next if [0, nil].include?(actor_id)
    next if $game_actors[actor_id].nil?
    array.push(actor_id)
    end
    for actor_id in @actors
    next if array.include?(actor_id)
    next if $game_actors[actor_id].nil?
    array.push(actor_id)
    end
    @actors = array
    end
    end # Game_Party
    #==============================================================================
    # ■ Game_Interpreter
    #==============================================================================
    class Game_Interpreter
    #--------------------------------------------------------------------------
    # new method: lock_actor
    #--------------------------------------------------------------------------
    def lock_actor(actor_id)
    return unless YEA:ARTY::ENABLE_MENU
    actor = $game_actors[actor_id]
    return unless $game_party.battle_members.include?(actor.id)
    actor.locked = true
    end
    #--------------------------------------------------------------------------
    # new method: unlock_actor
    #--------------------------------------------------------------------------
    def unlock_actor(actor_id)
    return unless YEA:ARTY::ENABLE_MENU
    actor = $game_actors[actor_id]
    return unless $game_party.battle_members.include?(actor.id)
    actor.locked = false
    end
    #--------------------------------------------------------------------------
    # new method: require_actor
    #--------------------------------------------------------------------------
    def require_actor(actor_id)
    return unless YEA:ARTY::ENABLE_MENU
    return if $game_system.formation_disabled
    actor = $game_actors[actor_id]
    return unless $game_party.all_members.include?(actor)
    actor.required = true
    call_party_menu unless $game_party.battle_members.include?(actor)
    end
    #--------------------------------------------------------------------------
    # new method: unrequire_actor
    #--------------------------------------------------------------------------
    def unrequire_actor(actor_id)
    return unless YEA:ARTY::ENABLE_MENU
    return if $game_system.formation_disabled
    actor = $game_actors[actor_id]
    return unless $game_party.all_members.include?(actor)
    actor.required = false
    call_party_menu unless $game_party.battle_members.include?(actor)
    end
    #--------------------------------------------------------------------------
    # new method: call_party_menu
    #--------------------------------------------------------------------------
    def call_party_menu
    return unless YEA:ARTY::ENABLE_MENU
    return if $game_system.formation_disabled
    SceneManager.call(Scene_Party)
    end
    end # Game_Interpreter
    #==============================================================================
    # ■ Spriteset_Battle
    #==============================================================================
    class Spriteset_Battle
    #--------------------------------------------------------------------------
    # overwrite method: create_actors
    #--------------------------------------------------------------------------
    def create_actors
    total = $game_party.max_battle_members
    @actor_sprites = Array.new(total) { Sprite_Battler.new(@viewport1) }
    end
    end # Spriteset_Battle
    #==============================================================================
    # ■ Window_PartyMenuCommand
    #==============================================================================
    class Window_PartyMenuCommand < Window_Command
    #--------------------------------------------------------------------------
    # window_width
    #--------------------------------------------------------------------------
    def window_width; return 160; end
    #--------------------------------------------------------------------------
    # visible_line_number
    #--------------------------------------------------------------------------
    def visible_line_number; 4; end
    #--------------------------------------------------------------------------
    # alignment
    #--------------------------------------------------------------------------
    def alignment
    return Menu.command_window_align if $imported["YEA-AceMenuEngine"]
    return YEA:ARTY::COMMAND_ALIGN
    end
    #--------------------------------------------------------------------------
    # scene
    #--------------------------------------------------------------------------
    def scene; return SceneManager.scene; end
    #--------------------------------------------------------------------------
    # make_command_list
    #--------------------------------------------------------------------------
    def make_command_list
    for command in YEA:ARTY::COMMANDS
    case command[0]
    when :change, :remove, :revert
    add_command(command[1], command[0])
    when :finish
    add_command(command[1], command[0], enable_cancel?)
    else; next
    end
    end
    end
    #--------------------------------------------------------------------------
    # process_cancel
    #--------------------------------------------------------------------------
    def process_cancel
    unless enable_cancel?
    Sound.play_buzzer
    return
    end
    super
    end
    #--------------------------------------------------------------------------
    # in_party?
    #--------------------------------------------------------------------------
    def in_party?(actor)
    return $game_party.battle_members.include?(actor)
    end
    #--------------------------------------------------------------------------
    # enable_cancel?
    #--------------------------------------------------------------------------
    def enable_cancel?
    return false if $game_party.battle_members.size <= 0
    for actor in $game_party.all_members
    next if in_party?(actor)
    return false if actor.required
    return false if actor.locked
    end
    return true
    end
    end # Window_PartyMenuCommand
    #==============================================================================
    # ■ Window_PartySelect
    #==============================================================================
    class Window_PartySelect < Window_Selectable
    #--------------------------------------------------------------------------
    # initialize
    #-------------------------------------------------------------------------
    def initialize(command_window)
    @command_window = command_window
    super(160, 0, window_width, fitting_height(visible_line_number))
    select(0)
    deactivate
    refresh
    end
    #--------------------------------------------------------------------------
    # col_max
    #--------------------------------------------------------------------------
    def col_max; return $game_party.max_battle_members; end
    #--------------------------------------------------------------------------
    # item_max
    #--------------------------------------------------------------------------
    def item_max; return $game_party.max_battle_members; end
    #--------------------------------------------------------------------------
    # window_width
    #--------------------------------------------------------------------------
    def window_width; return Graphics.width - 160; end
    #--------------------------------------------------------------------------
    # visible_line_number
    #--------------------------------------------------------------------------
    def visible_line_number; 4; end
    #--------------------------------------------------------------------------
    # item_rect
    #--------------------------------------------------------------------------
    def item_rect(index)
    rect = Rect.new
    rect.width = contents.width / item_max
    rect.height = contents.height
    rect.x = index * rect.width
    rect.y = 0
    return rect
    end
    #--------------------------------------------------------------------------
    # refresh
    #--------------------------------------------------------------------------
    def refresh
    make_item_list
    create_contents
    draw_all_items
    end
    #--------------------------------------------------------------------------
    # make_item_list
    #--------------------------------------------------------------------------
    def make_item_list
    @data = $game_party.battle_members_array.clone
    end
    #--------------------------------------------------------------------------
    # draw_item
    #--------------------------------------------------------------------------
    def draw_item(index)
    actor = $game_actors[@data[index]]
    rect = item_rect(index)
    if actor.nil?
    draw_empty(rect.clone)
    return
    end
    dx = rect.width / 2
    dy = rect.height - 16
    draw_actor_face(actor, rect.x, rect.y) if display_face?
    draw_actor_graphic(actor, rect.x + dx, rect.y + dy) unless display_face?
    draw_actor_name(actor, rect)
    draw_locked_icon(actor, rect)
    draw_required_icon(actor, rect)
    end
    #--------------------------------------------------------------------------
    # display_face?
    #--------------------------------------------------------------------------
    def display_face?
    return YEA:ARTY:ISPLAY_FACE
    end
    #--------------------------------------------------------------------------
    # draw_empty
    #--------------------------------------------------------------------------
    def draw_empty(rect)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect.x += 2
    rect.y += 2
    rect.width -= 4
    rect.height -= 4
    contents.fill_rect(rect, colour)
    reset_font_settings
    change_color(system_color)
    text = YEA:ARTY::EMPTY_TEXT
    draw_text(rect, text, 1)
    reset_font_settings
    end
    #--------------------------------------------------------------------------
    # draw_actor_name
    #--------------------------------------------------------------------------
    def draw_actor_name(actor, rect)
    contents.font.size = YEA:ARTY:ARTY_FONT_SIZE
    change_color(normal_color, actor.exist?)
    draw_text(rect.x+4, rect.y, rect.width-8, line_height, actor.name, 1)
    end
    #--------------------------------------------------------------------------
    # draw_face
    #--------------------------------------------------------------------------
    def draw_face(face_name, face_index, dx, dy, enabled = true)
    bitmap = Cache.face(face_name)
    dw = [96, item_rect(0).width-4].min
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, dw, 92)
    contents.blt(dx+2, dy+2, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
    end
    #--------------------------------------------------------------------------
    # draw_locked_icon
    #--------------------------------------------------------------------------
    def draw_locked_icon(actor, rect)
    return unless actor_locked?(actor)
    draw_icon(Icon.locked_party, rect.x+rect.width-26, rect.height - 26)
    end
    #--------------------------------------------------------------------------
    # draw_required_icon
    #--------------------------------------------------------------------------
    def draw_required_icon(actor, rect)
    return if actor_locked?(actor)
    return unless actor_required?(actor)
    draw_icon(Icon.required_party, rect.x+rect.width-26, rect.height - 26)
    end
    #--------------------------------------------------------------------------
    # actor_locked?
    #--------------------------------------------------------------------------
    def actor_locked?(actor); return actor.locked; end
    #--------------------------------------------------------------------------
    # actor_required?
    #--------------------------------------------------------------------------
    def actor_required?(actor)
    return false if actor.locked
    return actor.required
    end
    #--------------------------------------------------------------------------
    # current_item_enabled?
    #--------------------------------------------------------------------------
    def current_item_enabled?; enable?(@data[index]); end
    #--------------------------------------------------------------------------
    # enable?
    #--------------------------------------------------------------------------
    def enable?(item)
    case @command_window.current_symbol
    when :change
    return true if item.nil?
    return true if item == 0
    when :remove
    return false if item.nil?
    return false if item == 0
    end
    actor = $game_actors[item]
    return false if actor.locked
    return false if actor.required
    return true
    end
    #--------------------------------------------------------------------------
    # process_handling
    #--------------------------------------------------------------------------
    def process_handling
    return unless open? && active
    return process_ok if ok_enabled? && Input.trigger?C)
    return process_cancel if cancel_enabled? && Input.trigger?
    return process_pagedown if handle?pagedown) && Input.repeat?R)
    return process_pageup if handle?pageup) && Input.repeat?L)
    end
    #--------------------------------------------------------------------------
    # cur_actor
    #--------------------------------------------------------------------------
    def cur_actor
    actor_id = @data[index]
    return $game_actors[actor_id]
    end
    #--------------------------------------------------------------------------
    # prev_actor
    #--------------------------------------------------------------------------
    def prev_actor
    id = index == 0 ? @data.size - 1 : index - 1
    actor_id = @data[id]
    return $game_actors[actor_id]
    end
    #--------------------------------------------------------------------------
    # next_actor
    #--------------------------------------------------------------------------
    def next_actor
    id = index == @data.size - 1 ? 0 : index + 1
    actor_id = @data[id]
    return $game_actors[actor_id]
    end
    #--------------------------------------------------------------------------
    # process_pageup
    #--------------------------------------------------------------------------
    def process_pageup
    allow = true
    allow = false if !prev_actor.nil? && prev_actor.locked
    allow = false if !cur_actor.nil? && cur_actor.locked
    Sound.play_buzzer unless allow
    if allow
    super
    activate
    select(index == 0 ? @data.size - 1 : index - 1)
    end
    end
    #--------------------------------------------------------------------------
    # process_pagedown
    #--------------------------------------------------------------------------
    def process_pagedown
    allow = true
    allow = false if !next_actor.nil? && next_actor.locked
    allow = false if !cur_actor.nil? && cur_actor.locked
    Sound.play_buzzer unless allow
    if allow
    super
    activate
    select(index == @data.size - 1 ? 0 : index + 1)
    end
    end
    #--------------------------------------------------------------------------
    # item
    #--------------------------------------------------------------------------
    def item; return @data[index]; end
    end # Window_PartySelect
    #==============================================================================
    # ■ Window_PartyList
    #==============================================================================
    class Window_PartyList < Window_Selectable
    #--------------------------------------------------------------------------
    # initialize
    #-------------------------------------------------------------------------
    def initialize(party_window)
    super(0, fitting_height(4), window_width, window_height)
    @party_window = party_window
    select(1)
    deactivate
    refresh
    end
    #--------------------------------------------------------------------------
    # window_width
    #--------------------------------------------------------------------------
    def window_width; return 200; end
    #--------------------------------------------------------------------------
    # window_height
    #--------------------------------------------------------------------------
    def window_height; return Graphics.height - fitting_height(4); end
    #--------------------------------------------------------------------------
    # item_max
    #--------------------------------------------------------------------------
    def item_max; return @data ? @data.size : 1; end
    #--------------------------------------------------------------------------
    # refresh
    #--------------------------------------------------------------------------
    def refresh
    make_item_list
    create_contents
    draw_all_items
    end
    #--------------------------------------------------------------------------
    # make_item_list
    #--------------------------------------------------------------------------
    def make_item_list
    @data = [0]
    for member in $game_party.all_members
    next if member.nil?
    @data.push(member.id)
    end
    @data.push(0)
    end
    #--------------------------------------------------------------------------
    # draw_item
    #--------------------------------------------------------------------------
    def draw_item(index)
    clear_item(index)
    rect = item_rect(index)
    if @data[index] == 0
    draw_remove(rect)
    return
    end
    actor = $game_actors[@data[index]]
    draw_actor(actor, rect)
    draw_actor_locked(actor, rect)
    draw_actor_required(actor, rect)
    end
    #--------------------------------------------------------------------------
    # draw_remove
    #--------------------------------------------------------------------------
    def draw_remove(rect)
    reset_font_settings
    draw_icon(Icon.remove_party, rect.x+4, rect.y)
    text = YEA:ARTY::REMOVE_TEXT
    draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
    end
    #--------------------------------------------------------------------------
    # draw_actor
    #--------------------------------------------------------------------------
    def draw_actor(actor, rect)
    buffer = YEA:ARTY::ACTOR_Y_BUFFER
    draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + buffer)
    text = actor.name
    change_color(list_colour(actor), enabled?(actor))
    draw_text(rect.x+32, rect.y, rect.width-32, line_height, text)
    end
    #--------------------------------------------------------------------------
    # list_colour
    #--------------------------------------------------------------------------
    def list_colour(actor)
    return text_color(YEA:ARTY::IN_PARTY_COLOUR) if in_party?(actor)
    return normal_color
    end
    #--------------------------------------------------------------------------
    # draw_actor_locked
    #--------------------------------------------------------------------------
    def draw_actor_locked(actor, rect)
    return unless actor.locked
    draw_icon(Icon.locked_party, rect.width-24, rect.y)
    end
    #--------------------------------------------------------------------------
    # draw_actor_required
    #--------------------------------------------------------------------------
    def draw_actor_required(actor, rect)
    return if actor.locked
    return unless actor.required
    draw_icon(Icon.required_party, rect.width-24, rect.y)
    end
    #--------------------------------------------------------------------------
    # enabled?
    #--------------------------------------------------------------------------
    def enabled?(actor)
    return false if actor.locked
    return false if actor.required && in_party?(actor)
    return actor.exist?
    end
    #--------------------------------------------------------------------------
    # in_party?
    #--------------------------------------------------------------------------
    def in_party?(actor); return $game_party.battle_members.include?(actor); end
    #--------------------------------------------------------------------------
    # current_item_enabled?
    #--------------------------------------------------------------------------
    def current_item_enabled?
    actor = $game_actors[item]
    replace = $game_actors[@party_window.item]
    unless actor.nil?
    return false if actor.locked && in_party?(actor)
    return false if actor.required && in_party?(actor)
    end
    return true if replace.nil?
    return false if replace.locked
    return false if replace.required
    return true if actor.nil?
    return actor.exist?
    end
    #--------------------------------------------------------------------------
    # item
    #--------------------------------------------------------------------------
    def item; return @data[index]; end
    end # Window_PartyList
    #==============================================================================
    # ** Window_PartyStatus
    #==============================================================================
    class Window_PartyStatus < Window_Base
    #--------------------------------------------------------------------------
    # initialize
    #--------------------------------------------------------------------------
    def initialize(party_window, list_window)
    super(200, fitting_height(4), window_width, window_height)
    @party_window = party_window
    @list_window = list_window
    @actor = active_actor
    refresh
    end
    #--------------------------------------------------------------------------
    # window_width
    #--------------------------------------------------------------------------
    def window_width; Graphics.width - 200; end
    #--------------------------------------------------------------------------
    # window_height
    #--------------------------------------------------------------------------
    def window_height; Graphics.height - fitting_height(4); end
    #--------------------------------------------------------------------------
    # update
    #--------------------------------------------------------------------------
    def update
    super
    refresh if @actor != active_actor
    end
    #--------------------------------------------------------------------------
    # active_actor
    #--------------------------------------------------------------------------
    def active_actor
    if @list_window.active
    actor = @list_window.item
    else
    actor = @party_window.item
    end
    return nil if [0, nil].include?(actor)
    return actor
    end
    #--------------------------------------------------------------------------
    # refresh
    #--------------------------------------------------------------------------
    def refresh
    contents.clear
    @actor = active_actor
    reset_font_settings
    if @actor.nil?
    draw_nil_actor
    return
    end
    actor = $game_actors[@actor]
    draw_actor_face(actor, 0, 0)
    draw_actor_name(actor, 108, 0)
    draw_actor_class(actor, 228, 0, contents.width-232)
    draw_actor_level(actor, 108, line_height)
    draw_actor_icons(actor, 228, line_height, contents.width-232)
    draw_actor_hp(actor, 108, line_height*2, contents.width-112)
    draw_actor_mp(actor, 108, line_height*3, contents.width-112)
    draw_actor_parameters(actor, 0, line_height*4 + line_height/2)
    draw_equipments(actor, contents.width/2, line_height*4 + line_height/2)
    end
    #--------------------------------------------------------------------------
    # draw_nil_actor
    #--------------------------------------------------------------------------
    def draw_nil_actor
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(0, 0, contents.width, contents.height)
    contents.fill_rect(rect, colour)
    change_color(system_color)
    text = YEA:ARTY::NO_DATA
    draw_text(rect, text, 1)
    end
    #--------------------------------------------------------------------------
    # draw_actor_parameters
    #--------------------------------------------------------------------------
    def draw_actor_parameters(actor, dx, dy)
    dw = contents.width/2 - 4
    rect = Rect.new(dx+1, dy+1, dw - 2, line_height - 2)
    contents.font.size = YEA:ARTY::STAT_FONT_SIZE
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    array = [:atk, :def, :mat, :mdf, :agi, :luk]
    cx = 4
    for stat in array
    case stat
    when :atk
    param = Vocab:aram(2)
    value = actor.atk.group
    when :def
    param = Vocab:aram(3)
    value = actor.def.group
    when :mat
    param = Vocab:aram(4)
    value = actor.mat.group
    when :mdf
    param = Vocab:aram(5)
    value = actor.mdf.group
    when :agi
    param = Vocab:aram(6)
    value = actor.agi.group
    when :luk
    param = Vocab:aram(7)
    value = actor.luk.group
    else; next
    end
    contents.fill_rect(rect, colour)
    change_color(system_color)
    draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, param, 0)
    change_color(normal_color)
    draw_text(rect.x + cx, rect.y, rect.width-cx*2, line_height, value, 2)
    rect.y += line_height
    end
    reset_font_settings
    end
    #--------------------------------------------------------------------------
    # draw_equipments
    #--------------------------------------------------------------------------
    def draw_equipments(actor, dx, dy)
    text = YEA:ARTY::EQUIP_TEXT
    change_color(system_color)
    draw_text(dx, dy, contents.width - dx, line_height, text, 1)
    dy += line_height
    if actor.equips.size <= 5
    actor.equips.each_with_index do |item, i|
    draw_item_name(item, dx, dy + line_height * i)
    end
    else
    orig_x = dx
    actor.equips.each_with_index do |item, i|
    next if item.nil?
    draw_icon(item.icon_index, dx, dy)
    dy += line_height if dx + 48 > contents.width
    dx = dx + 48 > contents.width ? orig_x : dx + 24
    end
    end
    end
    end # Window_PartyStatus
    #==============================================================================
    # ■ Scene_Menu
    #==============================================================================
    class Scene_Menu < Scene_MenuBase
    #--------------------------------------------------------------------------
    # overwrite method: command_formation
    #--------------------------------------------------------------------------
    if YEA:ARTY::ENABLE_MENU
    def command_formation
    SceneManager.call(Scene_Party)
    end
    end # YEA:ARTY::ENABLE_MENU
    end # Scene_Menu
    #==============================================================================
    # ■ Scene_Party
    #==============================================================================
    class Scene_Party < Scene_MenuBase
    #--------------------------------------------------------------------------
    # start
    #--------------------------------------------------------------------------
    def start
    super
    @former_party = $game_party.battle_members_array.clone
    create_command_window
    create_party_window
    create_list_window
    create_status_window
    end
    #--------------------------------------------------------------------------
    # create_command_window
    #--------------------------------------------------------------------------
    def create_command_window
    @command_window = Window_PartyMenuCommand.new(0, 0)
    @command_window.set_handlerchange, methodadjust_members))
    @command_window.set_handlerremove, methodadjust_members))
    @command_window.set_handlerrevert, methodrevert_party))
    @command_window.set_handlerfinish, methodreturn_scene))
    @command_window.set_handlercancel, methodreturn_scene))
    end
    #--------------------------------------------------------------------------
    # create_party_window
    #--------------------------------------------------------------------------
    def create_party_window
    @party_window = Window_PartySelect.new(@command_window)
    @party_window.set_handlerok, methodon_party_ok))
    @party_window.set_handlercancel, methodon_party_cancel))
    @party_window.set_handlerpageup, methodon_party_pageup))
    @party_window.set_handlerpagedown, methodon_party_pagedown))
    end
    #--------------------------------------------------------------------------
    # create_list_window
    #--------------------------------------------------------------------------
    def create_list_window
    @list_window = Window_PartyList.new(@party_window)
    @list_window.set_handlerok, methodon_list_ok))
    @list_window.set_handlercancel, methodon_list_cancel))
    end
    #--------------------------------------------------------------------------
    # create_status_window
    #--------------------------------------------------------------------------
    def create_status_window
    @status_window = Window_PartyStatus.new(@party_window, @list_window)
    end
    #--------------------------------------------------------------------------
    # adjust_members
    #--------------------------------------------------------------------------
    def adjust_members
    @party_window.activate
    end
    #--------------------------------------------------------------------------
    # window_refresh
    #--------------------------------------------------------------------------
    def window_refresh
    $game_party.rearrange_actors
    @command_window.refresh
    @party_window.refresh
    @list_window.refresh
    $game_player.refresh
    $game_map.need_refresh = true
    end
    #--------------------------------------------------------------------------
    # revert_party
    #--------------------------------------------------------------------------
    def revert_party
    @command_window.activate
    $game_party.battle_members_array = @former_party.clone
    window_refresh
    end
    #--------------------------------------------------------------------------
    # on_party_ok
    #--------------------------------------------------------------------------
    def on_party_ok
    case @command_window.current_symbol
    when :change
    @list_window.activate
    when :remove
    index = @party_window.index
    actor = $game_actors[$game_party.battle_members_array[index]]
    Sound.play_equip
    $game_party.battle_members_array[index] = 0
    window_refresh
    @party_window.activate
    end
    end
    #--------------------------------------------------------------------------
    # on_party_cancel
    #--------------------------------------------------------------------------
    def on_party_cancel
    @command_window.activate
    end
    #--------------------------------------------------------------------------
    # on_party_pageup
    #--------------------------------------------------------------------------
    def on_party_pageup
    Sound.play_equip
    actor_id1 = @party_window.item
    actor_id2 = @party_window.prev_actor.nil? ? 0 : @party_window.prev_actor.id
    max = @party_window.item_max-1
    index1 = @party_window.index
    index2 = @party_window.index == 0 ? max : index1-1
    $game_party.battle_members_array[index1] = actor_id2
    $game_party.battle_members_array[index2] = actor_id1
    window_refresh
    end
    #--------------------------------------------------------------------------
    # on_party_pagedown
    #--------------------------------------------------------------------------
    def on_party_pagedown
    Sound.play_equip
    actor_id1 = @party_window.item
    actor_id2 = @party_window.next_actor.nil? ? 0 : @party_window.next_actor.id
    max = @party_window.item_max-1
    index1 = @party_window.index
    index2 = @party_window.index == max ? 0 : index1+1
    $game_party.battle_members_array[index1] = actor_id2
    $game_party.battle_members_array[index2] = actor_id1
    window_refresh
    end
    #--------------------------------------------------------------------------
    # on_list_cancel
    #--------------------------------------------------------------------------
    def on_list_cancel
    @party_window.activate
    end
    #--------------------------------------------------------------------------
    # on_list_ok
    #--------------------------------------------------------------------------
    def on_list_ok
    Sound.play_equip
    replace = $game_actors[@party_window.item]
    actor = $game_actors[@list_window.item]
    index1 = @party_window.index
    actor_id1 = actor.nil? ? 0 : actor.id
    if actor.nil?
    $game_party.battle_members_array[index1] = 0
    window_refresh
    @party_window.activate
    return
    end
    actor_id2 = replace.nil? ? 0 : replace.id
    if $game_party.battle_members_array.include?(actor_id1)
    index2 = $game_party.battle_members_array.index(actor_id1)
    $game_party.battle_members_array[index2] = actor_id2
    end
    $game_party.battle_members_array[index1] = actor_id1
    window_refresh
    @party_window.activate
    end
    end # Scene_Party
    #==============================================================================
    #
    # ▼ End of File
    #
    #==============================================================================
  • Bravo Storage System - http://pastebin.com/raw.php?i=i9Sg6Nj5
  • Overlay Maps - http://himeworks.com/redirect.php?type=script&name=Overlay_Maps
  • Custom Event Triggers - http://himeworks.com/redirect.php?type=script&name=Custom_Event_Triggers
  • Galv's Message Busts - http://galvs-scripts.com/galvs-message-busts/
  • Character Profile - http://rmrk.net/index.php?topic=48772.0
  • & KMS Skill Level - https://dl.dropboxusercontent.com/u/89346660/KMS/KMS_SkillLevel.txt
The problem I am having is that when I try to go to my menu in-game, it gives me this message:

Protected download
Can someone help me?

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

# * Terms of Use #------------------------------------------------------------------------------- # When using any Khas script, you agree with the following terms: # 1. You must give credit to Khas;

Referenced Images / Attachments

Untitled.png
Untitled.png
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#rpg-maker-archive#rgss-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar