Player Moving with Light (Help!)

Hi,

I am new to the forums and new with RPG Maker VX Ace. I am currently working on an assignment and my partner suggested we should use RPG Maker and I agreed because I want to learn more about RPG Maker.

Anyway, we are currently stuck on a mechanic that we want to happen in the game. Let me set the scenario. It is in the city, at night (with light poles that are on) and cars passing by with the headlights on. The main character can only move then there is light, so to get from one light pole to the next, the player would have to walk with the car (that has the headlight on). I have also attacked an image for visual help.

Would it be possible to do it is a moving platform or is there another way to do it or is it impossible?

Lots of suggestions, advice and help would be appreciated.

Thanks,

lilMessy

help.png
How would you define "light" in this scenario?

Going with overlays, it could be possible to determine if the current screen position of the player has a non-black (aka lit) pixel in a light overlay.

By using Khas script (http://forums.rpgmakerweb.com/index.php?/topic/4917-khas-awesome-light-effects/), you can determine if a pixel is lit (see last page) and translate this to the player position.

It requires scripting and most likely won't be easy, but it should be possible.
How would you define "light" in this scenario?

Going with overlays, it could be possible to determine if the current screen position of the player has a non-black (aka lit) pixel in a light overlay.

By using Khas script (http://forums.rpgmakerweb.com/index.php?/topic/4917-khas-awesome-light-effects/), you can determine if a pixel is lit (see last page) and translate this to the player position.

It requires scripting and most likely won't be easy, but it should be possible.
Hi Lavra,

Thanks for the reply. I will take a look at it and show my friend.

I want something like the file I attached.

As for light, I mean like a street lamp post.

lilMessy
The problem is something else - you need to define how the program would know where the light is and where not.


That could be something like "within three tiles of position XY" if the position XY is the lamp post - but if you say "only where the lamp post is" then you would have the actor jumping from one top of a lamppost to another only...


But the engine will never understand something like "where the light is", because for the engine there is nothing like "light" - you usually create the illusion of light to the player by placing overlays that are partially transparent (where the light is) and partially black pixels (where the dark is), but the engine cannot analyse those overlays to detect the tiles with light, you have to tell that in a different way.
Well, in theory you could take the player's center pixel (or multiple, but those of course mean more calculations), translate them to your overlay bitmaps and see if the color there is something else than [0, 0, 0, 255] (black). This would probably work ok for static light, like your lamp post, but could get very complicated with moving lights, like the cars.

I've done something similar to detect collision of bullets with walls. For my script, i stored the collision zones as a separate image (could have created them on map load via terrrain tags, but this way i could do collisions that weren't 32x32), loaded it with the map, translated the bullet positions to the bitmap and checked the pixel color there.
I think Khas answered to checking if something is currently in light, using their script.

http://forums.rpgmakerweb.com/index.php?/topic/4917-khas-awesome-light-effects/?p=391208
The problem is something else - you need to define how the program would know where the light is and where not.

That could be something like "within three tiles of position XY" if the position XY is the lamp post - but if you say "only where the lamp post is" then you would have the actor jumping from one top of a lamppost to another only...

But the engine will never understand something like "where the light is", because for the engine there is nothing like "light" - you usually create the illusion of light to the player by placing overlays that are partially transparent (where the light is) and partially black pixels (where the dark is), but the engine cannot analyse those overlays to detect the tiles with light, you have to tell that in a different way.
Thanks for the reply Andar.

I will test it will my friend today. Just wondering is it possible instead of using light from RPG Maker, what if the light was image tiles? and the player would have to move with these tiles. Would it be easier that way?

Well, in theory you could take the player's center pixel (or multiple, but those of course mean more calculations), translate them to your overlay bitmaps and see if the color there is something else than [0, 0, 0, 255] (black). This would probably work ok for static light, like your lamp post, but could get very complicated with moving lights, like the cars.

I've done something similar to detect collision of bullets with walls. For my script, i stored the collision zones as a separate image (could have created them on map load via terrrain tags, but this way i could do collisions that weren't 32x32), loaded it with the map, translated the bullet positions to the bitmap and checked the pixel color there.
Thanks for helping Lavra.

I will show this to my friend and see how it goes.

lilMessy
Hello,

It is not possible to make the tiles moves. So you won't be hable to do the headlights that way.

Anyway, I found a good way to solve your problem.

It works with events and it's quite easy. You just check if the player is under the light poles by using regions Id and you check if he is under the headlights by checking theirs and the player position on the map.

Just see this demo.

https://www.dropbox.com/s/gj1ezlqeuoisstq/Player%20Moving%20with%20Light.exe?dl=0

Hope I helped.
Hello,

It is not possible to make the tiles moves. So you won't be hable to do the headlights that way.

Anyway, I found a good way to solve your problem.

It works with events and it's quite easy. You just check if the player is under the light poles by using regions Id and you check if he is under the headlights by checking theirs and the player position on the map.

Just see this demo.

https://www.dropbox.com/s/gj1ezlqeuoisstq/Player%20Moving%20with%20Light.exe?dl=0

Hope I helped.
OMG THIS HELP SO MUCH!!! THANK YOU!!!

We will also be crediting you in our assignment game.

Thanks so much,

lilMessy

Original thread: https://forums.rpgmakerweb.com/threads/player-moving-with-light-help.39730/