Hi everyone.
I've been struggling with this and asking around elsewhere, but I figured I'd ask here because I've seen you all answer some pretty complicated questions over the years.
I'm trying to create a flashlight / battery system.
I will decide the final values later, but for now I'd like a battery to go dead after 50 steps.
I've found several flashlight tutorials, but they're all frame based - I really want a step based system.
If you know of a way I can change my scripts to make a step-based system work, I'd really appreciate it.
Or better yet if you have an easier way of accomplishing this that's totally different than what I've written here, please let me know.
Here's what I tried:
1. Create 2 flashlight items. Flashlight ON and Flashlight OFF.
2. Created 3 common events: Flashlight ON, Flashlight OFF, and Flashlight ON FORMULA.
The player starts with the Flashlight OFF item. Using it calls common event Flashlight ON.
Flashlight ON common event works as follows:
◆If:Flashlight OK to USE is ON
◆If:Battery ≥ 50
◆Text:None, Window, Bottom
: :The battery is dead.
◆Show Choices:Use a battery, Cancel (Window, Right, #1, #2)
:When Use a battery
◆If:Party has Battery
◆Change Items:Battery - 1
◆Control Variables:#0007 Battery = 0
◆Control Switches:#0014 Flashlight ON = ON
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆Plugin Command:Fire radius 150 #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆
:Else
◆Text:None, Window, Bottom
: :You are out of batteries.
◆
:End
◆
:When Cancel
◆
:End
◆
:End
◆If:Battery < 50
◆Plugin Command:Fire radius 150 #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆Control Switches:#0014 Flashlight ON = ON
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆
:End
◆
:Else
◆Text:None, Window, Bottom
: :There is no need to use a flashlight here.
◆
:End
This turns the Flashlight ON switch on, which is linked to Flashlight ON FORMULA common event.
That is a parallel event that works as follows:
◆Control Variables:#0007 Battery = Steps
◆If:Battery ≥ 50
◆Change Items:Flashlight on - 1
◆Change Items:Flashlight off + 1
◆Wait:30 frames
◆Plugin Command:Flashlight off
◆Plugin Command:Light radius 120 #63cdff
◆Wait:30 frames
◆Text:None, Window, Bottom
: :The flashlight battery has gone dead.
◆Show Choices:Use a battery, Cancel (Window, Right, #1, #2)
:When Use a battery
◆If:Party has Battery
◆Change Items:Battery - 1
◆Control Variables:#0007 Battery = Random 0..5
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆Play SE:Equip1 (90, 120, 0)
◆Wait:20 frames
◆Plugin Command:Fire radius #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆
:Else
◆Text:None, Window, Bottom
: :You are out of batteries.
◆Control Switches:#0014 Flashlight ON = OFF
◆
:End
◆
:When Cancel
◆Control Switches:#0014 Flashlight ON = OFF
◆
:End
◆
:End
Finally, when turning the flashlight off the Flashlight OFF common even is calledt:
◆Plugin Command:Flashlight off
◆Plugin Command:Light radius 120 #50a6ce
◆Change Items:Flashlight off + 1
◆Change Items:Flashlight on - 1
◆Control Switches:#0014 Flashlight ON = OFF
I realize this is a complicated problem.
I've really tried hard with it for days now, and it is holding up my project, but I just can't give up.
Anyway, if you had any feedback or suggestions, I would welcome them very much.
Thank you.
I've been struggling with this and asking around elsewhere, but I figured I'd ask here because I've seen you all answer some pretty complicated questions over the years.
I'm trying to create a flashlight / battery system.
I will decide the final values later, but for now I'd like a battery to go dead after 50 steps.
I've found several flashlight tutorials, but they're all frame based - I really want a step based system.
If you know of a way I can change my scripts to make a step-based system work, I'd really appreciate it.
Or better yet if you have an easier way of accomplishing this that's totally different than what I've written here, please let me know.
Here's what I tried:
1. Create 2 flashlight items. Flashlight ON and Flashlight OFF.
2. Created 3 common events: Flashlight ON, Flashlight OFF, and Flashlight ON FORMULA.
The player starts with the Flashlight OFF item. Using it calls common event Flashlight ON.
Flashlight ON common event works as follows:
◆If:Flashlight OK to USE is ON
◆If:Battery ≥ 50
◆Text:None, Window, Bottom
: :The battery is dead.
◆Show Choices:Use a battery, Cancel (Window, Right, #1, #2)
:When Use a battery
◆If:Party has Battery
◆Change Items:Battery - 1
◆Control Variables:#0007 Battery = 0
◆Control Switches:#0014 Flashlight ON = ON
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆Plugin Command:Fire radius 150 #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆
:Else
◆Text:None, Window, Bottom
: :You are out of batteries.
◆
:End
◆
:When Cancel
◆
:End
◆
:End
◆If:Battery < 50
◆Plugin Command:Fire radius 150 #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆Control Switches:#0014 Flashlight ON = ON
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆
:End
◆
:Else
◆Text:None, Window, Bottom
: :There is no need to use a flashlight here.
◆
:End
This turns the Flashlight ON switch on, which is linked to Flashlight ON FORMULA common event.
That is a parallel event that works as follows:
◆Control Variables:#0007 Battery = Steps
◆If:Battery ≥ 50
◆Change Items:Flashlight on - 1
◆Change Items:Flashlight off + 1
◆Wait:30 frames
◆Plugin Command:Flashlight off
◆Plugin Command:Light radius 120 #63cdff
◆Wait:30 frames
◆Text:None, Window, Bottom
: :The flashlight battery has gone dead.
◆Show Choices:Use a battery, Cancel (Window, Right, #1, #2)
:When Use a battery
◆If:Party has Battery
◆Change Items:Battery - 1
◆Control Variables:#0007 Battery = Random 0..5
◆Change Items:Flashlight off - 1
◆Change Items:Flashlight on + 1
◆Play SE:Equip1 (90, 120, 0)
◆Wait:20 frames
◆Plugin Command:Fire radius #333333
◆Plugin Command:Flashlight on 8 20 #333333 1
◆
:Else
◆Text:None, Window, Bottom
: :You are out of batteries.
◆Control Switches:#0014 Flashlight ON = OFF
◆
:End
◆
:When Cancel
◆Control Switches:#0014 Flashlight ON = OFF
◆
:End
◆
:End
Finally, when turning the flashlight off the Flashlight OFF common even is calledt:
◆Plugin Command:Flashlight off
◆Plugin Command:Light radius 120 #50a6ce
◆Change Items:Flashlight off + 1
◆Change Items:Flashlight on - 1
◆Control Switches:#0014 Flashlight ON = OFF
I realize this is a complicated problem.
I've really tried hard with it for days now, and it is holding up my project, but I just can't give up.
Anyway, if you had any feedback or suggestions, I would welcome them very much.
Thank you.