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.

[XP/VX] Summoning

This event system will demonstrate how to create a summoning skill that can be used by a party member. There are many things that can be done to make this skill unique. This will provide you with a basic setup which can then be altered to fit your needs.

Features
-Summon and dismiss characters
-Only one character can be summoned at a time
-Complete recovery upon dismissal
-Dismissal after battle (add-on)
-Prevention of summoning when there are already four party members (script)

Characters
Before you go any further, you need to create the characters that you wish to summon. You can, for now, just make the characters, or you could set up their class, stats, etc. now and then continue.

Skills
These are the skills that you will need to create before you start making the common events. I'll only include the information that you need to add for now. I'm going to include two possible characters to summon in this example.

Summon Character 1
Scope: None
Occasion: Always

Summon Character 2
Scope: None
Occasion: Always

Dismiss
Scope: None
Occasion: Always

Common Events
Now, it's time to set up the common events that you'll need.

Summon Character 1
Trigger: None
Code:
@>Change Party Member: Add [Character 1]

@>Change Skills: [Summoner], + [Dismiss]

@>Change Skills: [Summoner], - [Summon Character 1]

@>Change Skills: [Summoner], - [Summon Character 2]

Summon Character 2
Trigger: None
Code:
@>Change Party Member: Add [Character 2]

@>Change Skills: [Summoner], + [Dismiss]

@>Change Skills: [Summoner], - [Summon Character 1]

@>Change Skills: [Summoner], - [Summon Character 2]

In these events, you add the character to the party (summon them), then add the "Dismiss" skill and remove all "Summon Character" skills.

Dismiss
Trigger: None
Code:
@>Conditional Branch: [Character 1] is in the party

   @>Recover All: [Character 1]

   @>Change Party Member: Remove [Character 1] 

 :  Branch End

@>Conditional Branch: [Character 2] is in the party

   @>Recover All: [Character 2]

   @>Change Party Member: Remove [Character 2]

 :  Branch End 

@>Control Variables: [0001: Summoner's Level] = [Summoner]'s Level

@>Change Skills: [Summoner], + [Summon Character 1]

@>Conditional Branch: Variable [0001: Summoner's Level] >= 3

   @>Change Skills: [Summoner], + [Summon Character 2]

 :  Branch End

@>Change Skills: [Summoner], - [Dismiss]

That's a lot to take in all at once, so I'll explain it in pieces. The first two conditional branches check which character is in the party (which one was summoned), and, based on those results, it heals the appropriate character and removes them from the party. Next, I created a variable to keep track of the summoner's level. This isn't used for "Summon Character 1" because the summoner knew that skill at level 1, but "Summon Character 2" is learned at level 3. So, I created a conditional branch that checks the summoner's level. If the summoner's level is greater than or equal to level 3, "Summon Character 2" is added to the summoner's skills. Finally, I removed the "Dismiss" skill.

Dismiss Check
Trigger: Parallel
Switch: 0001: Start
Code:
@>Conditional Branch: [Summoner] is [Dismiss] learned

   @>Conditional Branch: [Summoner] is [Summon Character 2] learned

       @>Change Skills: [Summoner], - [Summon Character 2]

    :  Branch End

 :  Branch End

This common event is needed because when a character achieves the required level, the skill is added to their list. So, this parallel common event that starts as soon as possible (with a switch that's turned on at the start of the game) resolves a small problem. If a character is summoned and the summoner learns a new summoning skill, they'll have both the "Dismiss" skill and the new summoning skill. That means they'll be able to have more than one summoned character in the party. This common event checks if the summoner has "Dismiss" and then, if that's true, it checks for extra summoning skills and removes them.

Skills
Summon Character 1
Common Event: 001: Summon Character 1

Summon Character 2
Common Event: 002: Summon Character 2

Dismiss
Common Event: 003: Dismiss

You just need to attach the common events to the corresponding skills. Now, fill out the rest of the information in the skills if you wish and attach the skills to the summoner's class. That's it!


Dismissal After Battle
If you want the summoned characters to be dismissed after battle, you just need to make a few adjustments, which will be explained below.

Skills
Summon Character 1
Occasion: Only in Battle

Summon Character 2
Occasion: Only in Battle

Dismiss
Occasion: Only in Battle

You'll need to change all of the summoning skills so the player can only use them in battle. If the player can summon outside of battle, there's no point in dismissing the summoned character after battle in the first place, so make sure you include these changes.

Common Events
Dismiss Check
Code:
@>Conditional Branch: [Summoner] is [Dismiss] learned

   @>Conditional Branch: [Character 1] is in the party

      @>Recover All: [Character 1]

      @>Change Party Member: Remove [Character 1]

    :  Branch End

   @>Conditional Branch: [Character 2] is in the party

      @>Recover All: [Character 2]

      @>Change Party Member: Remove [Character 2]

    :  Branch End

   @>Control Variables: [0001: Summoner's Level] = [Summoner]'s Level

   @>Change Skills: [Summoner], + [Summon Character 1]

   @>Conditional Branch: Variable [0001: Summoner's Level] >= 3

      @>Change Skills: [Summoner], + [Summon Character 2]

    :  Branch End

   @>Change Skills: [Summoner], - [Dismiss]

 :  Branch End

It looks like a lot, but it's really just the Dismiss common event pasted below the conditional branch that checks whether or not the character knows "Dismiss". The conditional branch that checked for the "Summon Character 2" skill after checking for "Dismiss" is no longer necessary, so it can be deleted and replaced by the entire "Dismiss" common event.


Scripts
RPG Maker XP
Battler Error
If you're using RPG Maker XP, you'll need to use the following script. This script fixes an error where a character's battler won't appear if the character is removed and then added to the party again.
Code:
#----------------------------------------------------------------------------

# [XP] Battler Fix

#----------------------------------------------------------------------------

# Made by khmp

#----------------------------------------------------------------------------

# This script fixes an error where a character's battler won't appear if

# the character is removed and then added to the party again.

#----------------------------------------------------------------------------

# Instructions: Paste in a new slot above "Main" and below "Scene_Debug".

#----------------------------------------------------------------------------

 

class Sprite_Battler < RPG::Sprite

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    # If battler is nil

    if @battler == nil

      #

      # I only added this one line

      #

      @battler_name = nil

      #

      #

      #

      self.bitmap = nil

      loop_animation(nil)

      return

    end

    

    # If file name or hue are different than current ones

    if @battler.battler_name != @battler_name or

       @battler.battler_hue != @battler_hue

      # Get and set bitmap

      @battler_name = @battler.battler_name

      @battler_hue = @battler.battler_hue

      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)

      @width = bitmap.width

      @height = bitmap.height

      self.ox = @width / 2

      self.oy = @height

      # Change opacity level to 0 when dead or hidden

      if @battler.dead? or @battler.hidden

        self.opacity = 0

      end

    end

    # If animation ID is different than current one

    if @battler.damage == nil and

       @battler.state_animation_id != @state_animation_id

      @state_animation_id = @battler.state_animation_id

      loop_animation($data_animations[@state_animation_id])

    end

    # If actor which should be displayed

    if @battler.is_a?(Game_Actor) and @battler_visible

      # Bring opacity level down a bit when not in main phase

      if $game_temp.battle_main_phase

        self.opacity += 3 if self.opacity < 255

      else

        self.opacity -= 3 if self.opacity > 207

      end

    end

    # Blink

    if @battler.blink

      blink_on

    else

      blink_off

    end

    # If invisible

    unless @battler_visible

      # Appear

      if not @battler.hidden and not @battler.dead? and

         (@battler.damage == nil or @battler.damage_pop)

        appear

        @battler_visible = true

      end

    end

    # If visible

    if @battler_visible

      # Escape

      if @battler.hidden

        $game_system.se_play($data_system.escape_se)

        escape

        @battler_visible = false

      end

      # White flash

      if @battler.white_flash

        whiten

        @battler.white_flash = false

      end

      # Animation

      if @battler.animation_id != 0

        animation = $data_animations[@battler.animation_id]

        animation(animation, @battler.animation_hit)

        @battler.animation_id = 0

      end

      # Damage

      if @battler.damage_pop

        damage(@battler.damage, @battler.critical)

        @battler.damage = nil

        @battler.critical = false

        @battler.damage_pop = false

      end

      # Collapse

      if @battler.damage == nil and @battler.dead?

        if @battler.is_a?(Game_Enemy)

          $game_system.se_play($data_system.enemy_collapse_se)

        else

          $game_system.se_play($data_system.actor_collapse_se)

        end

        collapse

        @battler_visible = false

      end

    end

    # Set sprite coordinates

    self.x = @battler.screen_x

    self.y = @battler.screen_y

    self.z = @battler.screen_z

  end

end

Inhibit Party Overload
This script will allow you to set which skills are summoning skills so they can't be used when there are already four party members. Instructions for setting it up are inside the script.
Code:
#----------------------------------------------------------------------------

# [XP] Inhibit Party Overload

#----------------------------------------------------------------------------

# Made by Guardian(1239)

#----------------------------------------------------------------------------

# This script prevents a skill or skills from being used when there

# are already four party members.  This was made to be used with my

# summoning event system, but it can be used elsewhere.

#----------------------------------------------------------------------------

# Instructions: Paste in a new slot above "Main" and below all other

# custom scripts.  Edit the values for "Skills" to match the ID(s)

# of the skill(s) you wish to follow the restriction of the script

# (can't be used when there are four party members).

#----------------------------------------------------------------------------

# Copyright: You may use this script freely.  You may distribute

# this script as long as credit is given to Guardian(1239).  You

# may edit this script as you wish.  You may distribute an edit of

# this script as long as credit for the original is given to

# Guardian(1239).

#----------------------------------------------------------------------------

 

module PARTY_OVERLOAD

  # Edit these values to match the ID(s) of the skill(s) you wish

  # to follow the restriction of the script (can't be used when

  # there are four party members).

  Skills = [1,2]

end

 

class Game_Battler

  include PARTY_OVERLOAD

  #--------------------------------------------------------------------------

  # * Determine Usable Skills

  #     skill_id : skill ID

  #--------------------------------------------------------------------------

  alias overload_skill_can_use? skill_can_use?

  def skill_can_use?(skill_id)

    # If there are 4 party members, the summoning skills can't be used.

    if ($game_party.actors.size == 4 and Skills.include?(skill_id))

      return false

    end

    

    overload_skill_can_use?(skill_id)

 

  end

end

RPG Maker VX
Variable Error
If you're using RPG Maker VX, you'll need to use the following script. This script fixes the problems with the default variable operation scripts.
Code:
#----------------------------------------------------------------------------

# [VX] Variable Fix

#----------------------------------------------------------------------------

# Made by Yeyinde

#----------------------------------------------------------------------------

# This script fixes the problems with the default variable operation 

# scripts.

#----------------------------------------------------------------------------

# Paste in a new slot under "Materials".

#----------------------------------------------------------------------------

 

class Game_Interpreter

  def command_122

    value = 0

    case @params[3]  # Operand

    when 0  # Constant

      value = @params[4]

    when 1  # Variable

      value = $game_variables[@params[4]]

    when 2  # Random

      value = @params[4] + rand(@params[5] - @params[4] + 1)

    when 3  # Item

      value = $game_party.item_number($data_items[@params[4]])

    when 4  # Actor

      actor = $game_actors[@params[4]]

      if actor != nil

        case @params[5]

        when 0  # Level

          value = actor.level

        when 1  # Experience

          value = actor.exp

        when 2  # HP

          value = actor.hp

        when 3  # MP

          value = actor.mp

        when 4  # Maximum HP

          value = actor.maxhp

        when 5  # Maximum MP

          value = actor.maxmp

        when 6  # Attack

          value = actor.atk

        when 7  # Defense

          value = actor.def

        when 8  # Spirit

          value = actor.spi

        when 9  # Agility

          value = actor.agi

        end

      end

    when 5  # Enemy

      enemy = $game_troop.members[@params[4]]

      if enemy != nil

        case @params[5]

        when 0  # HP

          value = enemy.hp

        when 1  # MP

          value = enemy.mp

        when 2  # Maximum HP

          value = enemy.maxhp

        when 3  # Maximum MP

          value = enemy.maxmp

        when 4  # Attack

          value = enemy.atk

        when 5  # Defense

          value = enemy.def

        when 6  # Spirit

          value = enemy.spi

        when 7  # Agility

          value = enemy.agi

        end

      end

    when 6  # Character

      character = get_character(@params[4])

      if character != nil

        case @params[5]

        when 0  # x-coordinate

          value = character.x

        when 1  # y-coordinate

          value = character.y

        when 2  # direction

          value = character.direction

        when 3  # screen x-coordinate

          value = character.screen_x

        when 4  # screen y-coordinate

          value = character.screen_y

        end

      end

    when 7  # Other

      case @params[4]

      when 0  # map ID

        value = $game_map.map_id

      when 1  # number of party members

        value = $game_party.members.size

      when 2  # gold

        value = $game_party.gold

      when 3  # steps

        value = $game_party.steps

      when 4  # play time

        value = Graphics.frame_count / Graphics.frame_rate

      when 5  # timer

        value = $game_system.timer / Graphics.frame_rate

      when 6  # save count

        value = $game_system.save_count

      end

    end

    for i in @params[0] .. @params[1]   # Batch control

      case @params[2]  # Operation

      when 0  # Set

        $game_variables[i] = value

      when 1  # Add

        $game_variables[i] += value

      when 2  # Sub

        $game_variables[i] -= value

      when 3  # Mul

        $game_variables[i] *= value

      when 4  # Div

        $game_variables[i] /= value if value != 0

      when 5  # Mod

        $game_variables[i] %= value if value != 0

      end

      if $game_variables[i] > 99999999    # Maximum limit check

        $game_variables[i] = 99999999

      end

      if $game_variables[i] < -99999999   # Minimum limit check

        $game_variables[i] = -99999999

      end

    end

    $game_map.need_refresh = true

    return true

  end

end

 

Inhibit Party Overload
This script will allow you to set which skills are summoning skills so they can't be used when there are already four party members. Instructions for setting it up are inside the script.
Code:
#------------------------------------------------------------------

# [VX] Inhibit Party Overload

#------------------------------------------------------------------

# Made by Guardian(1239)

#------------------------------------------------------------------

# This script prevents a skill or skills from being used when there

# are already four party members.  This was made to be used with my

# summoning event system, but it can be used elsewhere.

#------------------------------------------------------------------

# Instructions: Paste in a new slot under "Materials" and below all

# other custom scripts.  Edit the values for "Skills" to match the

# ID(s) of the skill(s) you wish to follow the restriction of the 

# script (can't be used when there are four party members).

#------------------------------------------------------------------

# Copyright: You may use this script freely.  You may distribute

# this script as long as credit is given to Guardian(1239).  You

# may edit this script as you wish.  You may distribute an edit of

# this script as long as credit for the original is given to

# Guardian(1239).

#------------------------------------------------------------------

 

module PARTY_OVERLOAD

  # Edit these values to match the ID(s) of the skill(s) you wish

  # to follow the restriction of the script (can't be used when

  # there are four party members).

  Skills = [1,2]

end

 

class Game_Battler

  include PARTY_OVERLOAD

  #--------------------------------------------------------------------------

  # * Determine Usable Skills

  #     skill : skill

  #--------------------------------------------------------------------------

  alias overload_skill_can_use? skill_can_use?

  def skill_can_use?(skill)

    # If there are 4 party members, the summoning skills can't be used.

    if ($game_party.members.size == 4 and Skills.include?(skill.id))

      return false

    end

 

    overload_skill_can_use?(skill)

 

  end

end


Demos
The first two demos contain the base structure for summoning, and the second two demos contain the Dismissal After Battle add-on. All of them are hosted by Mediafire.

Summoning Base (XP)
Summoning Base (VX)
Summoning Dismissal (XP)
Summoning Dismissal (VX)


Problems?
Post any problems you're having with the event system or scripts here and I'll help you fix them.
 
"**Please be aware that if you summon in RMXP, dismiss, then summon again, the battler will not appear.  It has nothing to do with the event.  It's an error that occurs within the system."

I got to there and stopped.  That's kind of a big glitch thats in your event.  There must be a way to fix it, you probably should.
 
Actingman00":2viwm77n said:
"**Please be aware that if you summon in RMXP, dismiss, then summon again, the battler will not appear.  It has nothing to do with the event.  It's an error that occurs within the system."

I got to there and stopped.  That's kind of a big glitch thats in your event.  There must be a way to fix it, you probably should.
I've tried, but no one's been able to figure it out.  I was waiting for a solution, but I wanted to release it as it is for now.  Rest assured, I'm working on it.
 
that glitch is probably because you do not reset the event, as it never happened. If you use it once, you'll switch on one of the conditional branches making it impossible for the summon to occur again.

although i may be wrong.
 
If that were the problem, I'd think the actual summoning wouldn't work.  The character is summoned, but the graphic isn't.  I tried adding "Exit Event Processing" after each branch end, but it made no difference.  Thank you for your suggestions, though.
 
how about this, after you dismiss it, you add a "charge" function in which you can only use it again after X turns. after X turns, you can repeat the Summon command.
 
Nope, that didn't work, either.  I created a state that adds the restriction Can't Move, but after that I still encountered the problem.  The charge function is a good idea, though.
 
Nice, I like it...however, they seem to stay in your party the next time you battle instead of being dismissed automatically at the end of the battle.  Is there a way to fix this maybe?
 
Hmm..  I've no idea on how to fix this with events. I have a solution though, but it requires a little bit of scripting..
Anyways, here it is if anyone wants it:

Code:
#==============================================================================
# ** Remove Summon [XP] & [VX]
#------------------------------------------------------------------------------
#  By: Gando
#  15/4 2008
#------------------------------------------------------------------------------
#  This little script will help you remove the summons after the battle.
#  All you have to do is to create a Common event. Set it to parallel process
#  and choose your condition switch. Then inside the common event, create an
#  event command saying: Change party member:Remove [Summoned person]
#
#  Change "Summoned Person" to the the Actor that you can summon.
#
#  For every summon that is available in the game, you need to add an extra 
#  remove event inside the Common event. 
#  Or else they won't be removed after battle.
#
#
#  REMOVE_SWITCH: change this number to the condition switch in the Common event
#  SUMMON_SWITCH: This should be the same number as the summoning switch,
#                 (switch number 1 in the tutorial)
#
#
#  I noticed that if you have a summoned unit, and the battle ends, then in the
#  the next battle if you try to summon again it will say:
#  "you can only have one summon.." even if you don't have any units summoned.
#  And that is what the summon switch is for. It will fix this.
#
#==============================================================================
class Scene_Battle
  REMOVE_SWITCH = 2
  SUMMON_SWITCH = 1
  #--------------------------------------------------------------------------
  # * Alias definitions
  #--------------------------------------------------------------------------
  alias summon_removal_switch_battle_end battle_end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
    def battle_end(result)
    summon_removal_switch_battle_end(result)
    if (result == 0 or
        result == 1 or
        result == 2)
      $game_switches[REMOVE_SWITCH] = true
      $game_switches[SUMMON_SWITCH] = false
    end
  end
end

The comments inside the script will help you set it up.
This script works for both XP and VX. :thumb:

Over and out - Gando
 
Wow, Gando.  That's excellent!  Thank you for helping!  I'll add it to the first post!  I also made it easier to navigate by using more spoilers.
 
very good job Guardian!
but, can you made compatible your summon system with the RTAB system??
i tested it on a RTAB system and it don't work, so can you do enithing?
 
I've never actually worked with anything that isn't turn-based.  I very much prefer the turn-based combat system.  I'm not sure why it wouldn't work on a RTAB system since events are events and they should work unless there's a conflict with the battle system.  I recommend checking with the maker of the system you're using and asking them what you can do to resolve the problem.
 

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