WhiteRabbit 3 Report post Posted June 26, 2012 I have a simple event command that I was wondering if it could be converted into a script. I'll try to explain this the best I can. The event follows this pattern: Page 1: when character enters event square, Change graphic to "shade" turn on localswitch "A" Page 2: When character enters event square, Change graphic to normal. turn off localswitch "A" I was looking for something that could be used on a global scale, maybe a script connected to the terrain type? (if that's possible.) Share this post Link to post Share on other sites
Jon Bon 43 Report post Posted June 27, 2012 Hmm. So your desired effect is that the character is changed to their 'shaded' graphic while on tiles that have the shaded graphic, correct? I am wondering, does your characters graphic not change to a 'shaded' version automatically by being 'underneath' the layer that the 'shadow' is on? Or are you simply wishing to use a 'more shaded' version of a graphic when in shaded areas? I only ask to better understand what your end result is intended to be so that I can try and suggest the best method. I think you should be able to achieve your effect with no events or scripts, but I could be wrong. Share this post Link to post Share on other sites
ForeverZer0 44 Report post Posted June 27, 2012 (edited) Could you not just display opaque pictures for "shade" areas? This would eliminate the need to change graphics at all. A script could be made to draw shaded areas without the need for actual graphics, but it may be a pain in the ass to configure, depending on how prevalent they are in your game. In fact, I'll see what I can whip up. I image the script could be pretty small. not more than 30-40 lines. EDIT: Alrighty, script is done. I'm gonna add some comments, instructions, etc., and will post it up, EDIT 2: See how this works out. Not sure if its exactly what you were looking for or not. http://pastebin.com/vgWn1qtj Edited June 27, 2012 by ForeverZer0 Share this post Link to post Share on other sites
WhiteRabbit 3 Report post Posted June 27, 2012 (edited) I tried using different variations of Priority to create a shadow effect, but due to its nature and the size of the Kaiser sprites it tends to clip them: I hope this helps. EDIT: I looked over your script ForeverZer0, hopefully I'll be able to test it out tomorrow. Edited June 27, 2012 by WhiteRabbit Share this post Link to post Share on other sites
diagostimo 11 Report post Posted June 27, 2012 i put this together as you described: #============================================================================== # *begin tone configuration #============================================================================== module Tone_Config #the terain tag the tone changes TONE_TERRAIN = 1 # set tone depended on terrain [RED, GREEN, BLUE] or [RED, GREEN, BLUE, GREY] #R, G, B settings = [min(-255), max(255)], gray settings = [min(0), max(255] NORMAL_TONE = [0, 0, 0] SHADED_TONE = [-40, -40, -40] end #============================================================================== # *end tone config #============================================================================== #============================================================================== # ** 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 update_tone update #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update update_tone self.tone = @character.tone end end #============================================================================== # ** Game_Character #------------------------------------------------------------------------------ # This class deals with characters. It's used as a superclass for the # Game_Player and Game_Event classes. #============================================================================== class Game_Character #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :tone alias init_tone initialize #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize init_tone @tone = Tone.new(0, 0, 0, 0) end #-------------------------------------------------------------------------- # * Set tone #-------------------------------------------------------------------------- def tone=(value) value = Tone.new(*value) @tone = value end end #-------------------------------------------------------------------------- class Game_Character #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # * Determine if Moving #-------------------------------------------------------------------------- def moving? # check to change the tone set_tone # If logical coordinates differ from real coordinates, # movement is occurring. return (@real_x != @x * 128 or @real_y != @y * 128) end #-------------------------------------------------------------------------- # * Check the terrain for the character #-------------------------------------------------------------------------- def set_tone t_id = Tone_Config::TONE_TERRAIN shade = Tone_Config::SHADED_TONE noshade = Tone_Config::NORMAL_TONE #get the terrain tag # upon which character is standing @terrain = $game_map.terrain_tag(@x, @y) #change character tone depending on terrain tag $game_player.tone = shade if @terrain == t_id $game_player.tone = noshade if @terrain != t_id for i in $game_map.events.keys $game_map.events[i].tone = shade if $game_map.events[i].terrain_tag == t_id $game_map.events[i].tone = noshade if $game_map.events[i].terrain_tag != t_id end end end it was good practice as im getting the hang of scripting, its pretty easy to setup ans works for the character and events :) Share this post Link to post Share on other sites
ForeverZer0 44 Report post Posted June 27, 2012 (edited) Ah, I see. It will just be a matter of changing the viewport to fix the "head sticking up" thing. I can fix when I get home from work. If not, I can make a graphic changer for you based off terrain tags. EDIT: I got to thinking, the terrain tag thing is much easier. I managed to create a simple way to do it in two methods, and it doesn't have the problems above, nor require the use of separate graphics. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ # Shade Terrain Tag # Author: ForeverZer0 # Version: 1.0 # Date: 6.27.2012 #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ # # Simply shades characters by blending a color with their sprites whenever they # are stepping on a tile with a specific terrain tag. Not a whole lote more to # it than that. # # See below to adjust the blend color and terrain tag number. # ##+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ #=============================================================================== # ** Game_Character #=============================================================================== class Game_Character #----------------------------------------------------------------------------- # * Configuration #----------------------------------------------------------------------------- SHADE_TERRAIN_TAG = 7 SHADE_COLOR = Color.new(0, 0, 0, 60) #----------------------------------------------------------------------------- # * Public Instance Variables #----------------------------------------------------------------------------- attr_reader :shaded #----------------------------------------------------------------------------- # * Frame Update (alias) #----------------------------------------------------------------------------- alias shade_terrain_tag_update update def update @shaded = self.terrain_tag == SHADE_TERRAIN_TAG shade_terrain_tag_update end end #=============================================================================== # ** Sprite_Character #=============================================================================== class Sprite_Character #----------------------------------------------------------------------------- # * Frame Update (alias) #----------------------------------------------------------------------------- alias shaded_blend_update update def update if @character.shaded && @blended == nil self.color = Game_Character::SHADE_COLOR @blended = true elsif !@character.shaded && @blended != nil self.color = Color.new(0, 0, 0, 0) @blended = nil end shaded_blend_update end end Edited June 27, 2012 by ForeverZer0 Share this post Link to post Share on other sites