Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Skill for changing character

Hey, Im working on a Digimon game and I didn't find a way (event based) to that when lets say Agumon uses the attack called "Digivolution" he will be replaced with a Greymon that is the same level as the agumon. Some one can help me with this please?
 
Well, the command "Change Actor Graphic" is always there for you to use. You can do something like this (without script)

Have the Digivolution skill set to add the "Digivolve" status, then set the skill with common event. In the common event, set a conditional branch "If Agumon stat "Digivolved" is inflicted", change the actor graphic. If you want to make Agumon more powerful after digivolve, set "Digivolve" status to give additional power like STR to 150%

Hope you're understand. Eventing isn't that hard lol, scripting is :P
 
I though about it but making this for each digimon its kind of a problem.
besides as a Greymon he has new attacks so Agumon need to be removed from the party and Greymon in untill his SP is over
Thanks any way :)
And I know, all my game for now is event based
 
Ok. Let me try this. Mind you, I have not opened rmxp to try this, so let me know if it doesn't work.

Code:
class RPG::Skill
  # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills = {}
  def evolution_skill?
    return Evolution_Skills.has_key?(@id)
  end
  def evolution_data
    return Evolution_Skills[@id]
  end
end

class Game_Battler
  alias_method :seph_actorevolution_amactr_se, :skill_effect
  def skill_effect(user, skill)
    result = seph_actorevolution_amactr_se(user, skill)
    if user.is_a?(Game_Actor) && skill.evolution_skill?
      data = skill.evolution_data
      if data.has_key?(user.id)
        $game_party.evolve_actor(user.id, data[user.id])
      end
    end
    return result
  end
end

class Game_Party
  def evolve_actor(actor_id, target_actor_id)
    actor = $game_actors[actor_id]
    return unless @actors.include?(actor)
    target_actor = $game_actors[target_actor_id]
    target_actor.exp = actor.exp
    @actors[@actors.index(actor)] = target_actor
    refresh
  end
end

So lets say skill 5, actor 1 evolves to actor 3, and actor 2 evolves to actor 4.
Code:
class RPG::Skill
  # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills = {}
  Evolution_Skills[5] = {1 => 3, 2 => 4}

Let me know if you need any further help.
 
Thanks a lot!!!!!!!!! I'll test it right a way
Edit: There can be a way to make the script work by name and not by ID? 'cause in my game you start with no digimons so Agumon for example can be number 3 by ID and it can be 1 by ID :S
Thanks for helping any way :)
 
ID's are more or less set in your database, not how you aquire each member. For example, Arshes (is that his name? I honestly forget) is the First hero shown by default, and thus has Hero ID 1. Whether or not he's the first party member you get makes no difference; he'll always be hero ID 1
 
so I did  Evolution_Skills[5] = {6 => 7} Agumon's ID is 6 and Greymon's is 7 and it doesn't work when it uses this skill :\ its say there is a problem with line 33:    @actors[@actor.index(actor)] = target_actor
 

khmp

Sponsor

Are you putting an end after this code?

Code:
class RPG::Skill
  # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills = {}
  Evolution_Skills[1] = {1 => 3, 2 => 4}
 
No I don't have another line above this
I belive this is the class there is a problem with, this is how it is in my project:
Code:
  
class RPG::Skill
 # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills[5] = {1 => 3, 2 => 4}
  def evolution_skill?
    return Evolution_Skills.has_key?(@id)
  end
  def evolution_data
    return Evolution_Skills[@id]
  end
end
 
It should be:
Code:
class RPG::Skill
 # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills = {}
  Evolution_Skills[5] = {1 => 3, 2 => 4}
  def evolution_skill?
    return Evolution_Skills.has_key?(@id)
  end
  def evolution_data
    return Evolution_Skills[@id]
  end
end
 
When I use this:
Code:
class RPG::Skill
  # skill_id => {actor_id => target_actor_id, ...}, ...
  Evolution_Skills = {}
  Evolution_Skills[1] = {7=>4}
  def evolution_skill?
    return Evolution_Skills.has_key?(@id)
  end
  def evolution_data
    return Evolution_Skills[@id]
  end
end

class Game_Battler
  alias_method :seph_actorevolution_amactr_se, :skill_effect
  def skill_effect(user, skill)
    result = seph_actorevolution_amactr_se(user, skill)
    if user.is_a?(Game_Actor) && skill.evolution_skill?
      data = skill.evolution_data
      if data.has_key?(user.id)
        $game_party.evolve_actor(user.id, data[user.id])
      end
    end
    return result
  end
end

class Game_Party
  def evolve_actor(actor_id, target_actor_id)
    actor = $game_actors[actor_id]
    return unless @actors.include?(actor)
    target_actor = $game_actors[target_actor_id]
    target_actor.exp = actor.exp
    @actors[@actors.index(actor)] = target_actor
    refresh
  end
end

It works. It doesn't show any animations or anything, but does switch the actors correctly as it should.
 
I copyed the script and it works~!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you Thank you Thank you Thank you Thank you!!!!!!!
Just one more quastion, he de-digivolves back into agumon when the he runs out of SP?

Edit: sorry but when I quit the menu another agumon appears
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top