ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
Joined
May 3, 2018
Messages
416
Reaction score
205
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

Veteran
Veteran
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: 8

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
Joined
May 3, 2018
Messages
416
Reaction score
205
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

Veteran
Veteran
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: 12

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
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: 9

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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

Veteran
Veteran
Joined
Sep 13, 2015
Messages
222
Reaction score
68
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
Veteran
Joined
May 12, 2018
Messages
1,925
Reaction score
1,883
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

Veteran
Veteran
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
Veteran
Joined
Oct 8, 2018
Messages
7,513
Reaction score
3,021
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 Profile Posts

imgur sure is getting weird, one day I lose gradually all my images, the other I get them back randomly and then again they disappear again.
Despite OPT2 praise it still has some strange stories in it. Lady Mikka is trying to work herself to death because of guilt. Guilt over what? ¯\_(ツ)_/¯ So instead of finding a NPC to have a heart to heart with her they decide the cure is a new kimono. So when she drops dead she'll at least be well dressed. I haven't even got to the strange part yet.
Did so much work on the game today. I wish I could post it all in this status update but there is a character limit of course haha. I thought about making a topic for updates, though... maybe.
The most recent sign that I am old. I have done martial arts for over 4 decades. Never HAD to stretch out. Good, of course, but never required. Was doing some kicks in the kitchen because, why not, and I felt a pop in the back of my thigh. Now I am limping around. Gotta love getting old.
One of the biggest perks of being fluent in English is how many new and interesting recipes I am able to find and try out that I would have hardly come across if I just spoke my mothertounge :3

Forum statistics

Threads
131,683
Messages
1,222,232
Members
173,435
Latest member
TheAmplifier
Top