SirCumferance 28 Posted June 25, 2012 Yes sir. Normally a teleport does the trick, but I have never done this stuff while scripting, so...yea. By the way, where you guys find the information that you give us? Share this post Link to post Share on other sites
casper667 131 Posted June 25, 2012 Put this below CSCA Dungeon Tools in your materials section: class Game_Map include CSCA_DUNGEON_TOOLS alias csca_mod_hookshot use_hookshot def use_hookshot csca_player_transparent(true) csca_mod_hookshot end def csca_player_transparent(t_f) $game_player.transparent = t_f end alias csca_transparent_off csca_hookshot_finish def csca_hookshot_finish $game_player.followers.csca_moveto($game_player.x, $game_player.y) csca_player_transparent(false) csca_transparent_off end end class Game_Followers def csca_moveto(x,y) visible_folloers.all? {|follower| follower.csca_moveto(x,y) } end end class Game_Follower < Game_Character def csca_moveto(x,y) moveto(x,y) end end I don't know what you mean by find the information... I type this all out by hand =x? Share this post Link to post Share on other sites
SirCumferance 28 Posted June 25, 2012 (edited) What I mean is, how do you know that transparent(true) is the way to go? Wasnt sure if there is a book that has all the little things that you can do, lol. Oh, and thanks. You are quick with the scripts, hope I am not too much of a pain with the requests. EDIT: I tweaked the code a touch, hope its cool. I added csca_player_transparent(true) to hookshot success and took out csca_mod so that way he only turns invis when the hookshot works. I was wondering too, the hookshot only seems to work at extreme range, not in between. I mean that you have to be at 4 spaces away for it to work, it will not work for just two spaces. Was this intended? Edited June 25, 2012 by Juan Alvarado Share this post Link to post Share on other sites
casper667 131 Posted June 25, 2012 (edited) I just look through the code to see what to type, it's not hard to trace back to what you want The hookshot works at all ranges in my test project... not sure why it is behaving that way for you. Edited June 25, 2012 by casper667 Share this post Link to post Share on other sites
SirCumferance 28 Posted June 25, 2012 Ah, I think it might be my terrain tags. I got it to work at short range UNLESS they are on tags... trial and error time, lol. Thanks Share this post Link to post Share on other sites
Gleen 0 Posted June 26, 2012 Is there a way to make events have a higer priority than your check_through method? I mean, if an event is walking on a region_id 1 and you use an arrow it'll pass through the event... Share this post Link to post Share on other sites
SirCumferance 28 Posted June 26, 2012 I have been trying to figure that out too, trying to get the arrow to work on enemies that move around through regions. I just said eff it and made the arrows a ground based ability, so that way I dont have to worry about them passing over pits, cuz they wont, lol. But, that would be cool... Share this post Link to post Share on other sites
Gleen 0 Posted June 27, 2012 Bird Eater at RPG Maker web kindly provided a solution for that (check the thread here). Just replace the old csca_check_through method with this one: def csca_check_through if check_passable_event == false @csca_event.csca_change_through(false) else csca_get_event d = @csca_event.direction if (region_id(@csca_event.x, @csca_event.y) == REGION_ID1) || (d == 2 && region_id(@csca_event.x, @csca_event.y) == REGION_ID2) || (d == 4 && region_id(@csca_event.x, @csca_event.y) == REGION_ID3) || (d == 6 && region_id(@csca_event.x, @csca_event.y) == REGION_ID4) || (d == 8 && region_id(@csca_event.x, @csca_event.y) == REGION_ID5) || ((d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID6) || ((d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID7) || ((d == 2 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID8) || ((d == 2 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID9) || ((d == 2 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID10) || ((d == 4 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID11) || ((d == 4 || d == 6 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID12) || ((d == 4 || d == 6 || d == 2) && region_id(@csca_event.x, @csca_event.y) == REGION_ID13) || ((d == 2 || d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID14) || ((d == 2 || d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID15) || @hookshot_reverse_dir == true @csca_event.csca_change_through(true) else @csca_event.csca_change_through(false) end end end def check_passable_event(e=@csca_event) arr = letsdothis(ahead(@csca_event,1,@csca_event.direction)) if arr != nil && $game_map.events[arr].priority_type ==1 && $game_map.events[arr].through == false return false else return true end end def ahead(e,r,d) ev = @csca_event v = [ev.x,ev.y] case d when 2; v[1] += r when 4; v[0] -= r when 6; v[0] += r when 8; v[1] -= r when 3; v[1] += r; v[0] -= r when 7; v[1] -= r; v[0] -= r when 5; v[1] -= r; v[0] += r when 1; v[1] += r; v[0] += r end return v end def letsdothis(w) evs = $game_map.events_xy(w[0],w[1]) return nil if evs.empty? evs.each{ |e| return e.id if e.priority_type > 0 } return evs[0].id end Yes, i'm doing an enhanced version based on this, and please do credit Bird Eater for this fix if anyone uses it. Share this post Link to post Share on other sites
SirCumferance 28 Posted June 28, 2012 I was hoping this would fix my problem, but the hookshot still only grabs events at max range if we are both in a region, in this case, 10. If I step out of the region its no biggy, hooks onto as it is supposed to. What am I doing wrong? The left is it working at max range, the right is it going through at closer range. Both are in terrain ID 10 Share this post Link to post Share on other sites
casper667 131 Posted July 12, 2012 Script has been updated to add what you guys wanted Update 1.4b - Region ID 1 will no longer allow tools to go through events. Use the other regions for this effect. (Toggle-able). Share this post Link to post Share on other sites
demonking39 1 Posted July 24, 2012 Hey Casper, I checked out the script and I think its an awesome concept. I was just wondering if there was any possibility you could run a "call script" to allow the player to change the distance values of the items. So the hookshot, for example, has a distance of 4, but can later be upgraded to the longshot, which has a distance of 8. Also, if there was a "call script" to change the name of the tool for an occasion such as the example provided that would be awesome. Something like: @CSCA_DUNGEON_TOOLS.HOOKSHOT_DIST = 8 and @CSCA_DUNGEON_TOOLS.HOOKSHOT_NAME = "Longshot" Let me know if this is possible. Share this post Link to post Share on other sites
casper667 131 Posted July 24, 2012 To change module settings in the middle of a game, make this script call: CSCA_DUNGEON_TOOLS::HOOKSHOT_DIST = 8 you can replace HOOKSHOT_DIST or the 8 with whatever variable/number you want. Share this post Link to post Share on other sites
demonking39 1 Posted July 29, 2012 To change module settings in the middle of a game, make this script call: CSCA_DUNGEON_TOOLS::HOOKSHOT_DIST = 8 you can replace HOOKSHOT_DIST or the 8 with whatever variable/number you want. Thanks Casper. I assume that it works the same with changing the information within a string so that I can rename the tools once they receive an upgrade? Share this post Link to post Share on other sites
casper667 131 Posted July 29, 2012 Yes, you can change all constants that way Share this post Link to post Share on other sites
Grimmnir 1 Posted August 4, 2012 (edited) Hi! Recently I discovered that the Khas Lighting Mod does not seem to be compatible with this script. When applying the dungeon script, the script call to change the alpha s = $game_map.effect_surface s.change_alpha(10,150) (As example) does not actually do anything, in earlier parts of the game. Yet, in other parts, when both scripts are used at the same time, it works, sometimes I'll paste the Lighting mod script here, and ask you, could you make these scripts compatible somehow? #------------------------------------------------------------------------------- # * [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::PI/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 Edited August 4, 2012 by Grimmnir 1 Share this post Link to post Share on other sites
J F K 1 Posted August 6, 2012 I was wondering if someone would be able to make a quick fix for something in the script. I need it to where if a tool's switch (Ex. Arrows) is turned on, it's automatically equipped, and when it's turned off, it's automatically unequipped. What I'm going to do is disable the screen that let's you change what tool you're equipping, and have it to where only a certain character can use a certain tool. I've got it all set up now, to where if you switch a character to the front of the formation, the switches for all other tools are turned off and their tool's switch is turned on, but if you press the button to use the tool, it's still the same tool that the last character used. And even if that didn't happen, you'd have to go into the tool menu to change to your character's tool, which is useless because you have one tool to choose from. Any idea what to do to get the character to automatically have the tool ready whenever I switch them to the front of the formation? Share this post Link to post Share on other sites
casper667 131 Posted August 6, 2012 @Grimmnir I'm sorry, could you please give more info? You said it works sometimes...what are the conditions for it to stop working? @J F K if you already have a system set up to turn switches on based on party leader, just use the control variables command to set the variable you have specified for CSCADGT in the script to 1(arrow), 2(bomb), 3(hookshot), or 4(boomerang). If it is set to 5 the map will automatically reset. 1 Share this post Link to post Share on other sites
J F K 1 Posted August 7, 2012 THANKS! You're a life saver Also, I use the 1.1 version of the script as well as Khas Awesome Light Effects and never have any problems Share this post Link to post Share on other sites
estriole 326 Posted August 9, 2012 just for the info. your script and victor - antilag script is not compatible. perhaps this will help people which confused why the arrow not shooting immediately when using both script. just choose either csca dungeon tools or victor - antilag and not use both. Share this post Link to post Share on other sites
Sievn 3 Posted August 30, 2012 (edited) Amazing script. I don't know if you could help me but, I am using a battle system that allows me to throw particles (similiar) to arrow but using the Up arrow. The Button to launch an attack is the Up arror. The Up arrow acts like any other button, I could use the up arrow to throw the attacks left and right and down. How ever when I use your script it Automaticly forces me to change direction, I mean I want to use the up arrow to attack but I don't want the character to move or change direction (so I attack left and right). Is their a way to make your system only works when standing and not moving, and doesn't force you to change direction? P.S : I know no way to change the Function of that battle system neither your script. Edited August 30, 2012 by Sievn Share this post Link to post Share on other sites
casper667 131 Posted August 30, 2012 Try pasting this script above the battle system, if that doesn't work try pasting this script below the battle system. If neither works tell me which battle system you're using and I can see if I can make a compatibility patch for it, but in the end you may just have to end up choosing this script or your battle system script and not using the other. Share this post Link to post Share on other sites
Sievn 3 Posted August 30, 2012 (edited) Try pasting this script above the battle system, if that doesn't work try pasting this script below the battle system. If neither works tell me which battle system you're using and I can see if I can make a compatibility patch for it, but in the end you may just have to end up choosing this script or your battle system script and not using the other. Works now, thanks. I put it below the battle system. The best thing about your script that it works with my battle engine Every thing works fine now, don't edit directiosn or any thing. As for the reset option, it doesn't work even without my script. It gives undefined method 'size' for nil:nillclass line 850 On the demo without any of my scripts after upgrading the script to the new version. Edited August 30, 2012 by Sievn Share this post Link to post Share on other sites
casper667 131 Posted August 30, 2012 The demo is outdated, I have not been able to reproduce that error in a recent version of the script. If you could give more info on exactly what conditions cause that error or upload a project that has that error it would be easier to help you. Share this post Link to post Share on other sites
titogod 0 Posted September 2, 2012 (edited) Hello Casper, I have an error with this script.... when I hit the enemies they stay like this: http://www.pixhost.o...523_problem.png what can we do? Also when I try to use the arrow or an item from this script I get an error on line 476. Edited September 2, 2012 by titogod Share this post Link to post Share on other sites
Sievn 3 Posted September 2, 2012 (edited) Hello Casper, I have an error with this script.... when I hit the enemies they stay like this: http://www.pixhost.o...523_problem.png what can we do? Also when I try to use the arrow or an item from this script I get an error on line 476. Try putting dungeon tools on TOP of ALL scripts. EDIT : Also tell me what scripts are you using? Edited September 2, 2012 by Sievn Share this post Link to post Share on other sites