Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - kreiss

1
Oh my god, it work !
Thanks a lot !
2
Hi KK20 !

Is it possible to have a compitibility with this script ?

# Scroll Pictures 1.0 for XP, VX & VXAce by Zeus81
 
class Game_Scroll_Picture < Game_Picture
  attr_accessor :z, :map_anchor, :texture, :texture_ox, :texture_oy, :erased
  def initialize(number)
    @z  , @map_anchor, @texture                , @texture_ox, @texture_oy, @erased =
    1000, 1          , Game_Picture.new(number), 0          , 0          , false
    super(number)
  end
  def erase() @erased = true end
  def update
    super
    @texture.update
    @texture_ox -= @texture.x / 10.0
    @texture_oy -= @texture.y / 10.0
  end
end
 
class Sprite_Scroll_Picture < Sprite
  dll = FileTest.directory?('System') ? 'System/ZEUS' : 'ZEUS'
  GrayscaleMaskBlt = Win32API.new(dll, 'GrayscaleMaskBlt', 'iiiiiiiiii', 'i')
  def initialize(viewport, picture)
    super(viewport)
    @picture, @last_args = picture, []
  end
  def dispose
    bitmap.dispose if bitmap
    super
  end
  def update
    return unless self.visible = !@picture.name.empty? && !@picture.texture.name.empty?
    if @last_mask_name != @picture.name
      @last_mask_name = @picture.name.dup
      bitmap.dispose if bitmap
      mask = cache(@picture.name)
      self.bitmap = Bitmap.new(mask.width, mask.height)
    end
    if @picture.origin != 0
      self.ox = bitmap.width / 2
      self.oy = bitmap.height / 2
    else self.ox = self.oy = 0
    end
    self.x = @picture.x - @picture.map_anchor * map_display_x
    self.y = @picture.y - @picture.map_anchor * map_display_y
    self.z = @picture.z
    self.zoom_x = @picture.zoom_x / 100.0
    self.zoom_y = @picture.zoom_y / 100.0
    self.opacity = @picture.opacity
    self.blend_type = @picture.blend_type
    self.angle = @picture.angle
    self.tone = @picture.tone
    return unless self.visible = on_screen?
    super
    args = [bitmap.__id__ << 1, 0, cache(@picture.name).__id__ << 1, 0,
            cache(@picture.texture.name).__id__ << 1, 0,
            @picture.texture_ox.to_i, @picture.texture_oy.to_i,
            @picture.texture.zoom_x.to_i, @picture.texture.zoom_y.to_i]
    return if @last_args == args
    @last_args.replace(args)
    GrayscaleMaskBlt.call(*args)
  end
  def on_screen?
    x1, y1, w1, h1 = x, y, (bitmap.width*zoom_x).to_i, (bitmap.height*zoom_y).to_i
    w2, h2 = screen_width, screen_height
    if angle == 0
      x1, y1 = x1-w1/2, y1-h1/2 if ox != 0
      x1<w2 and x1+w1>0 and y1<h2 and y1+h1>0
    else
      x1, y1, r1 = (x1-w2/=2).abs, (y1-h2/=2).abs, Math.hypot(w1, h1)
      r1 /= 2 if ox != 0
      x1<=w2+r1 and y1<=h2+r1 and (x1<=w2 or y1<=h2 or Math.hypot(x1-w2,y1-h2)<=r1)
    end
  end
  if defined?(Hangup) #xp
    def cache(filename) RPG::Cache.picture(filename) end
    def screen_width()  640                          end
    def screen_height() 480                          end
    def map_display_x() $game_map.display_x / 4      end
    def map_display_y() $game_map.display_y / 4      end
  else                #vx & vxace
    def cache(filename) Cache.picture(filename)      end
    def screen_width()  Graphics.width              end
    def screen_height() Graphics.height              end
    if RUBY_VERSION == '1.8.1' #vx
      def map_display_x() $game_map.display_x / 8    end
      def map_display_y() $game_map.display_y / 8    end
    else                      #vxace
      def map_display_x() $game_map.display_x * 32  end
      def map_display_y() $game_map.display_y * 32  end
    end
  end
end
 
class Game_Map
  attr_reader :scroll_pictures
  alias zeus81_scroll_pictures_setup setup
  def setup(map_id)
    @scroll_pictures = {}
    zeus81_scroll_pictures_setup(map_id)
  end
  alias zeus81_scroll_pictures_update update
  def update(*args)
    @scroll_pictures.delete_if {|i, p| p.erased}
    @scroll_pictures.each_value {|p| p.update}
    zeus81_scroll_pictures_update(*args)
  end
end
 
class Spriteset_Map
  alias zeus81_scroll_pictures_dispose dispose
  def dispose
    @scroll_picture_sprites.each_value {|s| s.dispose}
    zeus81_scroll_pictures_dispose
  end
  alias zeus81_scroll_pictures_update update
  def update
    @scroll_picture_sprites ||= {}
    @scroll_picture_sprites.delete_if do |i, s|
      s.dispose if result = !$game_map.scroll_pictures.has_key?(i)
      result
    end
    for i, p in $game_map.scroll_pictures
      s = @scroll_picture_sprites[i] ||= Sprite_Scroll_Picture.new(@viewport1, p)
      s.update
    end
    zeus81_scroll_pictures_update
  end
end
 
if defined?(Hangup) #xp
 
  class Interpreter
    def execute_command
      if @index < @list.size-1
        @parameters = @list[@index].parameters
        method_name = "command_#{@list[@index].code}"
        return send(method_name) if respond_to?(method_name)
      else command_end
      end
      return true
    end
    def scroll_picture(id)
      $game_map.scroll_pictures[id] ||= Game_Scroll_Picture.new(id)
    end
    def scroll_picture_mask()    scroll_picture_setup(0) end
    def scroll_picture_texture() scroll_picture_setup(1) end
    def scroll_picture_setup(type)
      i = @index
      while(@list[i += 1].code.between?(231, 235))
        @list[i].parameters << type if @list[i].code < 233
        @list[i].code += 810000
      end
      return true
    end
    def command_810231
      picture = scroll_picture(@parameters[0])
      picture = picture.texture if @parameters[-1] != 0
      x, y = @parameters[4], @parameters[5]
      x, y = $game_variables[x], $game_variables[y] if @parameters[3] != 0
      picture.show(@parameters[1], @parameters[2], x, y, @parameters[6],
                  @parameters[7], @parameters[8], @parameters[9])
      return true
    end
    def command_810232
      picture = scroll_picture(@parameters[0])
      picture = picture.texture if @parameters[-1] != 0
      x, y = @parameters[4], @parameters[5]
      x, y = $game_variables[x], $game_variables[y] if @parameters[3] != 0
      picture.move(@parameters[1]*2, @parameters[2], x, y, @parameters[6],
                  @parameters[7], @parameters[8], @parameters[9])
      return true
    end
    def command_810233
      scroll_picture(@parameters[0]).rotate(@parameters[1])
      return true
    end
    def command_810234
      scroll_picture(@parameters[0]).start_tone_change(@parameters[1], @parameters[2]*2)
      return true
    end
    def command_810235
      id = @parameters[0]
      scroll_picture(id).erase if $game_map.scroll_pictures.has_key?(id)
      return true
    end
  end
 
else                #vx & vxace
 
  class Game_Interpreter
    if RUBY_VERSION == '1.8.1' #vx
      def wait(duration) @wait_count = duration end
      def execute_command
        if @index < @list.size-1
          @params, @indent = @list[@index].parameters, @list[@index].indent
          method_name = "command_#{@list[@index].code}"
          return send(method_name) if respond_to?(method_name)
        else command_end
        end
        return true
      end
    end
    def scroll_picture(id)
      $game_map.scroll_pictures[id] ||= Game_Scroll_Picture.new(id)
    end
    def scroll_picture_mask()    scroll_picture_setup(0) end
    def scroll_picture_texture() scroll_picture_setup(1) end
    def scroll_picture_setup(type)
      i = @index
      while(@list[i += 1].code.between?(231, 235))
        @list[i].parameters << type if @list[i].code < 233
        @list[i].code += 810000
      end
    end
    def command_810231
      picture = scroll_picture(@params[0])
      picture = picture.texture if @params[-1] != 0
      x, y = @params[4], @params[5]
      x, y = $game_variables[x], $game_variables[y] if @params[3] != 0
      picture.show(@params[1], @params[2], x, y, @params[6],
                  @params[7], @params[8], @params[9])
      return true
    end
    def command_810232
      picture = scroll_picture(@params[0])
      picture = picture.texture if @params[-1] != 0
      x, y = @params[4], @params[5]
      x, y = $game_variables[x], $game_variables[y] if @params[3] != 0
      picture.move(@params[2], x, y, @params[6], @params[7],
                  @params[8], @params[9], @params[10])
      wait(@params[10]) if @params[11]
      return true
    end
    def command_810233
      scroll_picture(@params[0]).rotate(@params[1])
      return true
    end
    def command_810234
      scroll_picture(@params[0]).start_tone_change(@params[1], @params[2])
      wait(@params[2]) if @params[3]
      return true
    end
    def command_810235
      id = @params[0]
      scroll_picture(id).erase if $game_map.scroll_pictures.has_key?(id)
      return true
    end
  end
 
end

And the DLL

I try de fixed it in different way, but I always have this error :



Thanks for your XPA system !
3
Script Troubleshooting / Re: [XP]Animated Picture
May 29, 2018, 12:12:36 pm
No, I use a new project.

Edit: Ow...  :facepalm:
I had to use a variable to move pictures.

It was so simple. :facepalm:

Thanks to help !
4
Hi guys!

I finded a script in Littledrago's blog.
But I don't know how the script work.

I rename my picture by "anime_01-001", "anime_01-002" etc...
But isn't working.

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# [Xp/Vx] Animated Picture
# Version: 1.00
# Author : LiTTleDRAgo
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Name your pictures with "anime_01-001","anime_01-002","anime_01-003" and so on
# You can use more than 1 animated picture
#
#    Just name it like "anime_02-001", "anime_02-002", etc
#                      "anime_03-001", "anime_03-002", etc
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

#==============================================================================
# ** Game_Picture
#------------------------------------------------------------------------------
#  This class handles the picture. It's used within the Game_Screen class
#  ($game_screen).
#==============================================================================

class Game_Picture
  #--------------------------------------------------------------------------
  # * Script Configuration
  #--------------------------------------------------------------------------
  DELAY = 3 # delay after each image (frames)
 
  LAST_FRAME_VAR    = 1
  CURRENT_FRAME_VAR = 2
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias update_animated_pict update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @name =~ /anime_..-(\d+)/i
      @animated = true
    else
      @animated = false
    end
    if @animated
      @counter.nil? ? @counter = 0 : @counter += 1
      if @counter == DELAY
        @counter = 0
        if $game_variables[CURRENT_FRAME_VAR] < $game_variables[LAST_FRAME_VAR]
          $game_variables[CURRENT_FRAME_VAR] += 1
          @frame = $game_variables[CURRENT_FRAME_VAR]
          @temp  = @name.scan(/anime_../)
          case @frame
          when  0..9  then @frame = "00#{@frame}"
          when 10..99 then @frame = "0#{@frame}"
          end
          name = "#{@temp}-#{@frame}"
          @name = name if picture_exist?(name)
        end
      end
    end
    update_animated_pict
  end
  #--------------------------------------------------------------------------
  # * Picture Exist
  #--------------------------------------------------------------------------
  def picture_exist?(filename)
    if defined?(Window_ActorCommand)
      return Cache.picture(filename) rescue return false
    else
      return RPG::Cache.picture(filename) rescue return false
    end
  end
end


Sorry for disturbance.

Edit : Isn't the good section, someone can move the topic please ?
5
New Projects / Re: [RMXP]Kingdom Hearts Rebirth 2
January 12, 2018, 07:35:53 am
Hi ! And happy new year !

Here is a new gameplay video !
It show you the new battle system. (All the project has been remade...)

https://www.youtube.com/watch?v=6fiYporfCjk&feature=youtu.be

If you a suggest, don't hesitate ! Enjoy !
6
RMXP Script Database / Re: [XP] XP Ace Tilemap
October 19, 2017, 11:54:47 pm
Thanks, it work perfectly !
7
RMXP Script Database / Re: [XP] XP Ace Tilemap
October 19, 2017, 09:07:50 am
I forget to say it's because my game screen is 854x480.
As you saying, the script assumes a default 640x480 resolution.

Too large for the Advanced Weather, maybe ?
8
RMXP Script Database / Re: [XP] XP Ace Tilemap
October 18, 2017, 03:11:43 pm
BTW, your script is awesome !

But he's not compatible with Advanced Weather System.
You can't adjust when the script is below XPA_Tilemap.
And when you put under XPA_Tilemap, you can't use another weather effects.
9
RMXP Script Database / Re: [XP] XP Ace Tilemap
October 13, 2017, 09:44:48 am
Why is not possible to do full screen for XP ?
10
RMXP Script Database / Re: [XP] XP Ace Tilemap
August 17, 2016, 05:02:30 pm
There are interesting things. (Zoom, fullscreen...)
11
RMXP Script Database / Re: [XP] XP Ace Tilemap
August 17, 2016, 04:08:47 pm
Ow, too bad.=(

I hope you can export the new one into XP.
12
RMXP Script Database / Re: [XP] XP Ace Tilemap
August 17, 2016, 04:01:12 pm
Yes, this line.
13
RMXP Script Database / Re: [XP] XP Ace Tilemap
August 17, 2016, 03:51:23 pm
With an new project I have an error line 1090.
Maybe I did something wrong ?
14
Script Troubleshooting / Re: [RMXP]Two movements
February 04, 2016, 10:30:48 pm
It work now! It's very simple... I'm feel idiot. xD
Thanks a lot !
15
Script Troubleshooting / Re: [RMXP]Two movements
February 04, 2016, 10:17:49 pm
It's just I don't know how edit the script, too hard for me. (I don't know how to script)

I don't know if you understand my problem ? (Because my english...)
16
Script Troubleshooting / Re: [RMXP]Two movements
February 04, 2016, 04:56:09 pm
Ow... That's why I need help.
17
Script Troubleshooting / Re: [RMXP]Two movements
February 04, 2016, 04:29:33 pm
I've watched already, but nothing something like that...
It's not possible to mix with an another script ?

here, this is the original script with diagonals moves. (Not iso)

######################### 
# SUPER WALK #
#Script créé par Zeus81#
#########################

class Game_Character


attr_reader :x2
attr_reader :y2

alias game_character_initialize initialize
def initialize
@x2 = 0
@y2 = 0
game_character_initialize
end

def moving?
return (@real_x != @x2 * 128 or @real_y != @y2 * 128)
end

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)
unless $game_map.valid?(new_x, new_y)
return false
end
if @through
return true
end
unless $game_map.passable?(x, y, d, self)
return false
end
unless $game_map.passable?(new_x, new_y, 10 - d)
return false
end
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if event.character_name != ""
return false
end
end
end
end
if $game_player.x == new_x and $game_player.y == new_y
unless $game_player.through
if @character_name != ""
return false
end
end
end
return true
end

def moveto(x, y)
@x = @x2 = x % $game_map.width
@y = @y2 = y % $game_map.height
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end

def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
@real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
end

def update_move
distance = 2 ** @move_speed
if @y2 * 128 > @real_y
@real_y = [@real_y + distance, @y2 * 128].min
end
if @x2 * 128 < @real_x
@real_x = [@real_x - distance, @x2 * 128].max
end
if @x2 * 128 > @real_x
@real_x = [@real_x + distance, @x2 * 128].min
end
if @y2 * 128 < @real_y
@real_y = [@real_y - distance, @y2 * 128].max
end
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end

def move_down(turn_enabled = true, player = false)
turn_down if turn_enabled
if passable?(@x, @y, 2)
if player
@x2 -= 0.125 if passable?(@x+1, @y, 2) == false and @x2 > @x
@x2 += 0.125 if passable?(@x-1, @y, 2) == false and @x2 < @x
multiplicateur = [(@move_speed - 4) * 2, 1].max
@y2 += 0.125 * multiplicateur
else
@y2 += 1
end
@y = @y2.round
increase_steps
else
if @y2 < @y
@y2 += 0.0625
else
check_event_trigger_touch(@x, @y+1)
end
end
end

def move_left(turn_enabled = true, player = false)
turn_left if turn_enabled
if passable?(@x, @y, 4)
if player
@y2 -= 0.125 if passable?(@x, @y+2, 4) == false and @y2 > @y
@y2 += 0.125 if passable?(@x, @y-2, 4) == false and @y2 < @y
multiplicateur = [(@move_speed - 4) * 2, 1].max
@x2 -= 0.125 * multiplicateur
else
@x2 -= 1
end
@x = @x2.round
increase_steps
else
if @x2 > @x
@x2 -= 0.0625
else
check_event_trigger_touch(@x-1, @y)
end
end
end

def move_right(turn_enabled = true, player = false)
turn_right if turn_enabled
if passable?(@x, @y, 6)
if player
@y2 -= 0.125 if passable?(@x, @y+1, 6) == false and @y2 > @y
@y2 += 0.125 if passable?(@x, @y-1, 6) == false and @y2 < @y
multiplicateur = [(@move_speed - 4) * 2, 1].max
@x2 += 0.125 * multiplicateur
else
@x2 += 1
end
@x = @x2.round
increase_steps
else
if @x2 < @x
@x2 += 0.0625
else
check_event_trigger_touch(@x+1, @y)
end
end
end

def move_up(turn_enabled = true, player = false)
turn_up if turn_enabled
if passable?(@x, @y, 8)
if player
@x2 -= 0.125 if passable?(@x+1, @y, 8) == false and @x2 > @x
@x2 += 0.125 if passable?(@x-1, @y, 8) == false and @x2 < @x
multiplicateur = [(@move_speed - 4) * 2, 1].max
@y2 -= 0.125 * multiplicateur
else
@y2 -= 1
end
@y = @y2.round
increase_steps
else
if @y2 > @y
@y2 -= 0.0625
else
check_event_trigger_touch(@x, @y-1)
end
end
end

def move_lower_left(turn_enabled = true, player = false)
turn_lower_left if turn_enabled
move_down(false, player)
move_left(false, player)
end

def move_lower_right(turn_enabled = true, player = false)
turn_lower_right if turn_enabled
move_down(false, player)
move_right(false, player)
end

def move_upper_left(turn_enabled = true, player = false)
turn_upper_left if turn_enabled
move_up(false, player)
move_left(false, player)
end

def move_upper_right(turn_enabled = true, player = false)
turn_upper_right if turn_enabled
move_up(false, player)
move_right(false, player)
end

def move_random
case rand(8)
when 0
move_lower_left
when 1
move_down
when 2
move_lower_right
when 3
move_left
when 4
move_upper_left
when 5
move_right
when 6
move_upper_right
when 7
move_up
end
end

def jump(x_plus, y_plus)
if x_plus != 0 or y_plus != 0
if x_plus.abs > y_plus.abs
x_plus < 0 ? turn_left : turn_right
else
y_plus < 0 ? turn_up : turn_down
end
end
loop do
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
straighten
@x += x_plus
@x2 += x_plus
@y += y_plus
@y2 += y_plus
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
return
end
x_plus -= 1 if x_plus > 0
x_plus += 1 if x_plus < 0
y_plus -= 1 if y_plus > 0
y_plus += 1 if y_plus < 0
end
end

def turn_lower_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
@stop_count = 0
end
end

def turn_lower_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
@stop_count = 0
end
end

def turn_upper_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
@stop_count = 0
end
end

def turn_upper_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
@stop_count = 0
end
end


end




class Game_Player < Game_Character


def update
last_x = @x
last_y = @y
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir8
when 1
move_lower_left(true, true)
when 2
move_down(true, true)
when 3
move_lower_right(true, true)
when 4
move_left(true, true)
when 6
move_right(true, true)
when 7
move_upper_left(true, true)
when 8
move_up(true, true)
when 9
move_upper_right(true, true)
end
end
last_moving = (last_x != @x or last_y != @y)
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end


18
Script Troubleshooting / [RMXP]Two movements
February 04, 2016, 03:08:53 pm
Hi guys
I have some problems with a amended script.
I explain you in picture :

*Red line : Isometric move.
*Green line : Diagonal move.

As you can see, the script handles very well  in isometric.
But now, diagonal move is sacrificed for iso movements.

I wan't to know if someone can help me with this.
Can you add diagonal movements with an activation condition ?

Exemple... if switch [0001] is on, diagonal movements is enable. (Green line)
If switch [0001] if off, we let isometric movements. (Red line)

#---------------------------------------------------------------------------------
# SUPER WALK 1.2b + Déplacements isométriques
#---------------------------------------------------------------------------------
# Script créé par Zeus81
# Modifiée par Kreiss
#---------------------------------------------------------------------------------

class Game_Player
SUPER_WALK_SWITCH = 130 # id de l'interrupteur pour activer/désactiver le script
end

class Game_Character

alias super_walk_game_character_initialize initialize
def initialize
   @x2 = @y2 = 0
   super_walk_game_character_initialize
end

def super_walk_distance
   @move_speed > 4 ? @move_speed > 5 ? 0.5 : 0.25 : 0.125
end

def moving?
   @real_x != @x2*128 or @real_y != @y2*128
end

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 false unless $game_map.valid?(new_x, new_y)
   return true  if @through
   return false unless $game_map.passable?(x, y, d, self)
   return false unless $game_map.passable?(new_x, new_y, 10-d)
   $game_map.events.each_value do |event|
     return false if event.x == new_x and event.y == new_y and !event.through and
                     (self != $game_player or !event.character_name.empty?)
   end
   return false if $game_player.x == new_x and $game_player.y == new_y and
                   !$game_player.through and !@character_name.empty?
   return true
end

def moveto(x, y)
   @x = @x2 = x % $game_map.width
   @y = @y2 = y % $game_map.height
   @real_x = @x * 128
   @real_y = @y * 128
   @prelock_direction = 0
end

def update_jump
   @jump_count -= 1
   @real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
   @real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
end

def update_move
   x128, y128, distance = @x2*128, @y2*128, 2**@move_speed
   if    x128 < @real_x; @real_x = [@real_x-distance*2, x128].max
   elsif x128 > @real_x; @real_x = [@real_x+distance*2, x128].min
   end
   if    y128 < @real_y; @real_y = [@real_y-distance, y128].max
   elsif y128 > @real_y; @real_y = [@real_y+distance, y128].min
   end
   if    @walk_anime; @anime_count += 1.5
   elsif @step_anime; @anime_count += 1
   end
end

def move_down(turn_enabled=true, super_walk=false)
   turn_down if turn_enabled
   if passable?(@x, @y, 2)
     turn_down
     if super_walk
       @x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y, 2)
       @x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y, 2)
       @y2 += super_walk_distance
       @y = @y2.round
     else @y2 = @y += 1
     end
     increase_steps
   elsif @y2 < @y
     @y2 += 0.125
   else
     check_event_trigger_touch(@x, @y+1)
     return false
   end
   return true
end

def move_left(turn_enabled=true, super_walk=false)
   turn_left if turn_enabled
   if passable?(@x, @y, 4)
     turn_left
     if super_walk
       @y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 4)
       @y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 4)
       @x2 -= super_walk_distance
       @x = @x2.round
     else @x2 = @x -= 1
     end
     increase_steps
   elsif @x2 > @x
     @x2 -= 0.125
   else
     check_event_trigger_touch(@x-1, @y)
     return false
   end
   return true
end

def move_right(turn_enabled=true, super_walk=false)
   turn_right if turn_enabled
   if passable?(@x, @y, 6)
     turn_right
     if super_walk
       @y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 6)
       @y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 6)
       @x2 += super_walk_distance
       @x = @x2.round
     else @x2 = @x += 1
     end
     increase_steps
   elsif @x2 < @x
     @x2 += 0.125
   else
     check_event_trigger_touch(@x+1, @y)
     return false
   end
   return true
end

def move_up(turn_enabled=true, super_walk=false)
   turn_up if turn_enabled
   if passable?(@x, @y,
     turn_up
     if super_walk
       @x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y,
       @x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y,
       @y2 -= super_walk_distance
       @y = @y2.round
     else @y2 = @y -= 1
     end
     increase_steps
   elsif @y2 > @y
     @y2 -= 0.125
   else
     check_event_trigger_touch(@x, @y-1)
     return false
   end
   return true
end
#--------------------------------------------------------------------------
# Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_down(false, super_walk)
   move2 = move_left(false, super_walk)
   move_left(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 6 ? 4 : last_dir == 8 ? 2 : last_dir
     @stop_count = 0
   end
   return move1 || move2
end
#--------------------------------------------------------------------------
# Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_down( false, super_walk)
   move2 = move_right(false, super_walk)
   move_right(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 4 ? 6 : last_dir == 8 ? 2 : last_dir
     @stop_count = 0
   end
   return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_up(  false, super_walk)
   move2 = move_left(false, super_walk)
   move_left(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 6 ? 4 : last_dir == 2 ? 8 : last_dir
     @stop_count = 0
   end
   return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right(turn_enabled=true, super_walk=false)
   last_dir = @direction
   move1 = move_up(  false, super_walk)
   move2 = move_right(false, super_walk)
   move_right(false, super_walk)
   if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
     @direction = last_dir == 4 ? 6 : last_dir == 2 ? 8 : last_dir
     @stop_count = 0
   end
   return move1 || move2
end
#--------------------------------------------------------------------------
def move_random
   case rand(8)
   when 0; move_lower_left
   when 1; move_down
   when 2; move_lower_right
   when 3; move_left
   when 4; move_upper_left
   when 5; move_right
   when 6; move_upper_right
   when 7; move_up
   end
end

def jump(x_plus, y_plus)
   loop do
     if (x_plus == 0 and y_plus == 0) or passable?(@x+x_plus, @y+y_plus, 0)
       if x_plus.abs > y_plus.abs
           x_plus < 0 ? turn_left : turn_right
       else y_plus < 0 ? turn_up  : turn_down
       end unless x_plus == 0 and y_plus == 0
       straighten
       @x  += x_plus
       @x2 += x_plus
       @y  += y_plus
       @y2 += y_plus
       @jump_peak = 10 - @move_speed + Math.hypot(x_plus, y_plus).round
       @jump_count = @jump_peak * 2
       @stop_count = 0
       return
     end
     x_plus -= 1 if x_plus > 0
     x_plus += 1 if x_plus < 0
     y_plus -= 1 if y_plus > 0
     y_plus += 1 if y_plus < 0
   end
end

end


class Game_Player

def update
   last_x, last_y, last_rx, last_ry = @x, @y, @real_x, @real_y
   super_walk = $game_switches[SUPER_WALK_SWITCH]
   unless last_moving = moving? or @move_route_forcing or
         $game_temp.message_window_showing or
         $game_system.map_interpreter.running?
     case Input.dir8
     when 1; move_lower_left( true, super_walk)
     when 2; move_down(      true, super_walk)
     when 3; move_lower_right(true, super_walk)
     when 4; move_left(      true, super_walk)
     when 6; move_right(      true, super_walk)
     when 7; move_upper_left( true, super_walk)
     when 8; move_up(        true, super_walk)
     when 9; move_upper_right(true, super_walk)
     end
   end
   last_moving = last_x != @x || last_y != @y if super_walk
   super
   $game_map.scroll_left(last_rx-@real_x)  if @real_x < last_rx and @real_x-$game_map.display_x < CENTER_X
   $game_map.scroll_right(@real_x-last_rx) if @real_x > last_rx and @real_x-$game_map.display_x > CENTER_X
   $game_map.scroll_up(last_ry-@real_y)    if @real_y < last_ry and @real_y-$game_map.display_y < CENTER_Y
   $game_map.scroll_down(@real_y-last_ry)  if @real_y > last_ry and @real_y-$game_map.display_y > CENTER_Y
   unless moving?
     if last_moving and !check_event_trigger_here([1,2])
       if @encounter_count > 0 and !($DEBUG and Input.press?(Input::CTRL))
         @encounter_count -= 1
       end
     end
     if Input.trigger?(Input::C)
       check_event_trigger_here([0])
       check_event_trigger_there([0,1,2])
     end
   end
end
end


It would help the project to have more fluid movements.
Thanks a lot !

PS : Switch 130 is for pixel movements.
19
Welcome! / Kreiss
February 04, 2016, 02:52:57 pm
Hello guys !
I'm already register before, but my account as been deleted.

My name is Kreiss (Chris), I'm from france. (Sorry for my english...)

I'm using RPG Maker XP since few years now.
I work on Kingdom Hearts Rebirth 2, and this is very hard... xD

I'm good in event, graphics and I'm very bad in script.

Nice to meet you, again ! x)