Polraudio 122 Report post Posted November 13, 2009 I tried doing this my self but I'm not good with math at all and have no clue where to start. But i need to find a script that will allow 8 walking animations instead of 4. Example of that i need: I will be very thankful for any help. Share this post Link to post Share on other sites
Leon 55 Report post Posted November 13, 2009 Go into the script: Sprite_Characters roughly around line 47 you will see this line: @cw = bitmap.width / 4 change the 8 to an eight. Explaination: [spoiler=long] Okay, so self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) @cw = bitmap.width / 4 @ch = bitmap.height / 4 self.ox = @cw / 2 self.oy = @ch end means it sets the character's picture in the bitmap, then the @cw equals the bitmap's width divided by 4, or in your case, 8. This divides the picture that many times, and thus, leaves your result. Share this post Link to post Share on other sites
Polraudio 122 Report post Posted November 13, 2009 Doesn't work. Still uses the first 4. That was the first thing i tried when i did it. I messed with every value in that class. Share this post Link to post Share on other sites
Agckuu_Coceg 5 Report post Posted November 16, 2009 Seems, I found the decision of this problem. Judging on my knowledge English, it that is needed. True of demo I did not see and can not get. #============================================================================== # ** Hero and Event Frame Script 1.1 (25-03-2007) # by The Sleeping Leonhart #------------------------------------------------------------------------------ # This script allow the user to choice the frame of the hero, the frame of # the event, add a standing pose and the 8 direction movement. # This Script include the patch for the menu. #============================================================================== #=========================== CONFIGURATION ===================================== HERO_FRAME = 8 #frame for the hero EVENT_FRAME = 4 #frame for the event HERO_STAND = true #enable/disable the hero standing pose EVENT_STAND = false #enable/disable the event standing pose EIGHT_DIRECTION = true #enabledisable the 8 direction mode #=============================================================================== class Sprite_Character < RPG::Sprite alias tsl_spritecharcter_update update def update super if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_hue != @character.character_hue @tile_id = @character.tile_id @character_name = @character.character_name @character_hue = @character.character_hue if @tile_id >= 384 self.bitmap = RPG::Cache.tile($game_map.tileset_name, @tile_id, @character.character_hue) self.src_rect.set(0, 0, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = RPG::Cache.character(@character.character_name, @character.character_hue) if @character.is_a?(Game_Event) if EVENT_STAND @cw = bitmap.width / (EVENT_FRAME + 1) @ch = bitmap.height / 4 else @cw = bitmap.width / EVENT_FRAME @ch = bitmap.height / 4 end elsif @character.is_a?(Game_Player) if HERO_STAND @cw = bitmap.width / (HERO_FRAME + 1) @ch = bitmap.height / 4 else @cw = bitmap.width / HERO_FRAME @ch = bitmap.height / 4 end end self.ox = @cw / 2 self.oy = @ch end end tsl_spritecharcter_update end end class Game_Character attr_reader :step_anime attr_reader :walk_anime attr_reader :stop_count def update if jumping? update_jump elsif moving? update_move else update_stop end if not self.is_a?(Game_Player) if @anime_count > 16 - @move_speed * 2 if not @step_anime and @stop_count > 0 @pattern = @original_pattern else if EVENT_STAND == true @pattern = @pattern - 1 @pattern = (@pattern + 1) % EVENT_FRAME + 1 else @pattern = (@pattern + 1) % EVENT_FRAME end end @anime_count = 0 end else if @anime_count > 16 - @move_speed * 2 if not @step_anime and @stop_count > 0 @pattern = @original_pattern else if HERO_STAND == true @pattern = @pattern - 1 @pattern = (@pattern + 1) % HERO_FRAME + 1 else @pattern = (@pattern + 1) % HERO_FRAME end end @anime_count = 0 end end if @wait_count > 0 @wait_count -= 1 return end if @move_route_forcing move_type_custom return end if @starting or lock? return end if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency) case @move_type when 1 move_type_random when 2 move_type_toward_player when 3 move_type_custom end end end def move_lower_left unless @direction_fix if EIGHT_DIRECTION == true @direction = 3 else @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction) end end if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2)) if EIGHT_DIRECTION == true turn_downleft end @x -= 1 @y += 1 increase_steps end end def move_lower_right unless @direction_fix if EIGHT_DIRECTION == true @direction = 3 else @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction) end end if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2)) if EIGHT_DIRECTION == true turn_downright end @x += 1 @y += 1 increase_steps end end def move_upper_left unless @direction_fix if EIGHT_DIRECTION == true @direction = 9 else @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) end end if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8)) if EIGHT_DIRECTION == true turn_upleft end @x -= 1 @y -= 1 increase_steps end end def move_upper_right unless @direction_fix if EIGHT_DIRECTION == true @direction = 9 else @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) end end if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8)) if EIGHT_DIRECTION == true turn_upright end @x += 1 @y -= 1 increase_steps end end def move_random if EIGHT_DIRECTION == true caserand=8 else caserand=4 end case rand(caserand) when 0 move_down(false) when 1 move_left(false) when 2 move_right(false) when 3 move_up(false) when 4 move_lower_left when 5 move_lower_right when 6 move_upper_left when 7 move_upper_right end end def move_toward_player sx = @x - $game_player.x sy = @y - $game_player.y if sx == 0 and sy == 0 return end abs_sx = sx.abs abs_sy = sy.abs if EIGHT_DIRECTION == true if sx > 0 if sy > 0 move_upper_left elsif sy <0 move_lower_left else move_left end elsif sx <0 if sy > 0 move_upper_right elsif sy <0 move_lower_right else move_right end else if sy > 0 move_up elsif sy <0 move_down else end end else if abs_sx == abs_sy rand(2) == 0 ? abs_sx += 1 : abs_sy += 1 end if abs_sx > abs_sy sx > 0 ? move_left : move_right if not moving? and sy != 0 sy > 0 ? move_up : move_down end else sy > 0 ? move_up : move_down if not moving? and sx != 0 sx > 0 ? move_left : move_right end end end end def move_away_from_player sx = @x - $game_player.x sy = @y - $game_player.y if sx == 0 and sy == 0 return end abs_sx = sx.abs abs_sy = sy.abs if EIGHT_DIRECTION == true if sx > 0 if sy > 0 move_lower_right elsif sy <0 move_upper_right else move_right end elsif sx <0 if sy > 0 move_lower_left elsif sy <0 move_upper_left else move_left end else if sy > 0 move_down elsif sy <0 move_up else end end else if abs_sx == abs_sy rand(2) == 0 ? abs_sx += 1 : abs_sy += 1 end if abs_sx > abs_sy sx > 0 ? move_right : move_left if not moving? and sy != 0 sy > 0 ? move_down : move_up end else sy > 0 ? move_down : move_up if not moving? and sx != 0 sx > 0 ? move_right : move_left end end end end def move_forward if EIGHT_DIRECTION == true case @direction when 2 move_down(false) when 4 move_left(false) when 6 move_right(false) when 8 move_up(false) end else case @direction when 1 move_lower_left when 2 move_down(false) when 3 move_lower_right when 4 move_left(false) when 6 move_right(false) when 7 move_upper_left when 8 move_up(false) when 9 move_upper_right end end end def move_backward last_direction_fix = @direction_fix @direction_fix = true if EIGHT_DIRECTION == true case @direction when 1 move_upper_right when 2 move_up(false) when 3 move_upper_left when 4 move_right(false) when 6 move_left(false) when 7 move_lower_right when 8 move_down(false) when 9 move_lower_left end else case @direction when 2 move_up(false) when 4 move_right(false) when 6 move_left(false) when 8 move_down(false) end end @direction_fix = last_direction_fix end def jump(x_plus, y_plus) if EIGHT_DIRECTION == true if x_plus > 0 if y_plus > 0 turn_downright elsif y_plus <0 turn_upright else turn_right end elsif x_plus <0 if y_plus > 0 turn_downleft elsif y_plus <0 turn_upleft else turn_left end else if y_plus > 0 turn_down elsif y_plus <0 turn_up else end end else if x_plus != 0 or y_plus != 0 if x_plus.abs > y_plus.abs x_plus < 0 ? turn_left : turn_right else y_plus < 0 ? turn_up : turn_down end end end new_x = @x + x_plus new_y = @y + y_plus if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0) straighten @x = new_x @y = new_y distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round @jump_peak = 10 + distance - @move_speed @jump_count = @jump_peak * 2 @stop_count = 0 end end def turn_upleft unless @direction_fix @direction = 9 @stop_count = 0 end end def turn_upright unless @direction_fix @direction = 9 @stop_count = 0 end end def turn_downleft unless @direction_fix @direction = 3 @stop_count = 0 end end def turn_downright unless @direction_fix @direction = 3 @stop_count = 0 end end def turn_right_90 case @direction when 1 turn_downright when 2 turn_left when 3 turn_upright when 4 turn_up when 6 turn_down when 7 turn_downleft when 8 turn_right when 9 turn_upleft end end def turn_left_90 case @direction when 1 turn_upleft when 2 turn_right when 3 turn_downleft when 4 turn_down when 6 turn_up when 7 turn_upright when 8 turn_left when 9 turn_downright end end def turn_180 case @direction when 1 turn_upright when 2 turn_up when 3 turn_upleft when 4 turn_right when 6 turn_left when 7 turn_downright when 8 turn_down when 9 turn_downleft end end def turn_random if EIGHT_DIRECTION == true caserand = 8 else caserand = 4 end case rand(caserand) when 0 turn_down when 1 turn_left when 2 turn_right when 3 turn_up when 4 turn_downleft when 5 turn_downright when 6 turn_upleft when 7 turn_upright end end def turn_toward_player sx = @x - $game_player.x sy = @y - $game_player.y if EIGHT_DIRECTION == true if sx > 0 if sy > 0 turn_upleft elsif sy <0 turn_downleft else turn_left end elsif sx <0 if sy > 0 turn_upright elsif sy <0 turn_downright else turn_right end else if sy > 0 turn_up elsif sy <0 turn_down else end end else if sx == 0 and sy == 0 return end if sx.abs > sy.abs sx > 0 ? turn_left : turn_right else sy > 0 ? turn_up : turn_down end end end def turn_away_from_player sx = @x - $game_player.x sy = @y - $game_player.y if EIGHT_DIRECTION == true if sx > 0 if sy > 0 turn_downright elsif sy <0 turn_upright else turn_right end elsif sx <0 if sy > 0 turn_downleft elsif sy <0 turn_upleft else turn_left end else if sy > 0 turn_down elsif sy <0 turn_up else end end else if sx == 0 and sy == 0 return endr if sx.abs > sy.abs sx > 0 ? turn_right : turn_left else sy > 0 ? turn_down : turn_up end end end end 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 if EIGHT_DIRECTION == true case Input.dir8 when 1 move_lower_left when 2 move_down when 3 move_lower_right when 4 move_left when 6 move_right when 7 move_upper_left when 8 move_up when 9 move_upper_right end else case Input.dir4 when 2 move_down when 4 move_left when 6 move_right when 8 move_up end 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 Window_Base < Window def draw_actor_graphic(actor, x, y) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) if HERO_STAND cw = bitmap.width / (HERO_FRAME + 1) else cw = bitmap.width / HERO_FRAME end ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end end Share this post Link to post Share on other sites
Kiriashi 117 Report post Posted November 16, 2009 Spoiler tags man, spoiler tags. The script looks neat! Share this post Link to post Share on other sites
Agckuu_Coceg 5 Report post Posted November 17, 2009 Spoiler tags man, spoiler tags. The script looks neat! Spoiler spoiler so. A script is tried, Kiriashi? Works? And then it is quite old and was covered with dust in the archives. Share this post Link to post Share on other sites
Polraudio 122 Report post Posted November 17, 2009 Is there a sample image that works with it? I cant seem to get it to work with any image i try. Share this post Link to post Share on other sites
Agckuu_Coceg 5 Report post Posted November 17, 2009 I honestly don't know what image is needed for this script. Demo has been lost ... If you suddenly find yourself a demo, tell me. I'll try to find it elsewhere. Seems to understand. I'm seeing topic. This thing is used to add the game sprites in the style of Ragnarok Online. That is, it needs sprites like RO. As I understand it, you need to put stand-pose as the first series of frames. Or try to put the hero stand-pose to false. In theory, should work. Share this post Link to post Share on other sites
Agckuu_Coceg 5 Report post Posted November 18, 2009 I deal with this script. It is necessary to put the series in the charset as follows: Stand pose Down-walk Left-walk Right-walk Up-walk Share this post Link to post Share on other sites