Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: finalholylight on April 08, 2014, 07:59:38 am

Title: [XP] Dynamic Lights by Fabien
Post by: finalholylight on April 08, 2014, 07:59:38 am
Dynamic Lights
Authors: Fabien
Version: 3.0
Type: Custom Lights
Key Term: Custom Environment System



Introduction

I don't own this script, all info in script is French language, I just use Google translate.
Cause of my bad English, please see pictures -,-



Features




Screenshots
Spoiler: ShowHide

(http://i663.photobucket.com/albums/uu358/finalholylight/dynamic_light01_zps7242530e.jpg)

(http://i663.photobucket.com/albums/uu358/finalholylight/dynamic_light02_zps1e215735.jpg)

(http://i663.photobucket.com/albums/uu358/finalholylight/dynamic_light03_zps5581d492.jpg)

(http://i663.photobucket.com/albums/uu358/finalholylight/dynamic_light04_zps11b8e338.jpg)

(http://i663.photobucket.com/albums/uu358/finalholylight/dynamic_light05_zpsa2be33bf.jpg)




Script

In demo






Demo

https://www.mediafire.com/?4dh836e78tbc7mz




Instructions

Create an event that call script: "ecran_nuit" to initialize then call a parallel script "lum (name , id)" as many times as you want lights, with "name" the file name of the image of light and "id" is id of the event wearing light.

Ex:
ecran_nuit(240)
or
ecran_nuit(240,0,0,0)
init the dark, only call once (opacity of the dark, red, green, blue)
then call
lum("lampe2",0,255-rand(50))
 (image of light, event id, opacity) (event id = 0 means player)
by using this script call, light like a torch.
or
lumF("lampe2",0,80) if $game_player.moving?

by using this script call, map will be reveal like picture 1



Compatibility

No problems so far!



Credits and Thanks



Title: Re: [XP] Dynamic Lights by Fabien
Post by: ForeverZer0 on April 08, 2014, 09:52:33 am
Did you get permission of the author to post the script here?
Title: Re: [XP] Dynamic Lights by Fabien
Post by: finalholylight on April 08, 2014, 10:27:24 am
Hmm, I have this demo 4 years ago, now I don't remember where I download this, I think it's no problem to upload it, and in the introduction of the script, I don't see author mentions anything about rule of posting his script, hmm, I think he will be okay.
Title: Re: [XP] Dynamic Lights by Fabien
Post by: Heretic86 on April 08, 2014, 05:50:33 pm
Note: Start the demo from New Game, not the save game.

The script itself is pulling off some very cool things.  Its extremely impressive.  It may need to be translated better...
Title: Re: [XP] Dynamic Lights by Fabien
Post by: Ranquil on April 12, 2014, 09:51:19 am
Regarding the demo:
The guy with the lamp often blocks me from moving, like trapping me into a corner, forcing me to restart the game. Also, if I try to go to the town without the flashlight, the demo will just endlessly show me the message telling me to get the flashlight. The thing is, every time I get the message out of the way, it comes immediately back, so I can't go and get the flashlight.

Regarding the instructions:
Pardon, but I don't understand it at all. This may or may not have something to do with the fact I don't speak English natively. Please don't use Google Translate when publishing something; oftentimes it's just not comprehensible. This definitely needs a better translation.

Regarding the script:
Awesome! C'est magnifique! :3
Title: Re: [XP] Dynamic Lights by Fabien
Post by: Heretic86 on April 12, 2014, 05:46:31 pm
If you happen to speak the same language as the original version of the script was created in, perhaps you'd be interested in assisting in translating the script?  Also, you might be able to get in contact with the original author to get that permission to both translate and distribute on CP.  Sometimes, getting ahold of the original author is challenging, but getting ahold of the original author when we speak different languages is much more difficult.

Agree, the mapping had some issues, getting stuck and what not.  Just hold down CTRL and walk through everyone.

Now, just looking at the way the code itself works, I havent figured any of it out yet, but it looks like it could be made to be much much easier.  And translation can provide a means of doing this with a knowledgable scripter.
Title: Re: [XP] Dynamic Lights by Fabien
Post by: Ranquil on April 12, 2014, 08:19:52 pm
Quote from: Heretic86 on April 12, 2014, 05:46:31 pm
If you happen to speak the same language as the original version of the script was created in, perhaps you'd be interested in assisting in translating the script?


Sorry, my French skills are very minimal; I last studied - and used - French four years ago and I don't remember pretty much anything about the language anymore. I understood just a bit of the game and I mostly just used Google Translate to get a rough idea on what different things meant. It wasn't very easy though.

Quote from: Heretic86 on April 12, 2014, 05:46:31 pmJust hold down CTRL and walk through everyone.


@___ò
Why has no one told me this before!?
Title: Re: [XP] Dynamic Lights by Fabien
Post by: finalholylight on April 13, 2014, 11:54:01 am
Okay, finally, I asked author and had his permission of posting his script.

Spoiler: ShowHide

(http://i663.photobucket.com/albums/uu358/finalholylight/fabien_script01_zps80afbf30.jpg)


Now, the only thing is translate it better. Cause of my bad English and I don't know French, I can not do that :D. So that please someone do it and post a new topic.
Title: Re: [XP] Dynamic Lights by Fabien
Post by: Spaceman McConaughey on May 29, 2014, 12:44:36 am
Alright, this is confusing as all fuck.

Even looking at the demo, I cannot for the life of me figure it out. :|
How do I mimic the lighting in screenshot #2?

Also, I literally cannot have more than one light source visible at a time.
Need help.

EDIT:
Plenty of anger later, and I figured it out. :|
Title: Re: [XP] Dynamic Lights by Fabien
Post by: ArcaneAlchemy on June 24, 2014, 09:17:13 pm
Okay so I edited this with tutorials to help out those in need that are as confused as I once was!

TUTORIALS BELOW

HERE ARE STEPS TO GET IT WORKING PARTIALLY
Spoiler: ShowHide

To light yourself a torch/flashlight:

1. Go ahead and locate your picture that you want to use for your flashlight. If using the demo as a ..well ... demo then go ahead and make a note of the location in your folder called Graphics/Pictures/lumieres (lumieres means "lights" btw since I've been reading French for the past f-cking hour). If using the demo, you'll see a whole bunch of names.

2. Go ahead and choose one. I chose "lampe2" for my little flashlight/torch thing. It will work just fine for you too. It kinda looks like a torch or something.

3. Make a parallel process triggered event on a new map and paste in the following script:

ecran_nuit(240)
lum("lampe2",0,255)

So what the hell does that mean? ecran_nuit translates to "wallpaper_night", whatever the hell that means. Actually what they mean by that is they are taking an image and overlaying it to a closer z index on the screen. The picture is overlapping what is on the map.
the (240) is the opacity. You can change this if you'd like the 'darkness' aka. wallpaper_night to be more or less opaque.

so what about the lum("lampe2",0,255) part? Well it's pretty simple.
the "lum" stands for light. So I just think of the word 'light' or like lumination.
Inside the parenthesis it goes as follows:

lum("name_of_image",event_id,opacity)

the image I used was lampe2. The event_id of 0 is the main character sprite. Opacity is at max(255)

So that's how you get yourself a nice little torch. But what about all the other cool shit with the lamps lighting at the same time?

Here's where it really confused me. So, apparently, if you try to use more than one parallel process to illuminate lamps, the game will shit all over itself for no apparent reason. No matter how much French you learn in one day, it will still be more confusing and less telling than a creepy mime on the corner of the wine bistro.

HOW WE SET UP LIGHTS AND TORCH AT THE SAME TIME:(This is good for a flickering torch-like effect)

Here's the meat and potatoes:

1. If you followed my last rant, then you should already have the torch on your player. You will want to use A SINGLE parallel process for all of this, so I will go ahead and post in the script for both the player torch AND the lamp torches. Add this to a SINGLE event on a blank map. I suggest using a map texture set that has something that resembles a light or torch for visual satisfaction purposes only. In this map, make an event for your parallel process, and make three more for your lamps. I did mine like so:

[spoiler](http://s17.postimg.org/jzsmfezu3/examplepic.jpg) (http://postimg.org/image/jzsmfezu3/)




here's the script:


ecran_nuit(240)
lum("lampe2",0,255)
lum("lampe2",1,255-rand(50))
lum("lampe2",2,255-rand(50))
lum("lampe2",3,255-rand(50))


You will notice a few things. Firstly, you will see the code for the original stuff. The first two lines make it dark and give your player a lamp(player = event #0) But if you look above, you'll know this. The next three lines are similar. The numbers after the "lampe2" part are the event id numbers. The other thing you will notice is that in the opacity section, it's set to 255-rand(50). This will create a flickering effect, essentially subtracting a random value of 0-49 of opacity.

Anyway, when you're all said and done, run it and it'll look like this:
Spoiler: ShowHide
(http://s9.postimg.org/7iky8w5tn/ex2222.jpg) (http://postimg.org/image/7iky8w5tn/)


[/spoiler]

HOW TO ILLUMINATE A TILE TYPE AND REPEAT WITHOUT ADDITIONAL SCRIPTING(like in example 2 in demo)
Please use the provided demo here to make this easy for the both of us.

This one really confused me for a bit but I figured it out and man I'm so freaking excited!  :D
Spoiler: ShowHide

Step 1. Make a plain old map like this one. Use the Castle town map for this(it's called Ville Forte Ext in the french demo)

[spoiler](http://s9.postimg.org/vearetq4b/plainmap.jpg) (http://postimg.org/image/vearetq4b/)


Step 2. Add in a couple of lamps(take note of the coordinates of one of the tops of your lamps is located)VERY IMPORTANT

Spoiler: ShowHide
(http://s15.postimg.org/k2b0z85nr/coordinates.jpg) (http://postimg.org/image/k2b0z85nr/)


The tip of my lamp in in the picture is at (003,006) x=3 and y=6 *remember this part

Step 3. Set up a parallel process event like so:

Spoiler: ShowHide
(http://s28.postimg.org/89of82j5l/eventpic.jpg) (http://postimg.org/image/89of82j5l/)


Here is the code to put in there:

ecran_nuit(220)
lum_tile("lampadaire",3,6,1,255,-60,-16)

Firstly, there is the ecran_nuit(220). This is just to set up the darkness at 220 opacity.

Secondly there is the lum_tile() part and I will break down each section.
The overview is: lum_tile("name_of_light_picture",x_coordinate_of_tile, y_coordinate_of_tile, not_sure, opacity, image_x, image_y)

Phew, so let's look at these:



Phew.

Step 4. Now that you've figured out where one lamp tip or torch flame should be at, use a proper picture. I used the "lampadaire" image for the lamp post because that's what it's made for.

If all goes well, you'll be able to post lamps over and over with no additional scripting and they will automatically be lit up. This effect will be more like a solid light. For a flickering effect, use this in opacity

255 - rand(50)     You don't have to use 50 in the rand, use whatever you want. you could even wait a few frames in the event to change the effect as well.

Hopefully you ended up with this:

Spoiler: ShowHide
(http://s29.postimg.org/vz7c2uztf/zdone.jpg) (http://postimg.org/image/vz7c2uztf/)


This took a while so you are welcome! 8) Enjoy.

[/spoiler]


Title: Re: [XP] Dynamic Lights by Fabien
Post by: Sylphe on July 03, 2014, 08:31:28 am
wow, so you learned french just for this script o_O
Tu es vraiment fort ! XD anyway  very good explanation I lvl up you
Title: Re: [XP] Dynamic Lights by Fabien
Post by: PhoenixFire on July 03, 2014, 08:44:30 am
nifty! see, now with this translation and instructions, I might actually use this. I've always wondered why it was so hard to find a radius lighting script...
Title: Re: [XP] Dynamic Lights by Fabien
Post by: ArcaneAlchemy on July 03, 2014, 09:30:44 am
Yeah, I actually added more instructions and completely translated the scripts and the demo. http://forum.chaos-project.com/index.php/topic,14284.msg186222.html#msg186222

I'm just wondering when they'll add it to the database...