Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Ally on January 28, 2017, 03:20:49 pm

Title: [SOLVED][RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 03:20:49 pm
 I use these scripts to enhance the character frames:

https://galvs-scripts.com/galvs-character-animations/

and

http://rmrk.net/index.php/topic,46822.0.html


We created this character to add it as an enemy in an event.
But I can not figure out how to rename the file for have both the walking animation, both the idle animation...
http://imgur.com/B1RAJyk

How must rename the file?

The first 4 frames are those of idle poses, the others are the walking frames...
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 04:27:33 pm
You're going to need to resize the graphic to 960x576 first off. Then, rename the file so that it has %(4) at the end of it.

This will tell the game that your character graphic has 8 characters (even though it's technically only one character...but that's how Galv's demo is like too), each with 4 frames of animation. Since Galv's script just changes the character graphic index, it's already compatible with modern algebra's script (thankfully).
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 05:20:29 pm
I tried to insert the character in the size you indicated, but will not work as it should ;_;
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 05:41:30 pm
I tested it myself so I know it works. Script order doesn't matter either.
You didn't do FILENAME.png%(4) did you, cuz that's like totally wrong.
(http://i.imgur.com/izHigXb.gif)
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 05:58:00 pm
Maybe, my mistake is to place graphic files  :huh:
Can you pass your character template?

PS:I mustn't use the sprite as the main character, but as an event.
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 06:05:08 pm
ooooh in that case, Galv's script only works for the player and followers, not for events. That's going to need an edit.
I'll see what I can do.
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 06:07:20 pm
I didn't know  :^_^\':
Okay, thanks a lot  :haha:
If you can do something, I'm waiting  :D
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 06:41:37 pm
Spoiler: ShowHide


#------------------------------------------------------------------------------#
#  Galv's Character Animations
#  Edit by KK20
#------------------------------------------------------------------------------#
# KK20's Notes:
#   The script has been modified to allow map events to have the various
#   animations like the Player and Followers did in the original script.
#
#   For an event to have idle and move sprites, simply put the following:
#          [idle]
#   anywhere in the event's name.
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 2.0
#------------------------------------------------------------------------------#
#  2013-01-07 - Version 1.7 - Slight tweaks
#  2012-10-06 - Version 1.6 - Updated alias names for compatibility
#  2012-10-06 - Version 1.5 - Added dash speed option. Fixed some code
#  2012-09-21 - Version 1.4 - Optimised the code significantly (to my ability)
#                           - Some bug fixes
#  2012-09-21 - Version 1.3 - Added ability to repeat common event
#                           - Added follower animations
#  2012-09-20 - Version 1.2 - fixed compatibility with Galv's Region Effects
#  2012-09-20 - Version 1.1 - added idle common event, removed unnecessary code
#  2012-09-20 - Version 1.0 - release
#------------------------------------------------------------------------------#
#  Designed to give actors additional animations such as:
#  - Idle
#  - Walking
#  - Dashing
#  - Custom (run a common event if you've been idle for a period of time)
#
#  INSTRUCTIONS:
#  1. Copy this script below materials and above main
#  2. Create your charsets to use one characterset per actor. (This is where
#     version 2 differs from version 1 greatly.
#     The first character in the charset is the Idle animation
#     The second character in the charset is the Walk animation
#     The third character in the charset is the Dash animation
#
#  (See demo if you don't understand) This change was done to reduce processing
#  significantly and prevent lag when doing too much at once)
#
#------------------------------------------------------------------------------#
#  KNOWN ISSUES:
#  - Move Route Change graphic commands only work when the switch is on.
#    Then if you turn it off again, the graphic changes back to the original.
#    Use "Set Actor Graphic" event command to change instead.
#------------------------------------------------------------------------------#

($imported ||= {})["Chara_Anims"] = true
module Chara_Anims
 
#------------------------------------------------------------------------------# 
#  SETUP OPTIONS
#------------------------------------------------------------------------------#

  ANIM_SWITCH = 1             # ID of a switch to disable this effect.
                              # Turn switch ON in order to use change graphic
                              # move route commands. Turn off to restore anims.
                             
  DASH_SPEED = 1.2            # 1 is RMVX default dash speed.

  COMMON_EVENT = 1            # Common event ID that plays after a certain time
  COMMON_EVENT_TIME = 300     # Frames idle before common event called.
  REPEAT_EVENT = false        # Repeat this common event if player remains idle?
                              # (restarts the common event time) true or false.
#------------------------------------------------------------------------------# 
#  END SETUP OPTIONS
#------------------------------------------------------------------------------#

end # Chara_Anims


class Sprite_Character < Sprite_Base
  alias galv_charanim_initialize initialize
  def initialize(viewport, character = nil)
    @idletime = 0
    galv_charanim_initialize(viewport, character)
  end

  alias galv_charanim_update update
  def update
    galv_charanim_update
    return if !is_player? && !@character.allow_idle_sprites
    return if $game_switches[Chara_Anims::ANIM_SWITCH]
    return move_anim if @character.moving?
    @idletime += 1
    idle_anim if @idletime == 5
    idle_event if @idletime == Chara_Anims::COMMON_EVENT_TIME
  end

  def idle_anim
    @character.step_anime = true
    if is_player? && $game_party.leader.character_index != 0
      $game_party.battle_members.each { |m| m.set_g(0) }
    else
      @character.set_g(0)
    end
    $game_player.refresh if is_player?
    @idletime += 1
  end

  def move_anim
    if is_player?
      if $game_player.dash?
        if $game_party.leader.character_index != 2
          $game_party.battle_members.each { |m| m.set_g(2) }
          $game_player.refresh
        end
      else
        if $game_party.leader.character_index != 1
          $game_party.battle_members.each { |m| m.set_g(1) }
          $game_player.refresh
        end
      end
    else
      @character.set_g(1)
    end
    @idletime = 0
  end

  def idle_event
    return unless is_player?
    $game_temp.reserve_common_event(Chara_Anims::COMMON_EVENT)
    @idletime = 0 if Chara_Anims::REPEAT_EVENT
  end
 
  def is_player?
    @character == $game_player
  end
end # Sprite_Character < Sprite_Base


class Game_CharacterBase
  alias galv_charanim_init_public_members init_public_members
  def init_public_members
    galv_charanim_init_public_members
    @step_anime = true
  end
 
  # OVERWRITE FOR PERFORMANCE PURPOSES
  def real_move_speed
    @move_speed + (dash? ? Chara_Anims::DASH_SPEED : 0)
  end
end # Game_CharacterBase

class Game_Actor < Game_Battler
  def set_g(i)
    @character_index = i
  end
end # Game_Actor < Game_Battler

class Game_CharacterBase#class Game_Actor < Game_Battler
  attr_accessor :step_anime, :allow_idle_sprites
  def set_g(i)
    @character_index = i
  end
end # Game_Actor < Game_Battler

class Game_Event < Game_Character
  alias prep_sprite_for_idle_move_animations initialize
  def initialize(map_id, event)
    @allow_idle_sprites = ((event.name =~ /[idle]/) != nil)
    prep_sprite_for_idle_move_animations(map_id, event)
  end
end


Replace Galv's script with this one. All you have to do now is put
[idle]

somewhere within the map event's name.
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 06:45:20 pm
You are very fast man!  :o

Can you pass me the character template for the test?
Don't really know how to thank you  :facepalm:
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 06:59:40 pm
So using your 720x576 image, I opened it up in Paint.NET (http://www.getpaint.net/index.html). At the menu on top, select Image -> Canvas Size. Change Width to 960, press OK.
You will have a white rectangle added to the right of your image. Use the Magic Wand tool (pressing S on your keyboard), click on the white rectangle (which will highlight it blue), then press the DEL key.
Save the file and you get this
Spoiler: ShowHide
(http://i.imgur.com/ux5vTPR.png)
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 07:09:22 pm
Ooooh thank you, I've learned something new ^^
However, I receive an error:
http://imgur.com/CioMxfE

I followed the instructions O_o
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 07:12:23 pm
What other scripts do you have in your project?
Title: Re: [RMVXAce] File name for extra movement frame
Post by: Ally on January 28, 2017, 07:20:00 pm
SOLVED

Thank you for your support!
Title: Re: [RMVXAce] File name for extra movement frame
Post by: KK20 on January 28, 2017, 07:24:16 pm
What did you do?