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.

Topics - kreiss

1
Hi everyone.

I tried to convert my rmxp script to rmvxace, but I have a error from Game_Interpreter. (I'm beginner)



The script allow to flip picture.

class Game_Picture
  attr_reader  :mirror
 
  alias mirror_initialize initialize
  def initialize(number)
    mirror_initialize(number)
    @mirror ||= false
  end

  def mirror=(bool)
    @mirror = bool
  end
end # class Game_Picture

class Sprite_Picture
    alias mirror_update update
    def update
      mirror_update
      self.mirror = @picture.mirror
    end
end # class Sprite_Picture

class Game_Interpreter
    def mirror_picture(id, bool)
      $game_screen.pictures[id].mirror = bool
    end
end # class Game_Interpreter

Thanks for help !

EDIT : I resolved my problem, omg I'm so dumb...

I just replace "$game_screen.pictures" by "screen.pictures".
2
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 ?
3
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.
4
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)