MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
387
Reaction score
94
First Language
English
Primarily Uses
Hello ! your script it's working like a charm, i am really happy with this combat sytsem, is there a way to make it compatible with this script ? https://forum.chaos-project.com/index.php/topic,12640.0.html
I took a look at that script, and I think I can make a patch to make them compatible (if XP was more like Ace, they probably would've been compatible out of the box). If I have time this weekend, I'll make it and let you know.


i watched the video, and it look like the Persona 3/4/5 turn battle mechanic.
you know where in Persona 3/4/5 when its your turn, you take an action IMMEDIATELY.
and after you took an action, the next battler does an action when its their turn.
and when a battler has the highest Agility Stat (A.K.A. Speed Stat)
that certain battler goes first at Turn 0/1.
I've never played the Persona games so I'll have to take your word for it lol :D:guffaw:
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
203
Reaction score
6
First Language
English
Primarily Uses
RMXP
@MobiusXVI
its ok, its just that in the Persona 3/4/5 Turn Battle Mechanic
where you strike an enemy's weakness (or land a critical hit),
they get knocked down (not dead) and you get a "1 More",
but you can't get that "1 More" again
when the enemy is ALREADY knocked down.
(and also the same "1 More" mechanic applies to the enemies as well.)
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
387
Reaction score
94
First Language
English
Primarily Uses
@Fred_than_dead I think this will work for you. I haven't tested it though so let me know if you encounter any bugs.
Ruby:
#===============================================================================
# Mobius' Charge Turn Battle System + Target Anyone Scope PATCH
# Author: Mobius XVI (CTB) + KK20 (TAS)
# Version: 1.0
# Date: 14 NOV 2020
#===============================================================================
#
# Introduction:
#
#   This is a patch script to make KK20's TAS script compatible with Mobius's
#   CTB script.
#
# Instructions:
#
#  - Place this script below all the default scripts but above main.
#  - The order of scripts should be:
#   Default scripts
#   TAS
#   CTB
#   PATCH
#   Main
#
#  Credits/Thanks:
#    - Mobius XVI, author
#    - KK20, TAS script: https://forum.chaos-project.com/index.php/topic,12640.0.html
#
#  License
#    This script is licensed under the MIT license, so you can use it for
#    both commercial and non-commercial games.
#
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # Make skill window visible
    @skill_window.visible = true
    # Update skill window
    @skill_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End skill selection
      end_skill_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the skill window
      @skill = @skill_window.skill
      # If it can't be used
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.skill_id = @skill.id
      # Make skill window invisible
      @skill_window.visible = false
            
            ### PATCHING IN ANY TARGET ###
            
            # If effect scope is single enemy or single ally and can target anyone
      if @skill.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@skill.scope == 1 or @skill.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        @any_target = true
            end
            
            ### END PATCH ###
            
      # If effect scope is single enemy
      if @skill.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is all enemy - Mobius
      elsif @skill.scope == 2
        # Start all enemy selection
        start_all_enemy_select
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is all ally - Mobius
      elsif @skill.scope == 4 or @skill.scope == 6
        # Start all actor selection
        start_all_actor_select
      # If effect scope is not single
      else
        # End skill selection
        end_skill_select
        # Go to command input for next actor
        start_phase4
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
            
            ### PATCHING IN ANY TARGET ###
            
            # If effect scope is single enemy or single ally and can target anyone
      if @item.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@item.scope == 1 or @item.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @item.scope
        @any_target = true
            end
            
            ### END PATCH ###
            
      # If effect scope is single enemy
      if @item.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is all enemy - Mobius
      elsif @item.scope == 2
        # Start all enemy selection
        start_all_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is all ally - Mobius
      elsif @item.scope == 4 or @item.scope == 6
        # Start all actor selection
        start_all_actor_select
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        start_phase4
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    # Update enemy arrow
    @enemy_arrow.update
        # If Beastiary is added
        if Mobius::Charge_Turn_Battle::BEASTIARY
            # If Beastiary access button is pressed
            if Input.trigger?(Input::BEASTIARY_BATTLE_ACCESS_BUTTON)
                # Set enemy
                enemy = @enemy_arrow.enemy
                # If enemy has been scanned -- Mobius added
                if enemy.state?(Mobius::Charge_Turn_Battle::SCAN_STATE_ID)
                # Play decision SE
                $game_system.se_play($data_system.decision_se)
                # Start turn order window
                start_enemy_detail_window(enemy)
                return
                else
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
                end
            end
        end
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::DOWN)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_enemy_select
        start_actor_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
        # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End enemy selection
      end_enemy_select
            @active_battler.changed_scope = false     
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @enemy_arrow.index
      # End enemy selection
      end_enemy_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      # Go to command input for next actor
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    # Update actor arrow
    @actor_arrow.update
        # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::UP)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_actor_select
        start_enemy_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End actor selection
      end_actor_select
            @active_battler.changed_scope = false     
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @actor_arrow.index
      # End actor selection
      end_actor_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      # Go to command input for next actor
      start_phase4
    end
  end
 
end
 

nerthul11

Warper
Member
Joined
Jan 20, 2021
Messages
2
Reaction score
1
First Language
Spanish
Primarily Uses
RMXP
Hello! I've just seen this. First of all I want to thank you, it works brilliantly.

I'm trying to make a few adjustments to a game using this battle system and I have a quick question.

Is there a more optimal way of using the SKILL_SPEED_FACTORS (or any of the specific ones) when I have multiple SKILLS that have the same CT? I was thinking of something like {[1,2,3] => 10} instead of setting it individually like {1 => 10, 2 => 10, 3 => 10}.

Thanks again!
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
387
Reaction score
94
First Language
English
Primarily Uses
Is there a more optimal way of using the SKILL_SPEED_FACTORS (or any of the specific ones) when I have multiple SKILLS that have the same CT? I was thinking of something like {[1,2,3] => 10} instead of setting it individually like {1 => 10, 2 => 10, 3 => 10}.

Yea, since this is ultimately just more Ruby code we can use a little bit of coding to do something like that. So for your example, you could do:
Ruby:
# SKILL_SPEED_FACTORS is identical in set up to WEAPON_SPEED_FACTORS but for skills.
SKILL_SPEED_FACTORS = {}
SKILL_SPEED_FACTORS.default = 0
# New section to add multiple skills at once
for skill_id in [1,2,3] # Here you can put all the skill IDs that have the same speed
    SKILL_SPEED_FACTORS[skill_id] = 10 # Here you can put what that same speed is
end
 

nerthul11

Warper
Member
Joined
Jan 20, 2021
Messages
2
Reaction score
1
First Language
Spanish
Primarily Uses
RMXP
That's a good workaround, works perfectly. Thanks!
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
347
Reaction score
132
First Language
English
Primarily Uses
RMXP
Honestly, this is why I do case statements for my configurations, especially when it comes to numbers.
Code:
case skill_id
when 1 then 10
when 2,5,10 then 20
when 20..50 then 50
else
  30
end
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
387
Reaction score
94
First Language
English
Primarily Uses
Honestly, this is why I do case statements for my configurations, especially when it comes to numbers.

It's an interesting idea, but I tend to view my configs as data rather than code hence why I use a hash (which is used to store data) rather than a case statement (which is used for coding logic). I will say one advantage to the hash is that it's easier to manipulate at runtime, meaning that you could take in configs from an end-user via hash and do some post-processing on the entered values, which is something I've had to do before.
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
347
Reaction score
132
First Language
English
Primarily Uses
RMXP
I'm not saying case statements work all the time; I'm just saying in this particular instance it works better. It's also easier for people who don't know a lick of programming to config because it reads in English.

Hashes are bulky and slow, which is why I tend to avoid their use whenever I can. You'll have to tell me when you had to do post-processing though--sounds extremely niche.
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
387
Reaction score
94
First Language
English
Primarily Uses
Well, you might be surprised by Ruby hashes. In general, their lookup times are actually quite a bit faster than arrays especially when you're doing lookups by the key (see: Hashes vs Array). Basically, they do a sort of internal indexing in order to speed up retrieval. This makes them slower to add new elements, so you wouldn't want to use them for anything where you're constantly adding and removing elements, but for mostly static retrieval they offer excellent performance.

As for the post-processing, it really wasn't that odd. For my quest journal script, I take in a large amount of text for the quests. Because the text isn't formatted to fit neatly within the display box, I do line length calculations in order to split the text into appropriate line lengths. It's a slow operation, so I only do it once (the first time the configs are loaded) and then store the result for later display, which makes it much faster to open and display the journal while the player is actually playing.
 

Latest Threads

Latest Profile Posts

SF_People1_2 added!
index.php

Ami
--- Minimum Requirement ---

M.Knight: Phew...finally,i got the New Game. Let's check the Requirement
"Minimum Requirement:
  • 2.00 Ghz CPU
  • Full HD Support GPU
  • 5GB Memory"
M.Knight: I just have decent Gaming PC,i can play 2010-2015 Games. Hope it's okay
(1 Hour Later,The Game FPS Just Got 10-20)
M.Knight: (Facepalm)
Next goal is to make pull & push + lift & throw systems with mouse support and have skill levels in them and action indicators!
>What's your avatar about? Is it yours?
I did not do that drawing. It's a screenshot taken from a comic featuring characters from Touhou such as Tenshi and Iku (the girl in the avatar). It's drawn by someone under the name of Yohane.
Link to the comic (SFW, but navigating around Dynasty Reader is NSFW)

Forum statistics

Threads
109,174
Messages
1,042,741
Members
141,668
Latest member
Noel_Lwin
Top