Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Question about @wait in scene_battle

adma

Member

Code:
def update_phase4_step3
    # Animation for action performer (if ID is 0, then white flash)
    if @animation1_id == 0
      @active_battler.white_flash = true
      #@active_battler.screen_x = @active_battler.screen_x+1
    else
      @active_battler.animation_id = @animation1_id
      @active_battler.animation_hit = true
    end
    if @active_battler.is_a?(Game_Actor)
      print "attack"
      @wait_count = 22
      @active_battler.attack(@target_battlers[0])
    end
    # Shift to step 4
    @phase4_step = 4
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 4 : animation for target)
  #--------------------------------------------------------------------------
  def update_phase4_step4
    # Animation for target
    for target in @target_battlers
      target.animation_id = @animation2_id
      target.animation_hit = (target.damage != "Miss")
    end
    # Animation has at least 8 frames, regardless of its length
    @wait_count = 8
    # Shift to step 5
    @phase4_step = 5
  end

OK, try to ignore the changes I've already made, they work for the most part, the only thing that's odd is the functionality of @wait...

What I notice is that @wait makes the game pause for a certain number of frames

However I have put a print "attack" near when the wait is set, and inside the wait function in scene_battle i put a print "wait"

After the wait is set, there's about 10 frames or so before it even starts to count down... where is the code that applies this delay? And what is it's exact number of frames it waits before the countdown starts?

Thanks for any considerations and sorry for wall of text.

Adma
 
Go def update and look for;
Code:
if @wait_count != 0
@wait_count+=1
return
end
It only waits 1 frame before doing so, depending on the lag. It could go up to 10 frames i guess. If more it will crash, i think.

It might be just lag. I might be wrong, because I couldn't understand your exact question.
 

adma

Member

allright well basically my problem is, when i do @wait = x, there's a certain amount of frames before x goes down, now if I could know that exact number, then the solution is simple, just do @wait = x - delay, but I don't know that number, or why there even is a need for such a thing.

So that's my question in a nutshell, why is there this delay, or what is the delay.

TYVM =D
 

adma

Member

sorry I really don't think it's lag, although that seems like a reasonable suggestion, these delays are the exact same on my laptop and my desktop, and the laptop is a much much slower machine than my desktop. I'll find some way to get to the bottom of this.
 
I had the same problem. After modifing the Battle System it started to show somethings late. Like "Miss" or "250", and then I realized it was lag becuse I put a Print command in the block that show "miss" or w/e.
I'm pretty sure its lag but if you find its not and if you know how to fix it, please tell me, my current method of avoiding isn't very good. Its either too fast or too slow.
 

adma

Member

I did figure it out and it wasn't lag... The problem was the update function in Scene_battle

if you look in scene_battle 1 in the update down at the bottom you'll see a big string of if's checking different things, go ahead and comment out the current block of if waiting > 0, but copy it before you do that.

Then go put it right above

if $game_temp.transition_processing

that should do it, didn't cause any glitches or anything for me, and it works just perfectly if you're trying to time something.

Hope this is useful to you.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top