Jump to content
Abaddyn

Jet's Mouse and Victor's Light Merging?

Recommended Posts

I am using RPG Maker VX Ace and I search the forums for about an hour to see if someone had already done this or asked for it.
 
I am not any good at scripting so I do not know if what I am attempting is possible. I am trying to create a mystery horror game using Khas Awesome Light Effects and Jet's Mouse scripts. I am wanting to have the mouse be the light source for the player. I am unsure how I would make this effect happen. I am curious if there is a way to have the mouse be an event or something of that nature? I will play around with it some until I give up or someone succeeds. I am hoping it will work. 

 

This is a video of an indie game the beloved PewDiePie (I am a bro!) did which does the exact effect I am looking for.
 
 

 

UPDATE 9/7

 

I am abandoning Khas Awesome Light Effects. While I find its wall edging to be very cool it seems to lag dramatically on my system. I am swapping over to Victors Light Effect. 
 

Everything below this point is just documenting for progress sake.

 

- I have tried taking one of the light images and renaming it to "cursor-mouse" as per Jet's Mouse line 90. It places a dark black circle and does not trigger as a light effect.
 
- I have created an event that looks like this 

l = $game_map.lantern
l.change_owner($cursor)
l.set_graphic("torch_m")
l.set_opacity(180,30)
 
l.show

However this causes an error with Khas' script. 
 
screen_zps92c62e75.jpg
 
I think I am on the right track I am just having difficulty getting there. Ultimately I would like to use the Lantern icon and have the light effect be used as the mouse. I am grateful for any help in this matter.
 
* Edit 8/27
I received a reply from Jet and he believes it is totally doable. So that is a good sign. Although off the top of his head he is unsure how.
 
* Edit 8/26
I noticed a thread on putting light on a fireball. http://www.rpgmakervxace.net/topic/12270-using-khas-lighting-on-a-fireball/
KilloZapit made an excellent script add on for Khas' light effect. I think this is where I should focus my attention. My guess is I need to modify her add on. 
 

class Sprite_Cursor < Sprite_Base

or 

$cursor = Sprite_Cursor.new

Then maybe putting the dlight scripting here?

class Sprite_Cursor < Sprite_Base
  
  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

Resulted in failure. Undefined method 'setup_light' for class 'Sprite_Cursor'
 
*Second attempt

class Sprite_Cursor < Sprite_Base
  
  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

The same 351 undefined direction error. Going to research how to fix the direction error.

Edited by Abaddyn

Share this post


Link to post
Share on other sites

Light sources are expected to be characters not sprites. if you notice I posed a module to allow any object to be a light source:

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
And you can use it with mixins like this:
class Sprite_Cursor < Sprite_Base
  include LightSource
end
I dunno if I ever actually tested it, but that's the basic idea.

 

Edit: Actually this probably won't work, it still expects to use real_x and real_y and other character attributes. Actually concerting that lights are map based, it might be easier to create a Game_Character subclass anyway.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

Thank you for your help. I am wondering if I should maybe just have an image attached to the mouse that effects the shade layer. Then parallax the shade on the whole map. It might not be dynamic real light but it might be simpler.

Share this post


Link to post
Share on other sites

I think what you may wanna do if you want dynamic light using my little add on, is make a Game_Character subclass that follows where the mouse is pointing actually... maybe a bit roundabout way of doing it but it may work better that way...

Share this post


Link to post
Share on other sites

I think what you may wanna do if you want dynamic light using my little add on, is make a Game_Character subclass that follows where the mouse is pointing actually... maybe a bit roundabout way of doing it but it may work better that way...

 

Are we talking something like

 

class Sprite_Cursor < Game_Character
  include LightSource
end

I am not a good coder at all. I am learning as I go. I am finding Victors Light Script way more easier. It does not make me want to drop kick my computer either.

Share this post


Link to post
Share on other sites

I am switching light engines for one that seems more workable. I also happened upon a video of a game that produces the exact effect I am after.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×