Running event with BABS

Started by Taiine, November 12, 2010, 09:59:34 pm

Previous topic - Next topic

Taiine

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.

Spoiler: ShowHide


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.

Blizzard

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:

variable = false


Use this instead:

variable =
false

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Taiine

November 13, 2010, 12:14:50 pm #2 Last Edit: November 13, 2010, 12:20:22 pm by Taiine
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.

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Taiine

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.

nathmatt

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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Taiine

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.  :???:

Taiine

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

nathmatt

I haven't forgot about you just haven't turned on my pc in a while haven't had time
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


fjurio

November 20, 2010, 07:12:39 pm #9 Last Edit: November 20, 2010, 07:37:48 pm by Blizzard
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. :)

Spoiler: ShowHide

nathmatt

November 21, 2010, 06:47:46 am #10 Last Edit: November 21, 2010, 06:49:11 am by nathmatt
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
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


KK20

Gravedigging because Taiine told me to.

Try this: 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.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Taiine

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.

KK20

February 17, 2012, 11:42:30 pm #13 Last Edit: February 18, 2012, 05:41:03 pm by KK20
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.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!