[XP] Random Action Sprites for Blizz-ABS

Started by Blizzard, July 06, 2009, 04:50:13 pm

Previous topic - Next topic

Blizzard

July 06, 2009, 04:50:13 pm Last Edit: March 23, 2019, 11:37:30 am by Blizzard
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


  • easy to configure
  • shows more than one sprite on the same action (i.e. 2 different sprite animations for swinging a sword)



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


  • Boris "Blizzard" Mikić
  • thanks to RoseSkye for requesting this



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
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

This can sorta act like a combo system then cant it? I did say sorta. Not really though seeing each attack is random

Blizzard

Gives the game more depth. i.e. Player swings a sword once right-ways, the other time left-ways.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

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 :)

Ryex

this is something that should be used in Remexos it would look really weird always attacking the same way.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Maybe. I made it on Rose's request. That doesn't mean we can't use it. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RoseSkye

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.

G_G

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?

Calintz

Love this feature ...
Great add-on Blizzard.

Blizzard

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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

RoseSkye

How would I go 1-2-3-1-2-3 (linear) instead of random?

Blizzard

I put up v2.0, working with Blizz-ABS v2.7.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Metaron

Will this work with Blizz-ABS 2.84? Or has this add on been replaced by implementing combos?