Kain Nobel
Member
What exactly is that supposed to do, Charlie Lee?
@actor_command_window.set_left_shortcut($data_system.words.guard)
class Window_Base
 #-----------------------------------------------------------------------------
 # * Set Position
 #-----------------------------------------------------------------------------
 def position(edge = 0, offset = 16)
  if edge.is_a?(Integer) ; edge = 0 if edge == 5
  else ; return
  end
  o = offset.is_a?(Integer) ? offset : 0
  case edge
  when 0 # Center
   self.x, self.y = (320 - (self.width / 2)) , (240 - (self.height / 2))
  when 2 # Center Bottom
   self.x, self.y = (320 - (self.width / 2)) , (480 - (self.height))
   unless o.zero? ; self.y -= o ; end
  when 4 # Center Left
   self.x, self.y = 0            , (240 - (self.height / 2))
   unless o.zero? ; self.x += o ; end
  when 6 # Center Right
   self.x, self.y = (640 - self.width)    , (240 - (self.height / 2))
   unless o.zero? ; self.x -= o ; end
  when 8 # Center Top
   self.x, self.y = (320 - (self.width / 2)) , 0
   unless o.zero? ; self.y += o ; end
  when 1 # Lower Left
   self.x, self.y = (0)           , (480 - self.height)
   unless o.zero? ; self.x += o ; self.y -= o ; end
  when 3 # Lower Right
   self.x, self.y = (640 - self.width)    , (480 - self.height)
   unless o.zero? ; self.x -= o ; self.y -= o ; end
  when 7 # Upper Left
   self.x, self.y = 0            , 0
   unless o.zero? ; self.x += o ; self.y += o ; end
  when 9 # Upper Right
   self.x, self.y = 640 - self.width     , 0
   unless o.zero? ; self.x -= o ; self.y += o ; end
  end
 end
end
@w0 = Window_Base.new(0,0,128,128)
@w1 = Window_Base.new(0,0,128,128)
@w3 = Window_Base.new(0,0,128,128)
@w7 = Window_Base.new(0,0,128,128)
@w9 = Window_Base.new(0,0,128,128)
@w2 = Window_Base.new(0,0,128,128)
@w4 = Window_Base.new(0,0,128,128)
@w6 = Window_Base.new(0,0,128,128)
@w8 = Window_Base.new(0,0,128,128)
@w0.position(5,16)
@w2.position(2,16)
@w4.position(4,16)
@w6.position(6,16)
@w8.position(8,16)
@w1.position(1,16)
@w3.position(3,16)
@w7.position(7,16)
@w9.position(9,16)
MACL::Loaded << 'RGSS.Party'
#===============================================================================
# ** Game_Party
#-------------------------------------------------------------------------------
#Â Â Added some simple methods for gaining/losing all items & equipment.
#===============================================================================
class Game_Party
 #-----------------------------------------------------------------------------
 # * Gain All (Type, -Quantity)
 #-----------------------------------------------------------------------------
 def gain_all(type, quantity = 99)
  if type.is_a?(Fixnum)
   case type
   when -1
    for i in 0...$data_items.size  ; gain_item(i,  quantity) ; end
    for i in 0...$data_weapons.size ; gain_weapon(i, quantity) ; end
    for i in 0...$data_armors.size ; gain_armor(i, quantity) ; end
   when 0 ; for i in 0...$data_items.size  ; gain_item(i,  quantity) ; end
   when 1 ; for i in 0...$data_weapons.size ; gain_weapon(i, quantity) ; end
   when 2 ; for i in 0...$data_armors.size ; gain_armor(i, quantity) ; end
   end
  end
 end
 #-----------------------------------------------------------------------------
 # * Lose All (Type, -Quantity)
 #-----------------------------------------------------------------------------
 def lose_all(type, quantity = 99)
  if quantity > 0 ; quantity *= -1 ; end
  gain_all(type, quantity)
 end
end
 #-------------------------------------------------------------------------
 # * Name   : Exists?
 #  Info   : Tests to see if Map exists
 #  Author  : Kain Nobel
 #  Call Info : id = Map ID in question
 #-------------------------------------------------------------------------
 def exists?(id)
  if  id.between?(100, 999) ; filename = "Data/Map"  + id.to_s + ".rxdata"
  elsif id.between?( 10, 99) ; filename = "Data/Map0" + id.to_s + ".rxdata"
  elsif id.between?( 1,  9) ; filename = "Data/Map00" + id.to_s + ".rxdata"
  else            ; return false
  end
  return FileTest.exist?(filename)
 end
class Game_Map
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader :map_id
 attr_reader :map_name
 #--------------------------------------------------------------------------
 # * Name   : Map Name
 #  Info   : Sends name of the map in question to a string
 #  Author  : Kain Nobel
 #  Call Info : id = Optional arg, returns name of specified ID
 #--------------------------------------------------------------------------
 def map_name(id = @map_id)
  @map_name = load_data("Data/MapInfos.rxdata")
  return @map_name[id].name
 end
end
for i in 0...$data_items.size ; gain_item(i, quantity) ; end
$data_items.each_index {|i| gain_item(i, quantity)}
if quantity > 0 ; quantity *= -1 ; end
quantity *= -1 if quantity > 0
quantity *= -1 if quantity > 0
quantity = -quantity.abs
def map_name(id = @map_id)
@map_name = load_data("Data/MapInfos.rxdata")
return @map_name[id].name
end
def map_name(id = @map_id)
@map_info ||= load_data("Data/MapInfos.rxdata")
return @map_info[id].name
end
@map_name = load_data("Data/MapInfos.rxdata")
@map_name ||= load_data("Data/MapInfos.rxdata")
$game_party.average('MaxHP') #<--Obtains average MaxHP of all actors (in your party.)
MACL::Loaded << 'RGSS.Party'
#===============================================================================
# ** Game_Party
#-------------------------------------------------------------------------------
#Â Â Added some simple methods for checking party averages and some other stuff.
#===============================================================================
class Game_Party
 #-----------------------------------------------------------------------------
 # * Average
 #-----------------------------------------------------------------------------
 def average(stat, float = false)
  avg = float ? 0.0 : 0
  case stat.downcase!
  when 'hp'  ; @actors.each_index {|i| avg += @actors[i].hp}
  when 'maxhp' ; @actors.each_index {|i| avg += @actors[i].maxhp}
  when 'sp'  ; @actors.each_index {|i| avg += @actors[i].sp}
  when 'maxsp' ; @actors.each_index {|i| avg += @actors[i].maxsp}
  when 'level' ; @actors.each_index {|i| avg += @actors[i].level}
  when 'exp' ; @actors.each_index {|i| avg += @actors[i].exp}
  when 'str' ; @actors.each_index {|i| avg += @actors[i].str}
  when 'dex' ; @actors.each_index {|i| avg += @actors[i].dex}
  when 'agi' ; @actors.each_index {|i| avg += @actors[i].agi}
  when 'int' ; @actors.each_index {|i| avg += @actors[i].int}
  when 'atk' ; @actors.each_index {|i| avg += @actors[i].atk}
  when 'pdef' ; @actors.each_index {|i| avg += @actors[i].pdef}
  when 'mdef' ; @actors.each_index {|i| avg += @actors[i].mdef}
  when 'eva' ; @actors.each_index {|i| avg += @actors[i].eva}
  end
  return avg / @actors.size
 end
 #-----------------------------------------------------------------------------
 # * Gain All (Type, -Quantity)
 #-----------------------------------------------------------------------------
 def gain_all(type, quantity = 99)
  if type.is_a?(Fixnum) && type.between?(-1, 2)
   case type
   when -1
    $data_items.each_index  {|i| gain_item(i, quantity)}
    $data_weapons.each_index {|i| gain_weapon(i, quantity)}
    $data_armors.each_index  {|i| gain_armor(i, quantity)}
   when 0 ; $data_items.each_index  {|i| gain_item(i, quantity)}
   when 1 ; $data_weapons.each_index {|i| gain_weapon(i, quantity)}
   when 2 ; $data_armors.each_index {|i| gain_armor(i, quantity)}
   end
  end
 end
 #-----------------------------------------------------------------------------
 # * Lose All (Type, -Quantity)
 #-----------------------------------------------------------------------------
 def lose_all(type, quantity = 99)
  quantity = -quantity.abs if quantity > 0
  gain_all(type, quantity)
 end
end
#===============================================================================
# ** Game_Map
#-------------------------------------------------------------------------------
#Â Added a method which will determine if jump is disabled on this map.
#===============================================================================
class Game_Map
 #-----------------------------------------------------------------------------
 # * Tile Blank?
 #-----------------------------------------------------------------------------
 def no_tile?(x, y)
  for i in 0..2
   return true if data[x,y,i].nil?
  end
  return data[x, y, 2].zero? && data[x, y, 1].zero? && data[x, y, 0].zero?
 end
end
#===============================================================================
# ** Game_Character
#-------------------------------------------------------------------------------
#Â This class has been enhanced to check which of the 8 directions a character
# is moving. Also enhanced passable?() so that you can't pass a spot which all
# 3 layers are tile #0.
#===============================================================================
class Game_Character
 #-----------------------------------------------------------------------------
 # * Alias Listings
 #-----------------------------------------------------------------------------
 alias_method :no_tile_passable?,          :passable?
 #-----------------------------------------------------------------------------
 # * Passable? (*Aliased*)
 #-----------------------------------------------------------------------------
 def passable?(x, y, d)
  new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  return $game_map.no_tile?(new_x, new_y) ? false : no_tile_passable?(x, y, d)
 end
 #-----------------------------------------------------------------------------
 # * Moving Down?
 #-----------------------------------------------------------------------------
 def moving_down?(diag = false)
  if diag ; return (self.real_y < self.y*128) && (self.real_x == self.x*128)
  end ; return (self.real_y < self.y * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Left?
 #-----------------------------------------------------------------------------
 def moving_left?(diag = false)
  if diag ; return (self.real_x > self.x*128) && (self.real_y == self.y*128)
  end ; return (self.real_x > self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Right?
 #-----------------------------------------------------------------------------
 def moving_right?(diag = false)
  if diag ; return (self.real_x < self.x*128) && (self.real_y == self.y*128)
  end ; return (self.real_x < self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Left?
 #-----------------------------------------------------------------------------
 def moving_up?(diag = false)
  if diag ; return (self.real_y > self.y*128) && (self.real_x == self.x*128)
  end ; return (self.real_y > self.y * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Lower Left?
 #-----------------------------------------------------------------------------
 def moving_lower_left?
  return (self.real_y < self.y * 128) && (self.real_x > self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Lower Right?
 #-----------------------------------------------------------------------------
 def moving_lower_right?
  return (self.real_y < self.y * 128) && (self.real_x < self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Lower Left?
 #-----------------------------------------------------------------------------
 def moving_upper_left?
  return (self.real_y > self.y * 128) && (self.real_x > self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Moving Lower Right?
 #-----------------------------------------------------------------------------
 def moving_upper_right?
  return (self.real_y > self.y * 128) && (self.real_x < self.x * 128)
 end
 #-----------------------------------------------------------------------------
 # * Move Direction?
 #-----------------------------------------------------------------------------
 def move_direction
  return 2 if moving_down?
  return 4 if moving_left?
  return 6 if moving_right?
  return 8 if moving_up?
  return 1 if moving_lower_left?
  return 3 if moving_lower_right?
  return 7 if moving_upper_left?
  return 9 if moving_upper_right?
  return 0
 end
 #-----------------------------------------------------------------------------
 # * Moving Diagonal?
 #-----------------------------------------------------------------------------
 def moving_diagonal?
  return true if moving_upper_left? or moving_upper_right?
  return true if moving_lower_left? or moving_lower_right?
  return false
 end
end
#===============================================================================
# ** Game_Player
#-------------------------------------------------------------------------------
#Â This class has been enhanced to check if player is attempting to move a
# diagonal specific or general diagonal direction.
#===============================================================================
class Game_Player < Game_Character
 #-----------------------------------------------------------------------------
 # * Attempt Up Left?
 #-----------------------------------------------------------------------------
 def attempt_upper_left?
  return (Input.press?(Input::UP) && Input.press?(Input::LEFT))
 end
 #-----------------------------------------------------------------------------
 # * Attempt Up Right?
 #-----------------------------------------------------------------------------
 def attempt_upper_right?
  return (Input.press?(Input::UP) && Input.press?(Input::RIGHT))
 end
 #-----------------------------------------------------------------------------
 # * Attempt Down Left?
 #-----------------------------------------------------------------------------
 def attempt_lower_left?
  return (Input.press?(Input::DOWN) && Input.press?(Input::LEFT))
 end
 #-----------------------------------------------------------------------------
 # * Attempt Down Right?
 #-----------------------------------------------------------------------------
 def attempt_lower_right?
  return (Input.press?(Input::DOWN) && Input.press?(Input::RIGHT))
 end
 #-----------------------------------------------------------------------------
 # * Attempt Diagonal?
 #-----------------------------------------------------------------------------
 def attempt_diagonal?
  return true if attempt_upper_left?
  return true if attempt_upper_right?
  return true if attempt_lower_left?
  return true if attempt_lower_right?
  return false
 end
end
Yeah, I forgot to include the screenshot.dll. I'll add that in the next update. Nice idea for the checksum. I'll do some research and see if I can't throw something in the update. What exactly was the problem with the MACL and your script?I just noticed something...in the Screenshot module, it references a need for Screenshot.dll. Since it doesn't seem to be named as a Windows registered library, I assume it's something I need to download, but there isn't a demo and I can't seem to find the file.
EDIT: Something I just thought of that would be interesting is a sort of checksum for save files and data files to assure they aren't hacked. The files themselves would store a set of indeces (or a certain external checksum file would hold indeces for all the data files) that aren't in themselves checksums. They would index a table of possible checksums, the values distributed randomly, like a random number table. Each one would take certain specific bits from the file to compile a checksum instead of the entire file. There are probably better ways to do it, as I've never put together any sort of data integrity algorithms before, but this is just my idea for the time being...stop me if somebody's already written something for this purpose...
EDIT2: And I figured out why my player sprite was not displaying correctly. It had nothing to do with pixel movement. It was because some modifications I've been making to Game_Battler have resulted in the player erroneously being .dead? and the recent Game_Character modifications in MACL used that to remove the player sprite. This was all going wrong not because the player was actually dead, but because I used a '=' accidentally instead of a '==' 0_0
class Window_Command
alias_method :macl_wnshortcuts_wnc_init, :initialize
alias_method :macl_wnshortcuts_wnc_update, :update
def initialize(width, commands)
macl_wnshortcuts_wnc_init(width, commands)
@shortcuts = {}
end
def add_shortcut(key, index)
@shortcuts[key] = index
end
def update
@shortcuts.each do |key, index|
if Input.trigger?(key)
@index = index
break
end
end
macl_wnshortcuts_wnc_update
end
end
Script 'Modules.Moveable' line 192: NoMethodError occured
undefined method 'sign' for nil:NilClass
SephirothSpawn":uwtnch9d said:I did however change something that was slowing down everything drastically. I left a debug tool in there, that runs the refresh method every frame, vs. when the battler changes. It now only updates when the battler dies or changes. (Making a special battler= method, vs. attr_writer: battler).