I'm using this script which is an editted version by derwulfmen:
#==============================================================================
# ** Sprite Sun
#------------------------------------------------------------------------------
# Based on Sprite Shadow
# modified by Rataime
# New Edits by DerVVulfman
# February 12, 2008
#------------------------------------------------------------------------------
#
# Introduction:
#
# This system allows you and all 'prepared' events to generate shadows while
# on the field map. The player can move around while a programmed 'sun' will
# display a shadow. Likewise, events with a special comment within their
# event list can also generate shadows.
#
#------------------------------------------------------------------------------
#
# Instructions:
#
# -- The Sun
# To create a sun effect, you'll need to create a map event that's to be
# used 'as' the sun itself. Under most circumstances, this will be an
# event without a characterset graphic. You don't want to 'SEE' the sun,
# do you?
#
# To make one of these events a 'sun, you'll need to insert a couple of
# things into that event's "List of Event Commands". These things are
# nothing more than comments.
#
# The first comment to add is "begin Sun" (without quotes). It informs
# the system that this map has a sun effect in use. The remaining two
# values are optional and have default values in the configuration
# section (only just added into the script). They too are added as
# comments.
#
# self_angle 'number' --- How much of an angle each shadow will have.
# self_opacity 'number' --- How dark the shadow will be.
#
# After that, your characters can now move about and generate shadows.
#
# -- Other Events
# Events do not know that they can generate shadows. To let them gene-
# rate a shadow, all you need to do is add a special comment into their
# "List of Event Commands". This comment needed is merely the phrase
# 'begin Shadow' (again, without quotes).
#
#
#------------------------------------------------------------------------------
#
# Revisions to note:
#
# 1) Added formatted headers and comments throughout the script.
# 2) Encapsulated a comment/parameter code in an XPML module.
# 3) Set the sun shadow array into an instance value to lower resource costs.
# 4) Compatability with Near Fantastica's Squad Movement systems.
# 5) Compatability with Ccoa's Caterpillar system.
# 6) Compatability with Trickster's Caterpillar system.
# 7) Added default shadow settings into the configuration section.
#
#==============================================================================
#========================================================================
# ** C O N F I G U R A T I O N S Y S T E M ** #
#========================================================================
# Caterpillar Systems
CATERPILLAR_COMPATIBLE = true # Toggle for Fukuyama's original
SQUAD_MOVE_COMPATIBLE = false # Toggle for Near Fantastica's SBABS
CCOA_CATER_COMPATIBLE = false # Toggle for Ccoa's Caterpillar
TRICKSTER_CATER_COMPATIBLE = false # Toggle for Trickster's Caterpillar
# Sun Specific Systems
SUN_WARN = true # Checks for older sun systems
SUN_ANGLE = 45 # Angle for sun-generated shadow
SUN_OPACITY = 128 # Darkness setting for sun shadow
#========================================================================
# **** E N D O F C O N F I G U R A T I O N S Y S T E M **** #
#========================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sun_spriteset # holds spritesets for 'sun' shadows
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :characters
end
#==============================================================================
# ** Sprite_Sun
#------------------------------------------------------------------------------
# This sprite is used to position character shadows relative to map position.
# It observes the Game_Character class and automatically changes sprite
# conditions.
#==============================================================================
class Sprite_Sun < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
# id : id
#--------------------------------------------------------------------------
def initialize(viewport, character = nil, id=0)
super(viewport)
@character = character
params=$game_temp.sun_spriteset.sun[id]
self_angle = SUN_ANGLE
self_opacity = SUN_OPACITY
self_angle = params[0] if params.size > 0
self_opacity = params[1] if params.size > 1
@self_angle = self_angle
@self_opacity = self_opacity
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If tile ID, file name, or hue are different from current ones
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# Remember tile ID, file name, and hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile ID value is valid
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# If tile ID value is invalid
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
# Set visible situation
self.visible = (not @character.transparent)
# If graphic is character
if @tile_id == 0
# Set rectangular transfer
sx = @character.pattern * @cw
@direct = @character.direction
if self.angle > 90 or angle < -90
sy = ( 4 - 2) / 2 * @ch if @direct == 6
sy = ( 6 - 2) / 2 * @ch if @direct == 4
sy = (@character.direction - 2) / 2 * @ch if @direct != 4 and @direct != 6
else
sy = (@character.direction - 2) / 2 * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
# Set sprite coordinates
self.x = @character.screen_x
self.y = @character.screen_y-5
self.z = @character.screen_z(@ch) - 1
# Set opacity level, blend method, and bush depth
self.opacity = @self_opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Animation
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
self.angle = @self_angle.to_i - 90
self.color = Color.new(0, 0, 0)
end
end
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display the character.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias sun_initialize initialize
alias sun_update update
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
@character = character
super(viewport)
@sunlist=[]
if character.is_a?(Game_Event) and $game_temp.sun_spriteset.sun != []
params = XPML.XPML_read("Shadow", @character.id, 2)
if params != nil
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, @character, i))
end
end
end
if character.is_a?(Game_Player) and $game_temp.sun_spriteset.sun != []
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, $game_player, i))
end
#===================================================
# * Compatibility with Caterpillar Functions
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters != nil
for member in $game_party.characters
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if SQUAD_MOVE_COMPATIBLE and $game_allies.values != nil
for member in $game_allies.values
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if CCOA_CATER_COMPATIBLE and $game_train.actors != nil
for member in $game_train.actors
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if TRICKSTER_CATER_COMPATIBLE and $game_party.followers != nil
for member in $game_party.followers
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
#===================================================
# ** End of the compatibility
#===================================================
end
# Perform the original call
sun_initialize(viewport, @character)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
sun_update
if @sunlist != []
for i in 0...@sunlist.size
@sunlist[i].update
end
end
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :id
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sun
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias sun_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@sun = []
$game_temp.sun_spriteset = self
warn = false
for k in $game_map.events.keys.sort
if ($game_map.events[k].list != nil and
$game_map.events[k].list[0].code == 108 and
($game_map.events[k].list[0].parameters == ["sun"] or
$game_map.events[k].list[0].parameters == ["o"]))
warn = true
end
params = XPML.XPML_read("Sun", k, 2)
$game_temp.sun_spriteset.sun.push(params) if params != nil
end
if warn == true and SUN_WARN
p "Warning : At least one event on this map uses an obsolete way to add a sun effect"
end
# Perform the original call
sun_initialize
end
end
#==============================================================================
# ** module XPML
#------------------------------------------------------------------------------
# This module handles the reading and passing of 'comment' parameters
#
# The main XPML method is used to check and read event comments.
# * It returns 'nil' if the markup 'check' text isn't even present.
# * It returns [] if no parameters are passed
# * It returns a parameter list with "int" converted as int.
# eg :
# begin first
# begin second
# param1 1
# param2 two
# begin third
# anything 3
#
# p XPML_read("first", event_id) -> []
# p XPML_read("second", event_id) -> [1,"two"]
# p XPML_read("third", event_id) -> [3]
# p XPML_read("forth", event_id) -> nil
#===================================================
module XPML
module_function
#--------------------------------------------------------------------------
# * XPML_read
# markup : text in event comment to check
# event_id : event ID
# max_param_number : maximum number of parameter/comments to load
#--------------------------------------------------------------------------
def XPML_read(markup, event_id, max_param_number = 0)
parameter_list = nil
event = $game_map.events[event_id]
return if event.list == nil
for i in 0...event.list.size
if event.list[i].code == 108 and
event.list[i].parameters[0].downcase == "begin " + markup.downcase
parameter_list = [] if parameter_list == nil
for j in i + 1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size != 1 and parts[0].downcase != "begin"
if parts[1].to_i != 0 or parts[1] == "0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
end
else
return parameter_list
end
else
return parameter_list
end
if max_param_number != 0 and j == i + max_param_number
return parameter_list
end
end
end
end
return parameter_list
end
end
And this script has a small problem which is it doesn't update in the map unless you enter/exit some place or open/close menu.
Anyone would be kind enough to see if it can be fixed? I was thinking on utilising foreverzero time script among this one so that the shadow would turn depending on the time.
Thanks.
change line 209 to:
self.angle = SUN_ANGLE - 90
instead of whatever it was before. and do a search and replace for SUN_ANGLE to $SUN_ANGLE, it's easier accessible that way if you're gonna mix systems.
(it does update, just uses a static number to generate the shadows during update)
When I changed line 209 to yours the shadow remains always at 90 degrees even tough I specify in my comment that the shadow should be on 20 degrees.(You call the script ingame by an event with comment commands which doesn't require parallel process, "begin sun" and another comment with "angle - xx" and under it "opacity - xx")
Also the shadow won't update unless I open my menu or go to another map and coming back no matter if I wait for 5 minutes standing still or moving the shadow simply doesn't update unless I open menu or go into another map.
If you could find a solution for that it would be awesome.
this is the solution to that, you have to manually set the sun's rotating angle (according to how long your day is). if you're gonna use foreverzer0's script, you'll have to put in there somewhere the sun's angle.
try what i said and make a par.process event with this in it:
comment: begin Sun
script:
$SUN_ANGLE += 1
if $SUN_ANGLE > 360
$SUN_ANGLE = 1
end
Wait: 1 frame
you'll see that it works. no setting the angle in a event comment because this will make it always display the same shadow.
It works tough I had to increase the wait from 1 to around 200 because the shadow was rotating like 5+ times a second lol :D
I don't think it will affect the game the 200 wait, well I hope so.
Thanks +1
well yeah it was only an example lol. you're welcome.^^
This script makes the game lag like hell even if you use the shadow only on your character.
If you/anyone don't mind checking it, any idea what could be causing it? or more specifically how could it be fixed.
Thanks.
it doesn't lag on my end. what other scripts are you using?
see if replacing the line 209 with this helps:
self.angle = $SUN_ANGLE if self.angle != $SUN_ANGLE
(don't really know what the -90 is for, seems to work just as well without it)
I have a big map (240x200) maybe that's why it's causing the lag dunno.
Thing is when I use this script without the anti event lag script the fps goes down drastically but if I add anti event lag script my fps is 38+-, if I remove the shadow script and anti event lag script my fps is 39-40.
Maybe it's because I'm using a big map dunno.
definitely, big maps produce much more sprites (using shadows means double sprites). best to use anti lag lol.
Using that new line gives an error if used with the "if" part.
I was using that line of yours != after some hours I came back to the script and the shadow was no longer rotating so I had to switch back to "self.angle = $SUN_ANGLE" for the shadow rotation to work again.
The - 90 was probably the angle that the shadow starts.
If I would name you all the scripts I'm using in the project there would be a big list heh (Have like 6+ for the equip script because it is split in small parts) but the only scripts I'm using that could affect this script are, the time script of forever zero, one that shows the map name for a few seconds, one that adds some random sounds every x seconds as ambience, and one that lets me use 2 fogs instead of 1 (Which I am thinking on removing as it kinda adds a little lag but it's a little useful).
This looks like an awesome script!
Hey, first of all, does this script need Foreverzer0's script? I am using BLizzard's ATES (Advanced Time and Environment System). Should this work with it?
Second, my shadow is stuck straight up and I cannot figure out why. I have done everything that I have read here (that is except put in Foreverzer0's script), and I cannot get the shadow to rotate at all.
hey,
i put this demo together quickly to show you. i changed the sun script to respond specifically to ATES and rotate shadows automatically. i put something of a fade in too so shadows don't leap onto the screen too much but it's just a couple if cases, nothing fancy.
http://dl.dropbox.com/u/56282677/rmxp/ates%2Bshadows.rar
The file will not open on my computer. The RMXP logo pops up (like it usually does) and then I get an error that says: unexpected file format
You must be using the illegal or PKE version of RMXP. Opens fine on my computer. I suggest two things, 1) get the legal version of RMXP (http://forum.chaos-project.com/index.php/topic,11492.0.html). 2) Try replacing the Game.rxproj with one that does work for you.
Or just open Game.rxproj with notepad and change the file version.
:facepalm: I never knew that until now.
@ gameguy
I have the legal copy
@ForeverZer0
? :???:?
@Anybody
Can someone just post the script here and give a brief description of it since I can't get it to open?
it works with whatever settings you make in ATES so you don't need to change anything in it. i just made sun_angle and sun_opacity into a global variable so you can set them from anywhere, and some small changes to how the shadows (sprite_sun) are set to facilitate the rotation, and finally added a method in spriteset_map update to change the angle.
#==============================================================================
# ** Sprite Sun
#------------------------------------------------------------------------------
# Based on Sprite Shadow
# modified by Rataime
# New Edits by DerVVulfman
# February 12, 2008
#------------------------------------------------------------------------------
#
# Introduction:
#
# This system allows you and all 'prepared' events to generate shadows while
# on the field map. The player can move around while a programmed 'sun' will
# display a shadow. Likewise, events with a special comment within their
# event list can also generate shadows.
#
#------------------------------------------------------------------------------
#
# Instructions:
#
# -- The Sun
# To create a sun effect, you'll need to create a map event that's to be
# used 'as' the sun itself. Under most circumstances, this will be an
# event without a characterset graphic. You don't want to 'SEE' the sun,
# do you?
#
# To make one of these events a 'sun, you'll need to insert a couple of
# things into that event's "List of Event Commands". These things are
# nothing more than comments.
#
# The first comment to add is "begin Sun" (without quotes). It informs
# the system that this map has a sun effect in use. The remaining two
# values are optional and have default values in the configuration
# section (only just added into the script). They too are added as
# comments.
#
# self_angle 'number' --- How much of an angle each shadow will have.
# self_opacity 'number' --- How dark the shadow will be.
#
# After that, your characters can now move about and generate shadows.
#
# -- Other Events
# Events do not know that they can generate shadows. To let them gene-
# rate a shadow, all you need to do is add a special comment into their
# "List of Event Commands". This comment needed is merely the phrase
# 'begin Shadow' (again, without quotes).
#
#
#------------------------------------------------------------------------------
#
# Revisions to note:
#
# 1) Added formatted headers and comments throughout the script.
# 2) Encapsulated a comment/parameter code in an XPML module.
# 3) Set the sun shadow array into an instance value to lower resource costs.
# 4) Compatability with Near Fantastica's Squad Movement systems.
# 5) Compatability with Ccoa's Caterpillar system.
# 6) Compatability with Trickster's Caterpillar system.
# 7) Added default shadow settings into the configuration section.
#
#==============================================================================
#========================================================================
# ** C O N F I G U R A T I O N S Y S T E M ** #
#========================================================================
# Caterpillar Systems
CATERPILLAR_COMPATIBLE = true # Toggle for Fukuyama's original
SQUAD_MOVE_COMPATIBLE = false # Toggle for Near Fantastica's SBABS
CCOA_CATER_COMPATIBLE = false # Toggle for Ccoa's Caterpillar
TRICKSTER_CATER_COMPATIBLE = false # Toggle for Trickster's Caterpillar
# Sun Specific Systems
SUN_WARN = true # Checks for older sun systems
$SUN_ANGLE = 45 # Angle for sun-generated shadow
$SUN_OPACITY = 0 # Darkness setting for sun shadow
#========================================================================
# **** E N D O F C O N F I G U R A T I O N S Y S T E M **** #
#========================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sun_spriteset # holds spritesets for 'sun' shadows
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :characters
end
#==============================================================================
# ** Sprite_Sun
#------------------------------------------------------------------------------
# This sprite is used to position character shadows relative to map position.
# It observes the Game_Character class and automatically changes sprite
# conditions.
#==============================================================================
class Sprite_Sun < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
# id : id
#--------------------------------------------------------------------------
def initialize(viewport, character = nil, id=0)
super(viewport)
@character = character
params=$game_temp.sun_spriteset.sun[id]
self_angle = $SUN_ANGLE
self_opacity = $SUN_OPACITY
self_angle = params[0] if params.size > 0
self_opacity = params[1] if params.size > 1
@self_angle = self_angle
@self_opacity = self_opacity
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If tile ID, file name, or hue are different from current ones
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# Remember tile ID, file name, and hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile ID value is valid
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# If tile ID value is invalid
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
# Set visible situation
self.visible = (not @character.transparent)
# If graphic is character
if @tile_id == 0
# Set rectangular transfer
sx = @character.pattern * @cw
@direct = @character.direction
if self.angle > 90 or angle < -90
sy = ( 4 - 2) / 2 * @ch if @direct == 6
sy = ( 6 - 2) / 2 * @ch if @direct == 4
sy = (@character.direction - 2) / 2 * @ch if @direct != 4 and @direct != 6
else
sy = (@character.direction - 2) / 2 * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
# Set sprite coordinates
self.x = @character.screen_x
self.y = @character.screen_y-5
self.z = @character.screen_z(@ch) - 1
# Set opacity level, blend method, and bush depth
self.opacity = $SUN_OPACITY
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Animation
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
self.angle = -$SUN_ANGLE - 180
self.color = Color.new(0, 0, 0)
end
end
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
# This sprite is used to display the character.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias sun_initialize initialize
alias sun_update update
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
@character = character
super(viewport)
@sunlist=[]
if character.is_a?(Game_Event) and $game_temp.sun_spriteset.sun != []
params = XPML.XPML_read("Shadow", @character.id, 2)
if params != nil
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, @character, i))
end
end
end
if character.is_a?(Game_Player) and $game_temp.sun_spriteset.sun != []
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, $game_player, i))
end
#===================================================
# * Compatibility with Caterpillar Functions
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters != nil
for member in $game_party.characters
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if SQUAD_MOVE_COMPATIBLE and $game_allies.values != nil
for member in $game_allies.values
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if CCOA_CATER_COMPATIBLE and $game_train.actors != nil
for member in $game_train.actors
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
if TRICKSTER_CATER_COMPATIBLE and $game_party.followers != nil
for member in $game_party.followers
for i in 0...$game_temp.sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member, i))
end
end
end
#===================================================
# ** End of the compatibility
#===================================================
end
# Perform the original call
sun_initialize(viewport, @character)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
sun_update
if @sunlist != []
for i in 0...@sunlist.size
@sunlist[i].update
end
end
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :id
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sun
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias sun_initialize initialize
alias angle_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@sun = []
per_hour = 225.to_f/(ATES::NIGHT_START - ATES::DAY_START)
per_min = per_hour/60
mpf = 1440.to_f/(ATES::LENGTH*40)
@per_frame = mpf * per_min
$game_temp.sun_spriteset = self
warn = false
for k in $game_map.events.keys.sort
if ($game_map.events[k].list != nil and
$game_map.events[k].list[0].code == 108 and
($game_map.events[k].list[0].parameters == ["sun"] or
$game_map.events[k].list[0].parameters == ["o"]))
warn = true
end
params = XPML.XPML_read("Sun", k, 2)
$game_temp.sun_spriteset.sun.push(params) if params != nil
end
if warn == true and SUN_WARN
p "Warning : At least one event on this map uses an obsolete way to add a sun effect"
end
# Perform the original call
sun_initialize
end
def update
angle_update
return unless $game_system.ates.active
h = $game_system.ates.time.hour
m = $game_system.ates.time.min
if h < (ATES::DAY_START-2) || h >= ATES::NIGHT_START
$SUN_OPACITY = 0
elsif h == (ATES::DAY_START-2)
$SUN_ANGLE = 45 if m == 0
$SUN_OPACITY = 32
elsif h == (ATES::NIGHT_START-1)
$SUN_OPACITY = 32
elsif h == (ATES::DAY_START-1) || h == (ATES::NIGHT_START-2)
$SUN_OPACITY = 64
else
$SUN_OPACITY = 128
end
$SUN_ANGLE += @per_frame
end
end
#==============================================================================
# ** module XPML
#------------------------------------------------------------------------------
# This module handles the reading and passing of 'comment' parameters
#
# The main XPML method is used to check and read event comments.
# * It returns 'nil' if the markup 'check' text isn't even present.
# * It returns [] if no parameters are passed
# * It returns a parameter list with "int" converted as int.
# eg :
# begin first
# begin second
# param1 1
# param2 two
# begin third
# anything 3
#
# p XPML_read("first", event_id) -> []
# p XPML_read("second", event_id) -> [1,"two"]
# p XPML_read("third", event_id) -> [3]
# p XPML_read("forth", event_id) -> nil
#===================================================
module XPML
module_function
#--------------------------------------------------------------------------
# * XPML_read
# markup : text in event comment to check
# event_id : event ID
# max_param_number : maximum number of parameter/comments to load
#--------------------------------------------------------------------------
def XPML_read(markup, event_id, max_param_number = 0)
parameter_list = nil
event = $game_map.events[event_id]
return if event.list == nil
for i in 0...event.list.size
if event.list[i].code == 108 and
event.list[i].parameters[0].downcase == "begin " + markup.downcase
parameter_list = [] if parameter_list == nil
for j in i + 1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size != 1 and parts[0].downcase != "begin"
if parts[1].to_i != 0 or parts[1] == "0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
end
else
return parameter_list
end
else
return parameter_list
end
if max_param_number != 0 and j == i + max_param_number
return parameter_list
end
end
end
end
return parameter_list
end
end
Hey Poe, sorry I haven't been on in a little while. Okay, so I tried it our and ATES will not start if the map I am on has shadows, but if I go to a map that starts ATES, then it will start and continue to work if I return to the outside map with the shadows (although the shadows do not return). The shadows do not rotate either.
Also, do I still need an autorun event that says:
Comment: Shadows
Comment: begin sun
Comment: self_angle 45
Comment: self_opacity 128
I changed the self_opacity in the script to be 128 as well.
Any help?
Could you upload the demo? I'm a begginer that I can't understand. :'(
Please!
Im having some trouble with this shadow script, Im using RMX-OS with Ates and im wondering if someone could update this script so it is compatible?
Current Error
(http://i804.photobucket.com/albums/yy324/richadam111/Errorshdows_zps2c879054.png) (http://s804.photobucket.com/user/richadam111/media/Errorshdows_zps2c879054.png.html)
BUMP any ideas guys?
Maybe you should try another shadow script. I'm sure there's one that's way more compatible.
Hi thanks Blizz, ye i really wanted ates day time to bring out sun and slowly fade, i did find Rata's version of a sun which works but it wont show Visual Equipment