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.

Character Blinks when no Activity Scripty Needed.

What I'm after, is a simple script that changes the players Character Graphic when the player is not moving on the screen after a few seconds. In other words, if the player is just standing there, and 5 seconds pass with out the keyboard being pressed... The players graphic will switch to a character set where the player is blinking (eyes shut), then switch back again. This gives the game a more realistic feel.
I've got this to work great with an Common event, but would much rather have a simple script to achieve this.

My event so far looks like this:

Trigger: Parallel
Condition Switch: 230: Blink Eyes

Conditional Branch: The (Down, Left, Right, Up) button is being pressed
Do nothing
Else
Change Actor Graphic: Dave02 (Blink)
wait: 5 frame(s)
Change Actor Graphic: Dave01 (normal character set)
Wait: 200 frames(s)
Branch End

Here are the two pics so you get a better idea of what I mean:

Thanks in advance,
Fenwick
 
hmmm... that event looks good to me... but if you really want a script I might have something... hold on

EDIT: Here's someting. Just name the blinking animation the same as your character set and add _ANI to the end of it. (If your character is "character1" then make the blinking character "character1_ANI"

ALL CREDIT GOES TO XIDEROWG

Code:
#===============================================================================
# By Xiderowg / 桜雅 在土 
# http://xms.rdy.jp/
# http://scriptshelf.jpn.org/x/
#===============================================================================

module XRXS_BreakActs
  SUFFIX = "_ANI"
  WCOUNT = 0
  def character_name
    filename = super
    if @breakacting
      new_name = filename + SUFFIX
      filename = new_name if RPG_FileTest.character_exist?(new_name)
    end
    return filename
  end
  def breakact=(b)
    @breakacting = b
    @step_anime  = b
  end
  def update
    super
    if controllable?
      if @breakact_count.to_i > 0
        @breakact_count -= 1
      else
        self.breakact = true
      end
    else
      @breakact_count = WCOUNT
      unless self.action != nil  or $game_map.starting? or
             self.knockbacking?
      self.breakact = false
      end
    end
  end
end
class Game_Player < Game_Character
  include XRXS_BreakActs
end
class Game_Player < Game_Character
  def controllable?  
    return !(moving? or $game_system.map_interpreter.running? or
            @move_route_forcing or $game_temp.message_window_showing or 
            Input.trigger?(Input::C) or Input.press?(Input::C) or
            Input.trigger?(Input::Y) or Input.trigger?(Input::Z) or
            Input.trigger?(Input::A)) 
end
end
 

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