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.

Prexus's Animation Engine Help

I Found a script.... But i´ve a Problem with it...

First..the Script:
=begin

Animation Engine by Prexus
Created on: July 14th 2005
Revised on: July 16th 2005
All Rights Reserved.
Modified by Dirtie on: August 25th 2006

Instructions:

To call, use this:
$animation.run(type, file_name, position, wait, frames, loop, character)

Type:
Put either "self" if you want it to animate the player or "event" if
you want it to animate an event.

File_name:
Put the name of the animation file here, such as "001-Fighter01"

Position:
This is the row that you want to run the animation along. For Fighter01's down
animation, you'd put 1, for his left animation you'd put 2, for his right
animation you'd put 3 and for his up animation you'd put 4.

Wait:
This is the amount of frames between each animation. 20 would be a second.
4 is about average for an animation.

Frames:
How many frames you want to play. Enter a number between 0 and 3.
0 will show only the first image and 3 will show the full animation.

Repeat:
How many times you want the complete animation to repeat. Set to 1 or leave
blank to play the animation once, set to 2 to play it twice, etc. Use "loop"
to make it repeat indefinitely.

Character:
Put the ID of the event you wish to animate here if you picked "event" as the
type. Otherwise, leave it blank.

=end

class Scene_Map
alias animation_engine_scene_map_call_menu call_menu
def call_menu
if $input
return
end
animation_engine_scene_map_call_menu
end
end

class Scene_Title
alias animation_engine_scene_title_new_game command_new_game
def command_new_game
animation_engine_scene_title_new_game
$animation = Animation_Engine.new
end
end

class Game_Event < Game_Character
attr_reader :event
end

class Game_Player < Game_Character
def update
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing or $input # Updated Line
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end

class Animation_Engine
def run(type, animation_name, position, wait = 8, frames = 0, repeat = 1, character = nil)
@type = type
if @type == "event"
@anim_char = $game_map.events[character]
elsif @type == "party"
@anim_char = $game_allies[character]
elsif @type == "self"
@anim_char = $game_player
if @anim_char == nil
print("Animation Engine has encounted an error: No Leading Party Member.")
end
end
if @anim_char != nil
@anim_char.animate(@type, animation_name, position, frames, wait, repeat)
end
end
end

class Game_Character
attr_accessor :wait
attr_accessor :eek:ld_chr_name
attr_accessor :eek:ld_dir
attr_accessor :animating
alias animation_engine_game_character_initialize initialize
alias animation_engine_game_character_update update
def initialize
animation_engine_game_character_initialize
@animating = false
@wait = false
@old_chr_name = @character_name
@old_dir = @direction
end
def update
if @animating == true
update_animate
return
end
if $input
update_stop
return
end
animation_engine_game_character_update
end
def animate(type, animation_name, position, frames, wait, repeat)
$input = true
if @animating == false
@character_name = animation_name
end
@type = type
@pattern = 0
@count = 0
if repeat == "loop"
@repeat = repeat
else
@repeat = repeat - 1
end
@direction_fix = true
@old_dir = @direction
@direction = position * 2
@frames = frames
lock
@animating = true
@wait = wait
@anim_wait_count = @wait
update
return
end
def update_animate
if @anim_wait_count > 0
@anim_wait_count -= 1
return
end
if @pattern >= @frames
if @repeat == "loop"
@pattern = 0
@anim_wait_count = @wait
update
return
elsif @count < @repeat
@pattern = 0
@count += 1
@anim_wait_count = @wait
update
return
end
unlock
@animating = false
@pattern = 0
@direction_fix = false
@direction = @old_dir
if @type == "event"
if @page != nil
@character_name = @page.graphic.character_name
else
@character_name = ""
end
else
@character_name = @old_chr_name
end
$input = false
$game_player.refresh
$game_map.refresh
return
end
@pattern += 1
@anim_wait_count = @wait
update
end
end


now the problem:

If i use it on my Hero-Charakters... the Other Event´s Animations ran in the rythm of the Hero-Animation... That means, if the Player changes the Frame only every 20 Frames.. the other Events do the same....

What´s going on??
 

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