So. I have a small issue with a Common Event that helps control running.
In my game, SP is energy, used for normal special attacks as well as running. However my running event has a little quirk.
So, you can run, and it drains the players SP, you stop or walk, and it slowly regens. If it becomes fully drained, the players run key is disabled, so you are forced to walk it until you regen enough to run again. However, once drained, the SP appears unable to regen at all.
I'm unsure what is causing it to stop regening when your SP becomes fully drained. I have the players SP set to a variable, and set so if the var is <= 3 disable running, else, enable it. I have another event in game that simply tells me what the variable is currently at (roughly telling me how much SP I have to debunk this) and yes, it does indeed go up and down as I run and stop... However, once drained, the variable becomes stuck at 3. Use a potion to restore SP? The variable is still stuck at 3.
(http://img685.imageshack.us/img685/2673/49485116.png)
The part highlighted in yellow is the prob. If I remove that, the players SP can be fully drained, but still regen when you stop... however with nothing to disable the running, well the system becomes rather pointless.
There is nothing in the branch telling SP to not regen once it hits 3 or below. Just to disable running key so you can't run (and that is in no way alone tied to the SP)
I tried this making the event a parallel as well as what you see, the SP just wont regen once drained, and I am boggled as to why.
Not FALSE and TRUE, but false and true. Besides, either don't put the false in the same line or get Juan's script interpreter fix.
So don't use this:
Use this instead:
It don't really matter if it is in caps or not, it does disable running when energy is drained.. That's not what I'm asking for help on, but rather the SP not regening once it's drained fully, the disable command works fine. Try reading that again :3
It still don't fix my issue that once SP is fully drained it wont regen SP anymore, where as if you stop before it will regen just fine.
try this and see what you think place it below Blizzards ABS
class BlizzABS::Controller
alias running_drain_update_control update_control
def update_control
$game_system.running_button = ($game_party.actors[0].sp >= 5)
if $game_player.move_speed == BlizzABS::Config::RUN_SPEED
if $game_player.moving?
$game_party.actors[0].sp -= 5
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
running_drain_update_control
end
def wait(frames)
sec = frames * 40
return true if Graphics.frame_count % sec == sec -1
end
end
Nat, that.... works very well. o.o Though, anyway to get it so it keeps the run disabled until a curtain amount of sp is restored? This works good as is but if you keep trying to run with sp drained, as it regens you get this moment flicker between the run and walk sprite. I like it how it is, but perhaps it stops the run at 5 like you show, but wont enable it again till say 100? So you can run a few steps before it's disabled again and not this momentary flicker if your trying to run still while it's drained.
i added a wait to the sp drain when running try it now
class BlizzABS::Controller
alias running_drain_update_control update_control
def update_control
$game_system.running_button = ($game_party.actors[0].sp >= 5)
if $game_player.move_speed == BlizzABS::Config::RUN_SPEED
if $game_player.moving? && wait(0.5)
$game_party.actors[0].sp -= 5
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
running_drain_update_control
end
def wait(frames)
sec = frames * 40
return true if Graphics.frame_count % sec == sec -1
end
end
Hm, the wait just makes it take an extremely long time for the SP to drain. The first one worked much better.
The deal was, if your SP was fully drained, and you still held the run key down even with running disabled, as soon as your sp got up enough to run again, it would 'flicker' the run for just that moment where your sp was above the min to run before it drop back down and be disabled again. That's why I thought, if running is disabled at 5sp, enable it again at 20 sp?
Also noticed that um... this prevents the running key from being disabled at all via the
$game_system.running_button = false
I have it so you can't run while inside buildings that aren't dungeons, as well as turning off attack, defend, yada tada... but this keeps the run part from being disabled. :???:
I still need help with this, one that will allow me to turn off running via my common event that's a 'turn everything off for indoors' that's a big fat
$game_system.attack_button = false
$game_system.defend_button = false
$game_system.running_button = false
$game_system.sneaking_button = false
$game_system.jumping_button = false
$game_system.skill_button = false
$game_system.item_button = false
:P
I haven't forgot about you just haven't turned on my pc in a while haven't had time
Im not a scripter, but i think i can help with the event.
If you turn $game_system.running_button to false you can not ask for running anymore (like $game_player.running?).
Check the picture for my solution. With same modification you will get your wishes. :)
(http://img52.imageshack.us/img52/8900/spdraw.jpg)
try this if your indors just set $indoor to true that will automatically set running button to false
class BlizzABS::Controller
alias running_drain_update_control update_control
def update_control
$game_system.running_button = ($game_party.actors[0].sp >= 20 && $indoor != true)
if $game_player.move_speed == BlizzABS::Config::RUN_SPEED
if $game_player.moving?
$game_party.actors[0].sp -= 5
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
elsif wait(0.5)
$game_party.actors[0].sp += 1
end
running_drain_update_control
end
def wait(frames)
sec = frames * 40
return true if Graphics.frame_count % sec == sec -1
end
end
Gravedigging because Taiine told me to.
Try this: http://dl.dropbox.com/u/58874459/BLIZZ%20ABS.rar (http://dl.dropbox.com/u/58874459/BLIZZ%20ABS.rar)
NOTE: I still used that 'unless $game_switches[id]' edit in the BABS script to make this work.
Thank you for explaining the issue fully in that other topic--everything works out so much nicer when people give criticism.
It also helps when people are willing to accept criticism :P
I am guessing you are using the frame count to control the speed just as I was using the wait commands to slow down the sp gain?
Either way, when making the script edits (I changed it to switch 8 all around for my game) it still lets me run even with sp drained.
Odd. The demo works fine right? The bug only occurs in your game? Not sure what could be conflicting that then, unless somewhere in your scripts $game_player.move_speed is being set to the RUN_SPEED.
EDIT: Bothered to actually read more of this thread. Noticed that you were talking about a "flicker" when SP was drained and run key was held down and the player moves. Re-download my link above--I made a fix to that.