Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Outdoor Lighting in RMXP

Tuna

Awesome Bro

This is for RMXP.

I know there are scripts out there that create entire light and shadow systems, but all I want is a simple glowing light around streetlights and lit-up windows in a dark town. What should I do? I am open to all suggestions.
 
I remember Kraft made a nice light glow charset somewhere, you could search for that. There's also one that comes with the RTP in the torchlight charset, but it's pretty small. (For best effect, set to Add and give it a little opacity.)
 

Tuna

Awesome Bro

Thanks for the help. I ended up trying the light tutorial that seven linked me to, and it turned out pretty well, but whenever the screen pans, so do all of the light images (and they do so very noticeably.) Would you mind hunting down one of those scripts for me?

thestorm2.png
 
Tuna":1gzstip6 said:
Would you mind hunting down one of those scripts for me?
Code:
#================================

# ■ Light Effects

#================================

#  By: Near Fantastica

#   Date: 28.06.05

#   Version: 3

#================================

 

class Spriteset_Map

 #--------------------------------------------------------------

 alias les_spriteset_map_initalize initialize

 alias les_spriteset_map_dispose dispose

 alias les_spriteset_map_update update

 #--------------------------------------------------------------

 def initialize

   @light_effects = []

   setup_lights

   les_spriteset_map_initalize

   update

 end

 #--------------------------------------------------------------

 def dispose

   les_spriteset_map_dispose

   for effect in @light_effects

     effect.light.dispose

   end

   @light_effects = []

 end

 #--------------------------------------------------------------

 def update

   les_spriteset_map_update

   update_light_effects

 end

 #--------------------------------------------------------------

 def setup_lights

   for event in $game_map.events.values

     next if event.list == nil

     for i in 0...event.list.size

       if event.list[i].code == 108 and event.list[i].parameters == ["Light Effects"]

         type = event.list[i+1].parameters.to_s

         case type.upcase!

         when "GROUND"

           light_effects = Light_Effect.new(event,type)

           light_effects.light.zoom_x = 200 / 100.0

           light_effects.light.zoom_y = 200 / 100.0

           light_effects.light.opacity = 50

           @light_effects.push(light_effects)

         when "FIRE"

           light_effects = Light_Effect.new(event,type)

           light_effects.light.zoom_x = 300 / 100.0

           light_effects.light.zoom_y = 300 / 100.0

           light_effects.light.opacity = 100

           @light_effects.push(light_effects)

         when "LAMPPOST"

           light_effects = Light_Effect.new(event,"LEFT LAMP POST")

           light_effects.light.opacity = 100

           @light_effects.push(light_effects)

           light_effects = Light_Effect.new(event,"RIGHT LAMP POST")

           light_effects.light.opacity = 100

           @light_effects.push(light_effects)

         when "LEFTLANTERN"

           light_effects = Light_Effect.new(event,type)

           light_effects.light.opacity = 150

           @light_effects.push(light_effects)

         when "RIGHTLANTERN"

           light_effects = Light_Effect.new(event,type)

           light_effects.light.opacity = 150

           @light_effects.push(light_effects)

         end

       end

     end

   end

   for effect in @light_effects

     case effect.type

     when "GROUND"

       effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4

       effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4

     when "FIRE"

       effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4

       effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4

     when "LEFT LAMP POST"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15

     when "RIGHT LAMP POST"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15

     when "LEFTLANTERN"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5

     when "RIGHTLANTERN"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5

     end

   end

 end

 #--------------------------------------------------------------

 def update_light_effects

   for effect in @light_effects

     next if not in_range?(effect.event)

     case effect.type

     when "GROUND"

       effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4

       effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4

     when "FIRE"

       effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4

       effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4

     when "LEFT LAMP POST"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15

     when "RIGHT LAMP POST"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15

     when "LEFTLANTERN"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5

     when "RIGHTLANTERN"

       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10

       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5

     end

   end

 end

 #--------------------------------------------------------------

 def in_range?(object)

   screne_x = $game_map.display_x

   screne_x -= 256

   screne_y = $game_map.display_y

   screne_y -= 256

   screne_width = $game_map.display_x

   screne_width += 2816

   screne_height = $game_map.display_y

   screne_height += 2176

   return false if object.real_x <= screne_x

   return false if object.real_x >= screne_width

   return false if object.real_y <= screne_y

   return false if object.real_y >= screne_height

   return true

 end

end

 

#================================

# ■ Light Effects Class

#================================

 

class Light_Effect

 #--------------------------------------------------------------

 attr_accessor :light

 attr_accessor :event

 attr_accessor :type

 #--------------------------------------------------------------

 def initialize(event, type)

   @light = Sprite.new

   @light.bitmap = RPG::Cache.picture("LE.PNG")

   @light.visible = true

   @light.z = 1000

   @event = event

   @type = type

 end

end
LE.png


Copy the script into your project and save the above image to your pictures folder with the name LE.png
For each event you want to have a light effect have two comments. The first should have the text "Light Effects" (without quotes). For the second comment have the name of the light effect: GROUND, FIRE, LAMPPOST, LEFTLANTERN, or RIGHTLANTERN). Credit goes to Near Fantastica for the script.

I realize that's a bit complicated, sorry. :x Let me know if it works alright.
 
Sorry for just bloating in here and throwing everyone else over, but I wonder why exactly you decided against using character sets for this... you don't need any custom scripting to make it work, can easily enable/disable them, even control their intensity by variables, and of course set wheather they should be on the floor or above everything easily (this is easier on VX actually, but still valid for XP) not to mention it has absolutely no problems whatsoever with panning, and need an event anyway as soon as you want triggerable lights (which is just so much easier when you use a characterset to begin with anyway).

Other than that, everything Regi said in his first post in here applies.
 

Tuna

Awesome Bro

Regi, I tried using that script and for some reason it makes my pictures disappear. While I wait for a response on that topic I think I'll try the script seven provided.

And BlueScope, I don't think charsets look nearly as nice as pictures because they don't have the "Add" effect which makes the light actually glow and pierce through the darkness.
 
Actually, charsets do have the Add effect. There's a small "Blending" dropdown list where you can set it to Sub or Add (as well as in the Set Move Route: Change Blending option).
 
Sorry I couldn't be of more help.

You can set Blending to Add for events when selecting the characterset; it's to the right of the graphic, under opacity. I'd suggest putting opacity around 150 or below; the higher the number, the brighter it is. I personally wouldn't suggest charactersets, but if nothing else works, go for it. I'm not sure where you can find graphics for it either, but some people do it by resizing the light characterset from the RTP to around 4 times its original size. Hopefully that'll work okay.

e; oops, regi beat me to it. ignore this post. >_>
 
Creating lighting graphics is work of two seconds in Photoshop or any similar editing program... especially as the default RMXP lighting tone (that bright yellow thing) is PS's default color for a lot of effects, meaning Enterbrain probably used just that. As for opacity, I wouldn't suggest messing with it too much in the editor, but within the charsets itself. It's really easy within PS, so if you have it, give it a shot - if you don't, tell me what you need and I'll make it for ya.
 

Tuna

Awesome Bro

I'd like to point out that the anchoring script that Regi redirected me to is completely different from what I'm trying to do. I managed to make a nice lighting charset, but it doesn't seem to shine as accurately on the player as pictures do. I'm going to experiment with Near Fantastica's script a bit more (which I cannot seem to get working), and if that doesn't go well I guess I'll settle for charsets.
 

Tuna

Awesome Bro

So when I use charsets, the first streetlight on the left is the result:

lighting.png


My problem with this is the light is much more white than the warm yellow of the others. I used the same picture with the same opacity, but it looks so awful in comparison. Any suggestions?
 
Regarding the anchoring script, like I said:
Regicida":11v8gn0v said:
sorry about the previous link, just realized that was Game Maker support, not RM.
Doesn't look like you've tried Kraft's charset I posted. It has a nice warmer orange tone, as well as a cool blue variant. Also quite large for streetlamps, but they can be resized.
 

Tuna

Awesome Bro

I tried Kraft's charset. It just doesn't look like I want it to. I'm looking for a nice smooth yellow like the one I have in the picture. I just don't know how to get the color right. If I knew how to make these transparent circles I could do this so easily.
 

Tuna

Awesome Bro

Well, I managed to make my own lights, but unfortunately Paint.NET won't allow me to combine two colors in a gradient, so these lights are just yellow. I'm trying to get someone with Photoshop to make a better one for me, but for now this is what I've come up with:

lighting2.png
 
If you tell me what you need, I can do that for you... that includes what size you want (pixel-wise), what colors, and when you want the gradient to change to what (aka innermost 20% will be white, then gradient for 55% to yellow, and last 25% yellow, for example). If have specific color values to use, I can of course implement that, but I also have own one's I'd apply.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top