Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: Blizzard on July 06, 2009, 04:50:13 pm

Title: [XP] Random Action Sprites for Blizz-ABS
Post by: Blizzard on July 06, 2009, 04:50:13 pm
Random Action Sprites for Blizz-ABS
Authors: Blizzard
Version: 2.0
Type: Blizz-ABS Plugin
Key Term: Blizz-ABS Plugin



Introduction

This script will allow you to define additional random action sprites from specific spritesets for each time the action is executed.

This script is to be distributed under the same terms and conditions like the script it was created for: Blizz-ABS.


Features




Screenshots

N/A


Demo

N/A


Script

Just make a new script above main and paste this code into it.
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Random Action Sprites for Blizz-ABS by Blizzard
# Version: 2.0
# Type: Blizz-ABS Add-on
# Date: 6.7.2009
# Date v2.0: 28.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed RIGHT BELOW Blizz-ABS and requires Blizz-ABS
#   v2.7 or higher to work properly. It will allow you to define additional
#   random action sprites from specific spritesets for each time the action is
#   executed.
#
# Instructions:
#   
#   If you want for one specific action to choose a random sprite from a
#   specific set of sprites, you need to name all sprites appropriately. On
#   each filename the suffix "_RAND" (without the double quotes) needs to be
#   added where RAND is the index of the sprite.
#   
#   Example:
#   
#     - normal Actor Attack Sprite: arshes_atk3.png
#     - normal Actor Weapon Sprite: arshes_wpn_6.png
#     
#     Using 3 random sprites for this requires you to name the files like this:
#
#     - normal Actor Attack Sprite 1: arshes_atk3_0.png
#     - normal Actor Weapon Sprite 1: arshes_wpn_6_0.png
#     - normal Actor Attack Sprite 2: arshes_atk3_1.png
#     - normal Actor Weapon Sprite 2: arshes_wpn_6_1.png
#     - normal Actor Attack Sprite 3: arshes_atk3_2.png
#     - normal Actor Weapon Sprite 3: arshes_wpn_6_2.png
#     
#     The numbers are 0, 1 and 2 which are 3 numbers.
#     
#   
#   Example:
#   
#     - normal Actor Skill Sprite ID7: master_skl7.png
#     
#     Using 5 random sprites for this requires you to name the files like this:
#
#     - normal Actor Skill Sprite ID7 1: master_skl7_0.png
#     - normal Actor Skill Sprite ID7 2: master_skl7_1.png
#     - normal Actor Skill Sprite ID7 3: master_skl7_2.png
#     - normal Actor Skill Sprite ID7 4: master_skl7_3.png
#     - normal Actor Skill Sprite ID7 5: master_skl7_4.png
#     
#     The numbers are 0, 1, 2, 3 and 4 which are 5 numbers.
#     
# IMPORTANT NOTE:
#   
#   For everything that was not configured here, the normal filenames will
#   work.
#   
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !$BlizzABS || BlizzABS::VERSION < 2.7
  raise 'ERROR: The "Random Action Sprites" plugin requires Blizz-ABS 2.7 or higher.'
end

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # START Configuration
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  def self.actor_random_attack_sprites(id)
    case id
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Actor Random Weapon Sprites
    #
    #   Configure how many random actor attack sprites a weapon can have.
    #   
    #     when ID then return AMOUNT
    #   
    #   ID     - weapon ID
    #   AMOUNT - how many sprites
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 1
  end
 
  def self.actor_random_skill_sprites(id)
    case id
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Actor Random Skill Sprites
    #
    #   Configure how many random actor skill sprites a skill can have.
    #   
    #     when ID then return AMOUNT
    #   
    #   ID     - skill ID
    #   AMOUNT - how many sprites
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 1
  end
 
  def self.actor_random_item_sprites(id)
    case id
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Actor Random Item Sprites
    #
    #   Configure how many random actor item sprites an item can have.
    #   
    #     when ID then return AMOUNT
    #   
    #   ID     - item ID
    #   AMOUNT - how many sprites
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 1
  end
 
  def self.enemy_random_attack_sprites(id)
    case id
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Enemy Random Enemy Sprites
    #
    #   Configure how many random enemy attack sprites an enemy can have.
    #   
    #     when ID then return AMOUNT
    #   
    #   ID     - enemy ID
    #   AMOUNT - how many sprites
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 1
  end
 
  def self.enemy_random_skill_sprites(id)
    case id
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Enemy Random Skill Sprites
    #
    #   Configure how many random enemy skill sprites a skill can have.
    #   
    #     when ID then return AMOUNT
    #   
    #   ID     - skill ID
    #   AMOUNT - how many sprites
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 1 then return 2
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 1
  end
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # END Configuration
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

end

#==============================================================================
# Map_Battler
#==============================================================================

class Map_Battler
 
  alias setup_sprites_random_action_sprites_later setup_sprites
  def setup_sprites(type)
    setup_sprites_random_action_sprites_later(type)
    return unless action_sprites?
    add_on = ''
    if type == BlizzABS::SPRAttack
      random = get_random_attack_sprites
      if random > 1
        add_on = "_#{rand(random)}"
        @weapon_sprite += add_on
      end
    elsif type[0, 4] == BlizzABS::SPRSkill
      random = get_random_skill_sprites(type[4, type.size - 4].to_i)
      add_on = "_#{rand(random)}" if random > 1
    elsif type[0, 4] == BlizzABS::SPRItem
      random = get_random_item_sprites(type[4, type.size - 4].to_i)
      add_on = "_#{rand(random)}" if random > 1
    end
    @current_sprite += add_on
    @character_name = @character_name_org + @current_sprite
  end
 
  def get_random_attack_sprites
    return 0
  end
 
  def get_random_skill_sprites(skill_id)
    return 0
  end
 
  def get_random_item_sprites(item_id)
    return 0
  end
 
end

#==============================================================================
# Map_Enemy
#==============================================================================

class Map_Actor
 
  def get_random_attack_sprites
    return BlizzCFG.actor_random_attack_sprites(self.battler.weapon_id)
  end
 
  def get_random_skill_sprites(skill_id)
    return BlizzCFG.actor_random_skill_sprites(skill_id)
  end
 
  def get_random_item_sprites(item_id)
    return BlizzCFG.actor_random_item_sprites(item_id)
  end
 
end
 
#==============================================================================
# Map_Enemy
#==============================================================================

class Map_Enemy
 
  def get_random_attack_sprites
    return BlizzCFG.enemy_random_attack_sprites(self.battler_id)
  end
 
  def get_random_skill_sprites(skill_id)
    return BlizzCFG.enemy_random_skill_sprites(skill_id)
  end
 
end



Instructions

In the script in the first comment.


Compatibility

Requires Blizz-ABS to work.


Credits and Thanks




Author's Notes

Keep in mind that this plugin comes RIGHT UNDER Blizz-ABS. This script was done on request and is not fully supported by me as my other scripts are.

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: G_G on July 06, 2009, 05:02:22 pm
This can sorta act like a combo system then cant it? I did say sorta. Not really though seeing each attack is random
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Blizzard on July 06, 2009, 05:12:40 pm
Gives the game more depth. i.e. Player swings a sword once right-ways, the other time left-ways.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: winkio on July 06, 2009, 05:15:17 pm
Random Action Sprites: a slacker's excuse for a combo system. :P

That's fine by me though.  Sometimes, the coolest ideas come from trying to make your own shortcuts :)
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Ryex on July 06, 2009, 05:16:00 pm
this is something that should be used in Remexos it would look really weird always attacking the same way.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Blizzard on July 06, 2009, 05:18:42 pm
Maybe. I made it on Rose's request. That doesn't mean we can't use it. xD
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: RoseSkye on July 07, 2009, 01:25:02 am
Quote from: winkio on July 06, 2009, 05:15:17 pm
Random Action Sprites: a slacker's excuse for a combo system. :P

That's fine by me though.  Sometimes, the coolest ideas come from trying to make your own shortcuts :)


That's kinda (by kinda I mean exactly) what it is.

It could have been a linear action sprite system (1-2-3, 1-2-3, 1-2-3) but, that is too normal for me =/.
Gotta admit though, it would have been much less confusing to have that type.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: G_G on July 07, 2009, 01:42:29 am
You can have as many attacks for one weapon right? Like I'm not probably going to but you can have say 50 different action sprites for one weapon right? Not that I'm going to but you can have as many action sprites for any weapon right? Not just 3 different ones?
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Calintz on July 07, 2009, 03:33:00 am
Love this feature ...
Great add-on Blizzard.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Blizzard on July 07, 2009, 07:46:50 am
Quote from: game_guy on July 07, 2009, 01:42:29 am
You can have as many attacks for one weapon right? Like I'm not probably going to but you can have say 50 different action sprites for one weapon right? Not that I'm going to but you can have as many action sprites for any weapon right? Not just 3 different ones?


Yes. You just need to add a setting (i.e. when 4 then return 50) and there you go.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: RoseSkye on October 19, 2009, 08:36:54 pm
How would I go 1-2-3-1-2-3 (linear) instead of random?
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Blizzard on November 28, 2009, 11:29:21 am
I put up v2.0, working with Blizz-ABS v2.7.
Title: Re: [XP] Random Action Sprites for Blizz-ABS
Post by: Metaron on December 01, 2013, 09:23:35 am
Will this work with Blizz-ABS 2.84? Or has this add on been replaced by implementing combos?