AwesomeCool's patch for Shaz mouse script and Yanfly battle engine ace (Version 1.1 released)

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
Patch: Shaz mouse system + yanfly Battle System v1
By:AwesomeCool

Introduction
  Allows user to select enemy by putting mouse directly over it.

Features
-Any size enemy


-works with battle Symphony!

Screenshots
none needed

How to Use
See script header

Demo
none

Script


https://www.dropbox.com/s/xetjb6cgx6v89ch/AwesomeCool%20Yanfly%2BShaz%20mouse%20patch.rb?dl=0


FAQ

Q: How you do this?
A: Read header


Q: I WANT! I WANT!


A: Ask nicely first


Q: Can you make it work for other battle systems?


A: please specify which battle system you need it to work for and maybe I will do it.

Credit and Thanks
- AwesomeCool
- Shaz and Yanfly for the awesome scripts that they made!
- Everyone else for being awesome
 
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
Screenshots


none needed
You could have one you know... btw, I take it that if two enemies overlap, it selects the one in the foreground?
 

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
You could have one you know... btw, I take it that if two enemies overlap, it selects the one in the foreground?
.Yep it should select the one in front.  If it doesn't let me know.
 

Leonardo Myst

Veteran
Veteran
Joined
Mar 13, 2014
Messages
42
Reaction score
17
First Language
English
Primarily Uses
Forgive me for asking...
I was testing this out to see if I wanted to use it and I got an error:


Script 'AwesomeCool Shaz Patch' line 248: NoMethodError occurred

undefined method 'spriteset' for #<Scene_Battle:0x970872c>

What am I doing wrong?

I tagged the rats,

<selectbox width: 92>
<selectbox height: 102>


Sorry... I just realized I wasn't using Battle Symphony... I had started to, but switched to Moghunter's script.
 
Last edited by a moderator:

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
Fixed a major variable name bug.

Please update.
 

sapiboong

Veteran
Veteran
Joined
May 7, 2014
Messages
248
Reaction score
115
First Language
Indonesian
Primarily Uses
Is it possible to make this work for Theo's side battle system? :)  
 

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
hmmmm.

What problems are with it between theo and this script?
 

GolfHacker

Veteran
Veteran
Joined
Feb 15, 2015
Messages
477
Reaction score
682
First Language
English
Primarily Uses
RMVXA
Thank you very much for making this script! I was concerned that I might not be able to use a mouse system with my game until I spotted this.

FYI - when I copied and pasted from the dropbox link above, it didn't work. Looks like it is missing the last "end". I added another line at the end and typed "end", and then it worked.
 

Horrow

A Young Weird Artist
Veteran
Joined
Jun 6, 2014
Messages
79
Reaction score
33
First Language
Vietnamese
Primarily Uses
Can it work with Falcao's mouse button system?
 

oloimp

Artist
Veteran
Joined
Jun 12, 2013
Messages
187
Reaction score
26
First Language
German
Primarily Uses
RMMV
This is exactly what I have been looking for, thank you very much!
 

Violet

The Sun of Beryl
Member
Joined
Mar 28, 2016
Messages
19
Reaction score
4
First Language
English
Primarily Uses
This is pretty close to what I'm looking for! But the Dropbox link doesn't work. :/


I'd be very grateful if someone could provide the script.
 

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
fixed the link.
 

Violet

The Sun of Beryl
Member
Joined
Mar 28, 2016
Messages
19
Reaction score
4
First Language
English
Primarily Uses
Thank you so very much, omg.
 
Last edited by a moderator:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,041
Reaction score
679
First Language
English
Primarily Uses
RMVXA
Hey, Thanks for the great script. I went looking for this cause my battles didn't have any mouse selection to click on the enemies.


I only have one issue with it. It's probably a compatibility somehow. I am using yanfly engine and victor sant engine with victor animated battles and actor battlers. Plus many more. 57 scripts in all. What happens is that my mouse is on one enemy and the cursor is on a different enemy.


Any ideas on how to fix that?


Thanks


*update I was able to fix the problem by removing a conflicting script and using a different script for the function removed.
 
Last edited by a moderator:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,041
Reaction score
679
First Language
English
Primarily Uses
RMVXA
how do you delete posts?
 
Last edited by a moderator:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,041
Reaction score
679
First Language
English
Primarily Uses
RMVXA
dropbox link dead
Ruby:
=begin
================================================================================
 ** Patch: Shaz mouse system + yanfly Battle System v1
 Diffuculty: super simple
 Author: AwesomeCool
 Date: Jan 25, 2014
 
--------------------------------------------------------------------------------
 ** Change log
  1.1: Jan  7, 2015
    -Fixed variable name error.
  1.0: Jan 25, 2014
    -Initial Release
    
--------------------------------------------------------------------------------
 *Requirements
 -SUPER SIMPLE MOUSE SCRIPT by Shaz
 -Yanfly Engine Ace - Ace Battle Engine
 
    
--------------------------------------------------------------------------------
 * Description
 
  Allows user to select enemy by putting mouse directly over it.
  
--------------------------------------------------------------------------------
  *Terms
  
  Free to use for all projects as long as credit is given to AwesomeCool, Shaz,
  and Yanfly
  
--------------------------------------------------------------------------------
 * How to Use
 
  -First, set Monster note tags
  -Second, Yell out loud
  
--------------------------------------------------------------------------------
 * Tags
 
    -Enemy:
     - <selectbox width: x>
      Description: replace x with width of character sprite
      (if using battle symphony wth enemies that are either character sets or
      holder format, make it width of each INDIVIDUAL sprite on the sheet).
     - <selectbox height: y>
      Description: replace y with height of character sprite
      (if using battle symphony wth enemies that are either character sets or
      holder format, make it height of each INDIVIDUAL sprite on the sheet).
      
    OPTIONAL:
     -<selectbox offset x: *>
      Description: replace * by offset of sprite's x value.
     -<selectbox offset y: *>
      Description: replace * by offset of sprite's y value.
      
          
--------------------------------------------------------------------------------
 *Script Calls
 
    -none
 
--------------------------------------------------------------------------------
=end
 
module Mouse #Do not touch this line.
  module Selection #Do not touch this line.
    #---------------------------------------------------------------------------
    #Configuration
    #---------------------------------------------------------------------------
    
    #Change 0 to number of default x offset you want
    DEFAULT_ENEMY_OFFSET_X = 0
    
    #Change -8 to number of default y offset you want
    DEFAULT_ENEMY_OFFSET_Y = -8
    
  end #Do not touch this line.
end #Do not touch this line.
 
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
### DO NOT EDIT BEYOND THIS POINT UNLESS YOU KNOW WHAT YOU ARE DOING ###
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
 
module Selection
  
    SelectboxOFFSET_X = /<(?:selectbox offset x):[ ](\d+)>/i
    SelectboxOFFSET_Y = /<(?:selectbox offset y):[ ](\d+)>/i
    Selectbox_W = /<(?:selectbox width):[ ](\d+)>/i
    Selectbox_H = /<(?:selectbox height):[ ](\d+)>/i
  
end
 
module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_ms load_database; end
  def self.load_database
    load_database_ms
    load_notetags_ms
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_aoe
  #--------------------------------------------------------------------------
  def self.load_notetags_ms
    groups = [$data_enemies]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_ms
      end
    end
  end
  
end # DataManager
 
#==============================================================================
# ยยก RPG::Enemy
#==============================================================================
 
class RPG::Enemy < RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :offset_x
  attr_accessor :offset_y
  attr_accessor :hitbox_h
  attr_accessor :hitbox_w
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_aoe
  #--------------------------------------------------------------------------
  def load_notetags_ms
    @offset_x = Mouse::Selection::DEFAULT_ENEMY_OFFSET_X
    @offset_y = Mouse::Selection::DEFAULT_ENEMY_OFFSET_Y
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when Selection::SelectboxOFFSET_X
        @offset_x = $1.to_i
      when Selection::SelectboxOFFSET_Y
        @offset_y = $1.to_i
      when Selection::Selectbox_W
        @hitbox_w = [$1.to_i, 1].max
      when Selection::Selectbox_H
        @hitbox_h = [$1.to_i, 1].max
      #---
      end
    } # self.note.split
    #---
  end
  
end # RPG::Enemy
 
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  alias  mouse_target_start start
  def start
    mouse_target_start
    enemySelectionSetup
  end
  #-----
  
  def enemySelectionSetup
    return if $game_troop.nil?
    $game_troop.members.each do |enemy|
      enemy.selectionBoxX = enemy.screen_x
      enemy.selectionBoxWidth = enemy.screen_x + enemy.sprite.width
      enemy.selectionBoxY = enemy.screen_y
      enemy.selectionBoxHeight = enemy.screen_y + enemy.sprite.height
    end
  end
  
end
 
class Game_Battler < Game_BattlerBase
  
  attr_accessor :selectionBoxX
  attr_accessor :selectionBoxWidth
  attr_accessor :selectionBoxY
  attr_accessor :selectionBoxHeight
  
  alias selection_init initialize
  def initialize
    selection_init
    selectionBoxX = nil
    selectionBoxWidth = nil
    selectionBoxY = nil
    selectionBoxHeight = nil
  end
  
  def selectbox
    rect = Rect.new(0, 0, 32, 32)
    rect.x = screen_x  + selectbox_x_offset - selectbox_width/2
    rect.y = screen_y  + selectbox_y_offset - selectbox_height
    rect.width = selectbox_width
    rect.height = selectbox_height
    return rect
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_x_offset
  #--------------------------------------------------------------------------
  def selectbox_x_offset
    return 0
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_y_offset
  #--------------------------------------------------------------------------
  def selectbox_y_offset
    return 0
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_width
  #--------------------------------------------------------------------------
  def selectbox_width
    return sprite.width
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_height
  #--------------------------------------------------------------------------
  def selectbox_height
    return sprite.height
  end
  
end
 
class Game_Enemy < Game_Battler
  
  #--------------------------------------------------------------------------
  # new method: sprite
  #--------------------------------------------------------------------------
  def sprite
    return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_x_offset
  #--------------------------------------------------------------------------
  def selectbox_x_offset
    return enemy.offset_x unless enemy.offset_x.nil?
    return super
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_y_offset
  #--------------------------------------------------------------------------
  def selectbox_y_offset
    return enemy.offset_y unless enemy.offset_y.nil?
    return super
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_width
  #--------------------------------------------------------------------------
  def selectbox_width
    return enemy.hitbox_w unless enemy.hitbox_w.nil?
    return super
  end
  
  #--------------------------------------------------------------------------
  # new method: hitbox_height
  #--------------------------------------------------------------------------
  def selectbox_height
    return enemy.hitbox_h unless enemy.hitbox_h.nil?
    return super
  end
  
end # Game_Enemy
 
class Spriteset_Battle
  attr_accessor :actor_sprites
  attr_accessor :enemy_sprites
end
 
class Window_BattleEnemy < Window_Selectable
  
  def process_mouse_handling
    return unless $mouse.enabled? && cursor_movable?
    # Add a delay to prevent too-fast scrolling
    @delay = @delay ? @delay + 1 : 0
    return if @delay % 3 > 0
    
    mx, my = *Mouse.position
      
      alive_troop = $game_troop.alive_members
      alive_troop.sort! { |a,b| a.screen_x <=> b.screen_x }
      
      for i in 0 ... alive_troop.size
        rect = alive_troop[i].selectbox
        if mx.between?(rect.x, rect.x + rect.width) &&
          my.between?(rect.y, rect.y + rect.height)
          last_index = @index
          select(i)
          if @index != last_index
            Sound.play_cursor
          end
          break
        end
      end
  end
  
end
 

twosnakes

Villager
Member
Joined
Aug 24, 2020
Messages
9
Reaction score
6
First Language
English
Primarily Uses
RMVXA
Amazing, thank you so much!
 

Latest Threads

Latest Profile Posts


No water this time, just trying for a majestic cliffside... The cave snuck in because I liked it. Now I guess I need a mini cave map or "secret" for it. :kaoswt:
Revamped the crew for my VN about thirty times. Only character that's stayed constant has been the fungus character. Guess it really grew on me...
I want to work on my reboot, but I don't have time to do it. ;_;
4y195n.png
big image so i posted it as a spoiler
Just a reminder to back your projects up. Do it now! :yamero:

Forum statistics

Threads
111,272
Messages
1,059,811
Members
144,570
Latest member
ojw713
Top