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.

Need help with Common Events

I want to make it in my game so every time my character walks up to an event, ANY event, that is he touches the event, an animation appears above his head, like a question mark bobbing up and down. I want to make the animation loop as well. I am just unsure as to how I would do this. Would I use common events? That makes sense to me but I am unsure. If anyone could help me with this I would greatly appreciate it...
 
This would probably be best served by a script. (and some more detailed requirements, like what happens if I hit the action key, or any other key, and what turns the animation off?)

However, I came close with the following event:

Page 1
Player Touch
Event Commands:
Control Self Switch: A =ON​

Page 2
Conditions: Self Switch A is ON
Parallel Process
Event Commands:
Show Animation: Player, [EM Question]
Wait: 12 frames
Conditional Branch: The C button is being pressed
Comment: Put your ACTION commands here

Control Self Switch: A = OFF​
Conditional Branch: The X button is being pressed
Control Self Switch: A = OFF​
Conditional Branch: The Down button is being pressed
Control Self Switch: A = OFF​
Conditional Branch: The Right button is being pressed
Control Self Switch: A = OFF​
Conditional Branch: The Left button is being pressed
Control Self Switch: A = OFF​
Conditional Branch: The Up button is being pressed
Control Self Switch: A = OFF​


This will stop the animation if any of the 6 primary keys are pressed.

Of course, you probably don't want to have to put all of this in every event.
So, a script would probably be the best bet.

Be Well
 
EDIT: I have to be more careful. I filled out my response hit the tab key and space thinking it would post and it hit the "Resolved" button heh.

http://www.rmxp.org/forums/showthread.php?t=30278
You can loop animations over events/player and you can stop them either instantly regardless of current frame or by letting them finish up the animation.
So a 54 frame animation can be called to stop on frame 12, and you can have it either stop looping once it reaches frame 54 or stop instantly on frame 12.

Use it with brew's post and it'll cut back a bit on the elbow work.
 
Scripts scripts script. I love filling your request with 'em.

Code:
class Game_Event
  Player_Event_Range_Loop_Animation_Show = true
  Player_Event_Range_Loop_Animation_ID   = 98
  attr_accessor :player_event_range_loop_animation_show
  attr_accessor :player_event_range_loop_animation_id
  alias_method :seph_playereventrangeloopanimation_gmevt_refresh, :refresh
  def refresh
    seph_playereventrangeloopanimation_gmevt_refresh
    @player_event_range_loop_animation_show = Player_Event_Range_Loop_Animation_Show
    @player_event_range_loop_animation_id   = Player_Event_Range_Loop_Animation_ID
    if @erased
      @player_event_range_loop_animation_show = false
      return
    end
    return if @list.nil?
    for event_command in @list
      next unless [108, 408].include?(event_command.code)
      if event_command.parameters[0].upcase.include?('DONT SHOW EVENT RANGE LOOP ANIMATIONS')
        @player_event_range_loop_animation_show = false
        @player_event_range_loop_animation_id = 0
        return
      end
      next unless event_command.parameters[0].upcase.include?('PLAYER EVENT RANGE LOOP ANIMATION')
      event_command.parameters[0].dup.gsub!(/\((.+?)\)/) do
        @player_event_range_loop_animation_id = $1.to_i
        break
      end
    end
  end
end

class Game_Player
  alias_method :seph_playereventrangeloopanimation_gmplyr_update, :update
  def update
    seph_playereventrangeloopanimation_gmplyr_update
    if @x != @last_playereventrangeloopanimation_x || 
       @y != @last_playereventrangeloopanimation_y
      @last_playereventrangeloopanimation_x = @x
      @last_playereventrangeloopanimation_y = @y
      update_player_event_range_loop_animation
    end
  end
  def update_player_event_range_loop_animation
    for event in $game_map.events.values
      if VR.in_range?(self, event, 1)
        unless @seph_playereventrangeloopanimation_refresh || 
               event.player_event_range_loop_animation_id == 0
          @seph_playereventrangeloopanimation_refresh = true
          @seph_playereventrangeloopanimation_restore = @loop_animation_id
          @loop_animation_id = event.player_event_range_loop_animation_id
        end
        return
      end
    end
    if @seph_playereventrangeloopanimation_refresh
      @loop_animation_id = @seph_playereventrangeloopanimation_restore
      @seph_playereventrangeloopanimation_refresh = false
    end
  end
end

Requires the script sixty gave you above, the MACL 2.1+ or http://www.rmxpu.net/owai/scripts/macl/-- modules.view range module.txt


No, you can set a default for all events with
Player_Event_Range_Loop_Animation_ID = animation_id

But you can also set individual event animations with comments:
Code:
Comment: PLAYER EVENT RANGE LOOP ANIMATION (animation_id)


You can also choose not to show an animation around an event with:
Code:
Comment: DONT SHOW EVENT RANGE LOOP ANIMATIONS


I haven't tested this, so let me know if it doesn't work.
 

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