The Guardian 21 Posted February 6, 2013 Hello All! I apologize for (more or less) abandoning this community of helpful people! Had some stuff going on in life and had to leave for a bit. HOWEVER, I would like to know if anyone knows (unlikely) how to apply Khas' Lighting Effects to a mobile non-event fireball. The issue iIve run into is I am currently using the "XAS ABS" and "Khas Awesome Lighting Effects". they work together perfectly... except... when trying to light a Non-Event attack. So a monster shoots a fireball by using a script call (XAS ABS) in the custom move box. However, since the fireball itself is not an 'Event', I have no way of applying the lighting effect to it that I know of. The only way I can think of would be to apply the light effect to the 'Skill' itself. Unfortunately Khas' script doesn't show any way to apply that and i'm no scripter So if anyone has ideas or can help me in any way I would be forever grateful! Share this post Link to post Share on other sites
DangerZone 21 Posted February 11, 2013 Well, I have used Khas before, and XAS. I am no scripter, so I cannot directly help with your problem, other than offering this advice- Be more original and inventive. How about instead of a standard fireball attack, your monster spawns a fireball event that move towards the player, and when it comes into contact blows up and damages him? Then you could apply the light to the fireball, and add a little life, "light" and originality to your game. Pun intended. Share this post Link to post Share on other sites
Kayzee 3,815 Posted February 11, 2013 (edited) Even if it was an event, aren't all of the lights for events static? Though it shouldn't be hard to create dynamic lights for them I guess. Anyway here is a nice tip: You can make ANY object a light source and push it to the $game_map.light_sources array. Try something like this: module LightSource def set_light(light_gfx = nil, light_alpha = 255, light_flicker = 0) if light_gfx @light = Light_DSource.new unless @light @light.change_owner(self) @light.set_graphic(light_gfx) @light.set_opacity(light_alpha, light_flicker) @light.show @light_sources |= [self] else @light.dispose @light = nil $game_map.light_sources.delete(self) end end def draw_light restore_light if @light.bitmap.disposed sx = @light.sx sy = @light.sy w = @light.w h = @light.h return if sx > Graphics.width && sy > Graphics.height && 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 You should be able to include the module on the projectile classes and use the set_light method. Note: Not sure about the class, never used XAS. Edited February 11, 2013 by KilloZapit Share this post Link to post Share on other sites
The Guardian 21 Posted February 13, 2013 Sorry for the late reply, I aparrently had notifications on my email off XD Well, I have used Khas before, and XAS. I am no scripter, so I cannot directly help with your problem, other than offering this advice- Be more original and inventive. How about instead of a standard fireball attack, your monster spawns a fireball event that move towards the player, and when it comes into contact blows up and damages him? Then you could apply the light to the fireball, and add a little life, "light" and originality to your game. Pun intended. Love the pun XD however, this is specifically for the player to use as a projectile weapon via XAS, so it works exactly like a bow, except, its a fireball I looking to make it similar in attack to say... Diablo 1's fireball, shoot in in one direction and if it misses, too bad. But believe me when I say I REALLY REALLY tried to make this work via commands or events, but nothing worked the way I was looking for. I'm like you, no where near a scripter lol. I have a hard enough time deciphering it XD Even if it was an event, aren't all of the lights for events static? Though it shouldn't be hard to create dynamic lights for them I guess. Anyway here is a nice tip: You can make ANY object a light source and push it to the $game_map.light_sources array. Try something like this: module LightSource def set_light(light_gfx = nil, light_alpha = 255, light_flicker = 0) if light_gfx @light = Light_DSource.new unless @light @light.change_owner(self) @light.set_graphic(light_gfx) @light.set_opacity(light_alpha, light_flicker) @light.show @light_sources |= [self] else @light.dispose @light = nil $game_map.light_sources.delete(self) end end def draw_light restore_light if @light.bitmap.disposed sx = @light.sx sy = @light.sy w = @light.w h = @light.h return if sx > Graphics.width && sy > Graphics.height && 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 You should be able to include the module on the projectile classes and use the set_light method. Note: Not sure about the class, never used XAS. I'm currently at work so I won't be able to test this till tonight, however, It looks to me like it like you place this script in under Khas, and use this command in a script call: set_light(light_gfx = nil, light_alpha = 255, light_flicker = 0) replacing "light_gfx" with my graphic, and setting the the other two settings. Would that be correct? And that being said, XAS uses events placed on another map (The tool map) to provide the graphics on the map the player is playing on so it pulls them from the "tool" map onto the "current map", if thats helpful at all.Also, I REALLLY appreciate this help guys, This is why I love this community, so friendly Share this post Link to post Share on other sites
Kayzee 3,815 Posted February 13, 2013 (edited) it's a mixin module, you need to set classes to include it, like for example: class Game_Character < Game_CharacterBase include LightSource end That will include the module on all characters (including events, players, followers, whatever, though events have their own code so I am not sure how they would work together). Then set_light will be added to the list of methods for the character so you can do $game_player.set_light("light") So are tools events then or do they only use events as a base? Edited February 13, 2013 by KilloZapit Share this post Link to post Share on other sites
The Guardian 21 Posted February 13, 2013 (edited) This could work, (I think XD) and let me try to explain how XAS works: Actually I could direct you to the demo but it's in another language and I wouldn't want to impede on your time + you would have to use Khas too, and thats a pain XD So Xas uses 'Events' (Tools, i.e; Swords, Bows, Spears, ect.). These events are all compiled onto one map (Map ID 001 / The Tool Map) These 'Events' are drawn via the equipment the player uses (i.e. A sword, when equipped and used, draws event 01 from the tool map.) Now lets say you make another map (ID 002) and have your player on there, When you use the action button (Z) with a sword equipped you activate 'Event 01 (The sword swing)' on the tool map. So now, event 01's "auomated custom move route" is pulled into the map the player in currently in and activated on the spot the player is in, in the direction the player is facing. This applies to the player, monsters, events, ect. Really anything that can move can use the tool map events. So i guess what i need is a way to make an event light up, because, If I could apply Khas's Light effect via the move route then the problem would be solved!... So I need a script call XD If I remember correctly, I didn't know how to call the light into the event via the move route, as the 'Light effect' requires it to be placed in a comments box... EDIT: Ok, so i thought I had checked this before (I did) but you cannot add the light effect to the event itself, as it does not move with the graphic. The Fireball graphic moves forward, however the light effect stays on the character using it. So, How would I go about adding in the 'Light' effect to the moving graphic? Edited February 13, 2013 by The Guardian Share this post Link to post Share on other sites
Kayzee 3,815 Posted February 19, 2013 Yay! I made a addon script for Khas Awesome Light Effects... also posed it in that thread. But anyway this may help :3 #------------------------------------------------------------------------------- # * Dynamic Lights Addon for Khas Awesome Light Effects #------------------------------------------------------------------------------- # just use [dlight x] instead of [light x] #------------------------------------------------------------------------------- class Light_SSource def draw sx = self.sx sy = self.sy w = self.w h = self.h return if sx > Graphics.width && sy > Graphics.height && sx + w < 0 && sy + h < 0 $game_map.light_surface.bitmap.blt(sx, sy, self.bitmap, Rect.new(0,0,w,h), self.opacity) end end class Light_DSource < Light_SSource def set_shadow(shadow) @skip_shadow = !shadow end def draw btr = self.get_graphic x = self.x y = self.y r = self.range sx = x + r sy = y + r dr = r*2 $game_map.surfaces.each do |s| if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) s.render_shadow(x,y,sx,sy,r,btr) end end unless @skip_shadow $game_map.light_surface.bitmap.blt(self.sx, self.sy, btr, Rect.new(0,0,dr,dr), self.opacity) btr.dispose end end class Game_Character < Game_CharacterBase def set_dlight(light_gfx = nil, light_alpha = 255, light_flicker = 0, light_shadow = true) if light_gfx @light = Light_DSource.new unless @light @light.change_owner(self) @light.set_graphic(light_gfx) @light.set_opacity(light_alpha, light_flicker) @light.set_shadow(light_shadow) @light.show $game_map.light_sources |= [self] else @light.dispose @light = nil $game_map.light_sources.delete(self) end end def draw_light @light.draw if @light end def dispose_light @light.dispose end def restore_light @light.restore end end class Game_Event < Game_Character alias_method :setup_light_dynamic_base, :setup_light def setup_light(dispose) setup_light_dynamic_base(dispose) unless dispose && @list.nil? for command in @list if command.code == 108 && command.parameters[0].include?("[dlight") command.parameters[0].scan(/\[dlight\s*(\d+)\s*\]/) effect = Light_Core::Effects[$1.to_i] set_dlight(effect[0],effect[1],effect[2],effect[3]) return end end end end def draw_light super end def dispose_light super end def restore_light super end end class Spriteset_Map def update_lights return unless $game_map.light_surface $game_map.light_surface.bitmap.clear $game_map.light_surface.bitmap.fill_rect(0,0,Graphics.width, Graphics.height,$game_map.effect_surface.color) $game_map.light_sources.each { |source| source.draw_light } $game_map.lantern.draw if $game_map.lantern.visible end end 1 Sixth reacted to this Share this post Link to post Share on other sites
The Guardian 21 Posted February 19, 2013 Yay! I made a addon script for Khas Awesome Light Effects... also posed it in that thread. But anyway this may help :3 #------------------------------------------------------------------------------- # * Dynamic Lights Addon for Khas Awesome Light Effects #------------------------------------------------------------------------------- # just use [dlight x] instead of [light x] #------------------------------------------------------------------------------- class Light_SSource def draw sx = self.sx sy = self.sy w = self.w h = self.h return if sx > Graphics.width && sy > Graphics.height && sx + w < 0 && sy + h < 0 $game_map.light_surface.bitmap.blt(sx, sy, self.bitmap, Rect.new(0,0,w,h), self.opacity) end end class Light_DSource < Light_SSource def set_shadow(shadow) @skip_shadow = !shadow end def draw btr = self.get_graphic x = self.x y = self.y r = self.range sx = x + r sy = y + r dr = r*2 $game_map.surfaces.each do |s| if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) s.render_shadow(x,y,sx,sy,r,btr) end end unless @skip_shadow $game_map.light_surface.bitmap.blt(self.sx, self.sy, btr, Rect.new(0,0,dr,dr), self.opacity) btr.dispose end end class Game_Character < Game_CharacterBase def set_dlight(light_gfx = nil, light_alpha = 255, light_flicker = 0, light_shadow = true) if light_gfx @light = Light_DSource.new unless @light @light.change_owner(self) @light.set_graphic(light_gfx) @light.set_opacity(light_alpha, light_flicker) @light.set_shadow(light_shadow) @light.show $game_map.light_sources |= [self] else @light.dispose @light = nil $game_map.light_sources.delete(self) end end def draw_light @light.draw if @light end def dispose_light @light.dispose end def restore_light @light.restore end end class Game_Event < Game_Character alias_method :setup_light_dynamic_base, :setup_light def setup_light(dispose) setup_light_dynamic_base(dispose) unless dispose && @list.nil? for command in @list if command.code == 108 && command.parameters[0].include?("[dlight") command.parameters[0].scan(/\[dlight\s*(\d+)\s*\]/) effect = Light_Core::Effects[$1.to_i] set_dlight(effect[0],effect[1],effect[2],effect[3]) return end end end end def draw_light super end def dispose_light super end def restore_light super end end class Spriteset_Map def update_lights return unless $game_map.light_surface $game_map.light_surface.bitmap.clear $game_map.light_surface.bitmap.fill_rect(0,0,Graphics.width, Graphics.height,$game_map.effect_surface.color) $game_map.light_sources.each { |source| source.draw_light } $game_map.lantern.draw if $game_map.lantern.visible end end You... are such a boss... are so awesome... that I cannot explain how amazing this is! So I will humbly say: THANK YOU THANK YOU THANK YOU! This is perfect, and its exactly what I wanted :D After you read this you must say out loud to yourself: "I am AWESOME!" Share this post Link to post Share on other sites