Ok guys, for those inevitable and totally unexpected parts in EVERY RPG game EVER made where one of your party members all of a sudden for no apparent reason turns around and says, "Mwa ha ha, I'm an evil spy for XYZ bad guy and you'll go no further" thus obviously spawning a battle with one of your actors I need a bit of help.
I'd like to NOT have to create an enemy that I'm guessing on the HP, MP and skills to be correct. I'd like to clone the actor stats and skills in all and create an enemy out of it. How could I do this? I'm a very good scripter and I THINK I've figured out everything but the skills. So if anyone has any suggestions please share them. You can write a scriptlet and show it to me.
Thanks for any help.
__________________________
"If your mind goes blank don't forget to turn off the sound." Unknown Author
Group: Member
Posts: 34
Type: Scripter
RM Skill: Advanced
Script
CODE
#=============================================================================== # # Actor-based Enemies # Version 1.0 # By Pacman (rmrk.net), for Phillip # Description: This script allows you to base enemies' stats off of actors' # stats. With a simple notetag, you can designate an enemy's name, skills, # element efficiency, status efficiency and battle stats from a specific actor. # You will need a place-holder enemy in which to place the notetag, and with # it a necessary graphic, gold amount and drops, which can't be taken from the # actor because they don't have those things. # Use the notetag: # \actor[x] # in an enemy's notebox to base the enemy's stats from the actor with ID x. # #===============================================================================
#============================================================================== # ** Game_Enemy #------------------------------------------------------------------------------ # This class handles enemy characters. It's used within the Game_Troop class # ($game_troop). #==============================================================================
class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # Alias listing #-------------------------------------------------------------------------- alias actor_enemy_initialize initialize alias actor_enemy_base_maxhp base_maxhp alias actor_enemy_base_maxmp base_maxmp alias actor_enemy_base_atk base_atk alias actor_enemy_base_def base_def alias actor_enemy_base_spi base_spi alias actor_enemy_base_agi base_agi alias actor_enemy_hit hit alias actor_enemy_eva eva alias actor_enemy_cri cri alias actor_enemy_odds odds alias actor_enemy_element_rate element_rate alias actor_enemy_state_probability state_probability #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(index, enemy_id, *args) actor_enemy_initialize(index, enemy_id, *args) @from_actor = false if !self.enemy.note[/\\actor\[(\d+)\]/].nil? @actor = $game_actors[$1.to_i] @original_name = @actor.name @hp = @actor.maxhp @mp = @actor.maxmp @from_actor = true end end #-------------------------------------------------------------------------- # * Aliased Stat Methods #-------------------------------------------------------------------------- def base_maxhp(*a) if @from_actor return @actor.base_maxhp else actor_enemy_base_maxhp(*a) end end def base_maxmp(*a) if @from_actor return @actor.base_maxmp else actor_enemy_base_maxmp(*a) end end def base_atk(*a) if @from_actor return @actor.base_atk else actor_enemy_base_atk(*a) end end def base_def(*a) if @from_actor return @actor.base_def else actor_enemy_base_def(*a) end end def base_spi(*a) if @from_actor return @actor.base_spi else actor_enemy_base_spi(*a) end end def base_agi(*a) if @from_actor return @actor.base_agi else actor_enemy_base_agi(*a) end end def hit(*a) if @from_actor return @actor.hit else actor_enemy_hit(*a) end end def eva(*a) if @from_actor return @actor.eva else actor_enemy_eva(*a) end end def cri(*a) if @from_actor return @actor.cri else actor_enemy_cri(*a) end end def odds(*a) if @from_actor return @actor.odds else actor_enemy_odds(*a) end end #-------------------------------------------------------------------------- # * Get Element Rate #-------------------------------------------------------------------------- def element_rate(element_id, *args) if @from_actor return @actor.element_rate(element_id, *args) else actor_enemy_element_rate(element_id, *args) end end #-------------------------------------------------------------------------- # * Get State probability #-------------------------------------------------------------------------- def state_probability(state_id, *args) if @from_actor return @actor.state_probability(state_id, *args) else actor_enemy_state_probability(state_id, *args) end end #-------------------------------------------------------------------------- # * Collect Skills #-------------------------------------------------------------------------- def skills skills = [] for action in enemy.actions skills.push if action.kind == 1 end if @from_actor for skill in @actor.skills skills.push(skill) unless skills.include?(skill) end end return skills.compact end #-------------------------------------------------------------------------- # * Make Battle Action #-------------------------------------------------------------------------- def make_action @action.clear return unless movable? available_actions = [] rating_max = 0 for action in enemy.actions next unless conditions_met?(action) if action.kind == 1 next unless skill_can_use?($data_skills[action.skill_id]) end available_actions.push(action) rating_max = [rating_max, action.rating].max end for skill in skills available_actions.push(skill) unless available_actions.include?(skill) end ratings_total = 0 rating_zero = rating_max - 3 for action in available_actions next if action.rating <= rating_zero ratings_total += action.rating - rating_zero end return if ratings_total == 0 value = rand(ratings_total) for action in available_actions next if action.rating <= rating_zero if value < action.rating - rating_zero @action.kind = action.kind @action.basic = action.basic @action.skill_id = action.skill_id @action.decide_random_target return else value -= action.rating - rating_zero end end end end
#=============================================================================== # # END OF SCRIPT # #===============================================================================
I hope this works for you.
This post has been edited by Pacman: Mar 9 2012, 05:49 PM