ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
@finalrpg777 use flashLight ON/OFF in 1 condition brance
and use a switch to check.

(this is easier with a button common event (YEP or Eliaquim)
or a key mapper plugger.

If: script: Flashlight Switch = OFF
flash light is ON
Plugin command Flashlight ON
else
Flashlight is OFF
plugin command flashlight OFF
end

alternative, you can toggle it ON off by item.
but thats up to you.
 

mobiusclimber

Regular
Regular
Joined
May 3, 2018
Messages
425
Reaction score
207
First Language
english
Primarily Uses
RMMV
How do i make a flashlight turn on and off with the F key?

On whatever map you want this to work on, make an event set to parallel and do something like this:

Code:
◆Script:Input.keyMapper[65] = 'fireball'

Use this page for the number you use: https://asawicki.info/nosense/doc/devices/keyboard/key_codes.html

In the case of "F" it would be 70. Put 'flashlight' instead of 'fireball' (this is an example from my game, so I have the letter "a" shooting a fireball).

Then, make another event set to parallel and make a conditional branch, using this for the script:

Code:
Input.isTriggered("fireball")

of course, change "fireball" to "flashlight." and then you can put whatever you want to happen, in your case, choose "common event" and choose the one you made. I would make a switch and then use that switch to tell if the flashlight is on or off. From there, I'd make a conditional branch in the common event to say if the switch is on, turn the plugin command to off and it's off, turn it to off.

[edit: I was slow. :(]
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
@ShadowDragon @mobiusclimber
Thanks for the replies. I used ShadowDragon's method since i already have YEP_ButtonCommonEvents. I'm able to turn the flashlight on and off now!
Which brings me to another problem i had. I added a chest to the map which gives the flashlight but my character can already use the flashlight by pressing F without the chest giving it to him.
 

Attachments

  • Capture.JPG
    Capture.JPG
    69.1 KB · Views: 11

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
than you add a check to the flash light option:

if: player has flashlight
and the code above
end

this prevent the player using the flashlight if they dont have it :)
 

mobiusclimber

Regular
Regular
Joined
May 3, 2018
Messages
425
Reaction score
207
First Language
english
Primarily Uses
RMMV
And with my method, you'd set a condition on the two parallel events for either a switch to be on (and turn on the switch at the end of the treasure chest event), or simply set the condition to whether the player has the flashlight item. (In case anyone out there wants to use my method instead.)
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
than you add a check to the flash light option:

if: player has flashlight
and the code above
end

this prevent the player using the flashlight if they dont have it :)
Done!
 

Attachments

  • Capture.JPG
    Capture.JPG
    43.3 KB · Views: 13

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
@finalrpg777 you can add flashlight ON/OFF under the switches you set,
else you set everything double which is mostly executed AFTER the first
conditional check (this can delay things up).

combine it imrpove performance like I did as example above without
the flashlight check.
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
@finalrpg777 you can add flashlight ON/OFF under the switches you set,
else you set everything double which is mostly executed AFTER the first
conditional check (this can delay things up).

combine it imrpove performance like I did as example above without
the flashlight check.
You mean add it to the chest instead? Could you show me your coding?
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
to to flashlight switch like:

if player has flashlight (this checks the inventory)
If: script: Flashlight Switch = OFF
flash light is ON
Plugin command Flashlight ON
else
Flashlight is OFF
plugin command flashlight OFF
end
end

this way, its checks everything in 1 time within the conditional branch.

the way you did now =
check 1: check if player has flashlight, turn on switch
check 2: check if switch is on
check 3: check if switch is off

which are 3 conditionals, where mine just check the conditional inside
the 1 to see if its on else its off.
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
to to flashlight switch like:

if player has flashlight (this checks the inventory)
If: script: Flashlight Switch = OFF
flash light is ON
Plugin command Flashlight ON
else
Flashlight is OFF
plugin command flashlight OFF
end
end

this way, its checks everything in 1 time within the conditional branch.

the way you did now =
check 1: check if player has flashlight, turn on switch
check 2: check if switch is on
check 3: check if switch is off

which are 3 conditionals, where mine just check the conditional inside
the 1 to see if its on else its off.
Your coding is missing "If Flashlight is ON" so i was confused at first but i got it now.
 

Attachments

  • Capture.JPG
    Capture.JPG
    37.7 KB · Views: 10

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
I had it included :) so you might missreaded it, but it looks good.
it should work, while you check if its ON, I did it OFF, but it should
do the same way.

if it works, than your mostly good to go :)
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
I had it included :) so you might missreaded it, but it looks good.
it should work, while you check if its ON, I did it OFF, but it should
do the same way.

if it works, than your mostly good to go :)
Sorry but the way you write it is confusing for a beginner.
Like when you say "If: script: Flashlight Switch = OFF" for me "If" is a conditional branch, but you also write "script", so is it a conditional branch or a script?
Is "flash light is ON" a plugin command?
Theres no control switches used in your codes?
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
plugin command = from the plugin you use,

conditional branch => items => flashlight (check item in inventory)
conditional branch => switch light => off
switch light = ON
plugin command flashlight on (from this plugin)
else
switch light = OFF
plugin command flashlight off (from this plugin
end
end

there reason I start with off, is that the status of the switch = off from the start,
you can use ON but this has basicly the same result, depending the setup.

while switches starts being OFF, its a nice idea to start with it.
it might be a bit confusing how I wrote it, so my appoligies for that.
 

emelian65

Regular
Regular
Joined
Sep 13, 2015
Messages
226
Reaction score
70
First Language
Spanish
Primarily Uses
RMMV
I don't know if it had been asked before, but what are the proper Credits for this Plug-In?

Or is it good enough to redirect directly to this page?
 
Last edited:

Aesica

undefined
Regular
Joined
May 12, 2018
Messages
1,927
Reaction score
1,896
First Language
English
Primarily Uses
RMMZ
I don't know if it had been asked before, but what are the proper Credits for this Plug-In?

Or is it good enough to redirect directly to this page?
Everyone in the contributors list: Terrax, iVillain, Aesica, Eliaquim, Alexandre, Nekohime1989, Snaphat
 

finalrpg777

Regular
Regular
Joined
Oct 8, 2020
Messages
46
Reaction score
5
First Language
English
Primarily Uses
RMVXA
plugin command = from the plugin you use,

conditional branch => items => flashlight (check item in inventory)
conditional branch => switch light => off
switch light = ON
plugin command flashlight on (from this plugin)
else
switch light = OFF
plugin command flashlight off (from this plugin
end
end

there reason I start with off, is that the status of the switch = off from the start,
you can use ON but this has basicly the same result, depending the setup.

while switches starts being OFF, its a nice idea to start with it.
it might be a bit confusing how I wrote it, so my appoligies for that.
Thanks!!! Your code is understandable now and it works without issues :hhappy:
 

Mercurry

Warper
Member
Joined
Aug 31, 2014
Messages
4
Reaction score
4
First Language
Finnish
Primarily Uses
RMMZ
Thanks for this awesome plugin! However, trying to use this with the newly released ARPG plugin doesn't work (almost none of my other plugins work with it, including the lifesaver zoom-in plugin for 32px tilesets, ugh).
Would there be any way to make it compatible or is it just plain impossible? The lighting makes a huge difference in my game and I'd hate having to edit the maps manually with parallax, lol. Seems like the problem is caused by this plugin and the ARPG both using the notetags or something.

Any help is greatly appreciated!

Edit: Okay, I got it to work somehow. If any problems arise I'll update here. (Off-topic but for anyone interested, the zoom-in still doesn't work, since the attack event needs to grab info from the map and it conflicts. The only viable way is to do a manual tileset change with a plugin)
 
Last edited:

boydie96

Warper
Member
Joined
Feb 18, 2023
Messages
4
Reaction score
1
First Language
english
Primarily Uses
RMMZ
Really cool plugin, just a quick question...
How do I make a certain map full black, except for the flashlight or aura around you?
I know how to make the time change so it slowly gets dark over time, but I'm trying to make a cave that's pitch black, except for the flashlight.
Like pokemon caves.

Any help would be awesome.
TIA

--- edit
Nvm I managed to do what I wanted using this plugin and the Fog Of War plugin by Pheonix KageDesu
 
Last edited:

boydie96

Warper
Member
Joined
Feb 18, 2023
Messages
4
Reaction score
1
First Language
english
Primarily Uses
RMMZ
I'm having an issue now with some events causing crashes while trying to change time...
Code:
TypeError
Cannot read property 'r' of null
issue?
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
8,245
Reaction score
3,518
First Language
Dutch
Primarily Uses
RMMV
@boydie96
it might not be an issue, its more, you have a typo
some somewhere or missing something to be readed
correctly from the event or parallel you use.

double check the event where you use it and helpfile
to see what went wrong.

keep in mind that some are case sensitive or require a a comma or CL in front
if you didn't change parameters.
 

Latest Threads

Latest Posts

Latest Profile Posts

The X-Mas and ~ all ~ December long Calendar Project seems to bring my machine right to the limit. A very good oportunity to test what my pc can do. Or at which point I should decide to take a step back from filling the rendering program with assets.
The new grafics card and ram do their job well, that's for sure. My own early Christmas gifts were a good investment.
my laptop keyboard gave up, they keep glitching out, it seems like it's time to finally replace them, honestly surprised it lasted this long.
Tiny setback. Turns out my Title Screen image and one of my primary background & avatar images are AI Generated. Glad I went back and checked all my resource links. So I am in hot pursuit of replacement images. Which is fine since I was still missing some images that I need anyway.
Watching Vibrato Chain Battle System is too awesome! watch I wish had this gfx and animation skill to make such game!
Got drawn back by a notification about QPlugins. For those who want the MZ versions I was using, they're on my Github. https://github.com/ImaginaryVillain/QPlugins I literally don't care what you do with them, have fun! :LZSlol:

Meanwhile.. I'm glorying over these 550 new Victorian house models Epic gave me this month. See next post for examples....

Forum statistics

Threads
136,892
Messages
1,271,115
Members
180,670
Latest member
jakkapong
Top