Actor Exclusive Animation ADD ON - Actor + State Exclusive Animation

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
59
Reaction score
4
First Language
Portuguese
Primarily Uses
RMVXA
Hello everyone.

I was hoping to seek your aid in this matter. I remember that you have been kind to me and made this "actor excluvise animation" script which was very useful for me! Now, I was hoping that you could help me expand this script so that not only I could have the a different animation for a skill not only exclusive to an actor but also a different animation if that very same actor is under a certain state

Is this possible to achieve?

Here is the original script.

=begin
#==============================================================================#
# AMN Actor Animations
# Version 1.01
# Author: AMoonlessNight
# Date: 24 Dec 2018
# Latest: 24 Dec 2018
#==============================================================================#
# UPDATE LOG
#------------------------------------------------------------------------------#
# 24 Dec 2018 - created the script
#==============================================================================#
# TERMS OF USE
#------------------------------------------------------------------------------#
# - Please credit AMoonlessNight or A-Moonless-Night
# - Free for non-commercial use
# - Contact for commercial use
# - I'd love to see your game if you end up using one of my scripts
#==============================================================================#

This script makes it so that you can give items and skills different animation
IDs for different actors.

Use the following notetag in skills and items:

<actor ani: X Y>

where X is the ID of the actor and Y is the ID of the animation.

=end

#==============================================================================
# Please do not edit below this point unless you know what you are doing.
#==============================================================================

class RPG::UsableItem
attr_reader :actor_ani

def load_notetags_actor_ani
@actor_ani = {}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<actor[ -_]+ani:*\s+(\d+)\s+(\d+)>/i
@actor_ani[$1.to_i] = $2.to_i
end
}
end

end

module DataManager
class << self; alias :amn_ani_datamanager_loaddatabase :load_database; end

def self.load_database
amn_ani_datamanager_loaddatabase
load_notetags_actor_ani
end

def self.load_notetags_actor_ani
for group in [$data_skills, $data_items]
for obj in group
next if obj.nil?
obj.load_notetags_actor_ani
end
end
end
end

class Scene_Battle < Scene_Base
alias amn_ani_scenebattle_shownormalanimation show_normal_animation
def show_normal_animation(targets, animation_id, mirror = false)
if @subject && @subject.is_a?(Game_Actor) && @subject.current_action && @subject.current_action.item
if @subject.current_action.item.actor_ani.key?(@subject.id)
animation_id = @subject.current_action.item.actor_ani[@subject.id]
end
end
amn_ani_scenebattle_shownormalanimation(targets, animation_id, mirror)
end
end
 

vFoggy

Veteran
Veteran
Joined
Nov 3, 2012
Messages
65
Reaction score
24
Primarily Uses
Here:
Code:
#===============================================================================
#
# Extention script for AMoonlessNight's AMN Actor Animations
# Author: vFoggy
# Description:
#   Now items and skills can have a different animation if a specific actor is
#   using it while under a specific state.
#   
#   Notetag:
#   <actor ani: actor_id animation_id state_id>
#   Using the above tag, when the actor with id actor_id uses the item/skill
#   and has a state with id state_id, the animation with id animation_id will
#   play instead.
#
#===============================================================================
class RPG::UsableItem
  attr_reader :actor_state_ani

  def load_notetags_state_ani
    @actor_state_ani = {}
    note.split(/[\r\n]+/).each do |line|
      case line
      when /<actor[ -_]+ani:*\s+(\d+)\s+(\d+)(?:\s+(\d+))?>/i
        @actor_state_ani[$1.to_i] = [$2.to_i, $3.to_i]
      end
    end
  end
 
  alias fog_lnaa load_notetags_actor_ani
  def load_notetags_actor_ani
    fog_lnaa
    load_notetags_state_ani
  end
end


class Scene_Battle < Scene_Base
  alias fog_sna show_normal_animation
  def show_normal_animation(targets, animation_id, mirror = false)
    if @subject && @subject.is_a?(Game_Actor) && @subject.current_action && @subject.current_action.item
      item = @subject.current_action.item
      # if item/skill has a state animation for the user and
      # the required state is applied on the user
      if item.actor_state_ani.key?(@subject.id) &&
        !@subject.states.find{|s| s.id == item.actor_state_ani[@subject.id][1] }.nil?
          animation_id = subjects_state_ani[0]
      elsif item.actor_ani.key?(@subject.id)
        # check for just actor animation (script's default behaviour)
        animation_id = @subject.current_action.item.actor_ani[@subject.id]
      end
    end
    amn_ani_scenebattle_shownormalanimation(targets, animation_id, mirror)
  end
end
Paste it after the original script.
Priority is given to the state animation.
 

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
59
Reaction score
4
First Language
Portuguese
Primarily Uses
RMVXA
YOOOO, It worked.

Now I can make different animations for my characters when they equip a new weapon because they get a passive state that will change the animation graphic showing their new weapon!

Thanks alot, you will definitely be credited.
 

vFoggy

Veteran
Veteran
Joined
Nov 3, 2012
Messages
65
Reaction score
24
Primarily Uses
YOOOO, It worked.

Now I can make different animations for my characters when they equip a new weapon because they get a passive state that will change the animation graphic showing their new weapon!

Thanks alot, you will definitely be credited.
Thank you. Good luck with your project :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I just successfully tested changing music by region, and changing it between continents on the world map after getting on/off the airship. I had to override the default audio transitions with eventing to make it change smoothly but it worked.
Stream will be going live shortly with some more Witcher 3, then we will switch to another game! Feel free to drop by~
Finally scripting out the story after WAYYYYY too long of having 0 idea of how to approach said scripting.
2020 has started off pretty stressful for me, but no need to fear. I have my mood fixer:

Have you appreciated a Hedgehog today?

Forum statistics

Threads
93,410
Messages
912,122
Members
122,919
Latest member
kujo1189
Top