Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # ● IEX2 - Randomize Battle Skills [VXA]
- #==============================================================================#
- # // • Created By : IceDragon
- # // • Data Created : 03/25/2012
- # // • Data Modified : 03/25/2012
- # // • Version : 1.0
- # // • RGSS.design : 3 (VXA-Default)
- #==============================================================================#
- # ● Installation
- # Below
- # Material
- # Scripts that make changes to actor.skills
- # Above
- # Main
- #==============================================================================#
- # ● How to Modify
- # set_rand_skills(n=4)
- # In the Game_Actor class, set_rand_skills, creates an array of 'n' size
- # And selects skills until its full (there will be no duplicates)
- # If the number of available skills falls under the array size, it will
- # be ignored.
- # If you wish to change the number of random skills, simply change the value
- # of 'n'
- #
- # reset_rand_turn_count()
- # This will set the number of turns till the next randomization
- # By default:
- # @rand_turn_count = 3 + rand(2)
- # The number of turns will be 3 or 4
- #==============================================================================#
- # ● Change Log
- # ♣ 03/25/2012 V1.0
- # Completed Script
- #==============================================================================#
- class Array
- def pick()
- self[rand(self.size)]
- end unless(method_defined?(:pick))
- def pick!()
- self.delete(pick())
- end unless(method_defined?(:pick!))
- end
- # // VXA
- class Game_Battler
- def all_skills() ; [] ; end
- def random_skills()
- set_rand_skills() unless(@random_skills)
- @random_skills
- end
- def set_rand_skills(n=4)
- sks = all_skills().compact().collect{|s|s.id}
- (@random_skills ||=[]).replace(Array.new(n){sks.pick!()}.compact)
- end
- def randomize_skills?()
- @randomize_skills = true if(@randomize_skills.nil?())
- @randomize_skills
- end
- attr_writer :randomize_skills
- def rand_turn_count()
- reset_rand_turn_count() unless(@rand_turn_count)
- @rand_turn_count
- end
- def reset_rand_turn_count()
- @rand_turn_count = 3 + rand(2)
- end
- alias :iex2_rbs_on_turn_end :on_turn_end
- def on_turn_end(*args,&block)
- iex2_rbs_on_turn_end(*args,&block)
- @rand_turn_count = rand_turn_count.pred
- if(@rand_turn_count <= 0)
- set_rand_skills() if(randomize_skills?())
- reset_rand_turn_count()
- end
- end
- end
- class Game_Actor
- alias :all_skills :skills
- def skills()
- $game_party.in_battle ? random_skills.collect{|id|$data_skills[id]} : all_skills()
- end
- end
- #=■==========================================================================■=#
- # // ● End of File ● // #
- #=■==========================================================================■=#
Advertisement
Add Comment
Please, Sign In to add comment