[Resolved][RMXP] Adding Self-Scope Targetting to KK20's Target them all

Started by Wraith89, February 20, 2024, 12:05:15 am

Previous topic - Next topic

Wraith89

Script referenced: here

One feature I like about this script is the addition of cursor confirming who you target before you select your skills as the default battle system doesn't indicate any of that. I even made it so wecoc's VX Ace random targets also worked with this by adding his respective scopes to the script. However I'm having trouble adding one for self (scope 7) as this isn't defined in the script. I suppose it wouldn't make sense to have it there because if you use a self targeting skill there is no need to point to the enemy side which a single ally scope skill would be able to do.

Basically what I'm asking is if it is possible to add a way to have a cursor point to self (scope 7) added into this script. Thank you.

KK20

Couple things need to be done. One is to obviously setup the arrow selection to point to the user. The other is to prevent the player from moving the arrow.

So in my script, I had rewritten the two methods update_phase3_skill_select and update_phase3_item_select. I'm just gonna focus on the former for now.
class Scene_Battle
  def update_phase3_skill_select
    # ...
    # If C button was pressed
    if Input.trigger?(Input::C)
      # ...
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
We can add the user scope in this conditional
elsif @skill.scope == 3 or @skill.scope == 5 or @skill.scope == 7
Now the arrow shows up but we're able to move it around from actor to actor. We'll need to rework the Arrow_Actor class. Add this class to the script:
class Arrow_Actor < Arrow_Base
  attr_accessor :disable_selection
 
  def initialize(viewport)
    @disable_selection = false
    super
  end
 
  alias update_actor_arrow_selection update
  def update
    return update_actor_arrow_selection unless @disable_selection

    super
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
end
I've added a disable_selection property to the class. If set to true, you will no longer be able to move the cursor left/right. So now let's set that property:
      elsif @skill.scope == 3 or @skill.scope == 5 or @skill.scope == 7
        # Start actor selection
        start_actor_select
        # Prevent actor selection if scope is the user
        @actor_arrow.disable_selection = @skill.scope == 7
Now just make the same edits to update_phase3_item_select (replacing @skill with @item obviously).
      elsif @item.scope == 3 or @item.scope == 5 or @item.scope == 7
        # Start actor selection
        start_actor_select
        @actor_arrow.disable_selection = @item.scope == 7
Start up your game and confirm that the arrow now appears on user scope and doesn't move.


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Wraith89

Thanks a lot. I was thinking exactly as you did and attempted to add scope 7 to the conditional but was stuck on disabling the movement of the cursor. It works perfectly!