- Joined
- Apr 9, 2013
- Messages
- 132
- Reaction score
- 17
- First Language
- English
- Primarily Uses
Hey everyone.
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.
Here's how I did it:
1. Create 2 flashlight items, one uses a common event called Flashlight ON, the other uses one called Flashlight OFF.
2. Created 3 common events: Flashlight ON, Flashlight OFF, and Flashlight ON FORMULA.
Flashlight ON common event works as follows:
Flashlight OFF common event works as follows:
And finally, Flashlight ON FORMULA (which is a parallel process that only runs when #0014 Flashlight ON switch is on.
Ignore the plugin commands, they're not really related to this particular problem.
I've tried everything I can think of, but without resetting the player step variable to 0 at some point in this process, I can't make the batteries work. As soon as I link things to a variable that increases with player steps, it counts every step the player has taken since the beginning of the game, which is too much.
I'm sorry, I realize that's a lot to read - but is there anything I can do?
Thank you for your time.
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.
Here's how I did it:
1. Create 2 flashlight items, one uses a common event called Flashlight ON, the other uses one called Flashlight OFF.
2. Created 3 common events: Flashlight ON, Flashlight OFF, and Flashlight ON FORMULA.
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
◆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
Flashlight OFF common event works as follows:
◆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
◆Plugin Command:Light radius 120 #50a6ce
◆Change Items:Flashlight off + 1
◆Change Items:Flashlight on - 1
◆Control Switches:#0014 Flashlight ON = OFF
And finally, Flashlight ON FORMULA (which is a parallel process that only runs when #0014 Flashlight ON switch is on.
◆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
◆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
Ignore the plugin commands, they're not really related to this particular problem.
I've tried everything I can think of, but without resetting the player step variable to 0 at some point in this process, I can't make the batteries work. As soon as I link things to a variable that increases with player steps, it counts every step the player has taken since the beginning of the game, which is too much.
I'm sorry, I realize that's a lot to read - but is there anything I can do?
Thank you for your time.

