Sujet n°13169
Posté par Izumi le 8 Sep - 20:51 (2013)
Titre : "Bump" aux collisions (script modifié)
Bonjour tout le monde (ça se sent que je bosse beaucoup sur mon projet en ce moment, non ?).

Dans le cadre de mon projet, j'ai voulu intégrer ce script : ./4892.html?q=game player direction
(Au cas où, le son est là : ./11972.html)

Ancienne modif'
Sauf que comme c'est signalé sur le post, le son se répétait une dizaine de fois à chaque collision (un genre de "bbubuubububububmp"). Du coup j'ai décidé de bidouiller un peu avec les commandes pour que le son ne se joue qu'une fois. Et comme j'ai trouvé une solution qui fonctionne (au moins à la première collision, je n'ai pas encore trouvé le moyen de l'empêcher de se répéter si on appuie une nouvelle fois sur la touche, mais j'y travaille).

Il faut remplacer cette partie du script (présente 4 fois) :
Code:
 if !check_event_trigger_touch(@x, @y-1) 
        Audio.se_play("Audio/SE/bump.wav") 


par :
Code:
 if !check_event_trigger_touch(@x-1, @y) 
        Audio.se_play("Audio/SE/bump.wav")
       sleep 0.2
        Audio.se_stop()


Voilà, c'est pas énorme mais je me suis dit que ça pourrait être utile à certains.


Bon pour ceux qui auraient la flemme de descendre dans la page, Ku'rei a refait le script avec les petites erreurs en moins. Du coup comme ça marche mieux que mon petit bidouillage et que ça enlève les problèmes de base.
That's it :


Script remastérisé par Ku'rei
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================

class Game_Player < Game_Character
# BUMPER USERS
BUMP_SOUND = "Audio/SE/bump.wav" # Chemin et nom du fichier son à jouer (SE Obligatoirement)
SILENCE_LENGTH = 40 # Nombre frames de pause entre chaque"bump !"
def try_play_bump(x, y)
if !check_event_trigger_touch(x, y) and @silence_count == 0
Audio.se_play(BUMP_SOUND)
@silence_count = SILENCE_LENGTH
end
end

#--------------------------------------------------------------------------
# * Invariables
#--------------------------------------------------------------------------
CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4
CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4
def initialize(*arg)
super(*arg)
@lastdir=0
@lastdirframe=0
@silence_count = 0 # Compteur de silence. 0 => on peut jouer sinon non
end
def pbHasDependentEvents?
return $PokemonGlobal.dependentEvents.length>0
end
def move_down(turn_enabled = true)
if turn_enabled
turn_down
end
if passable?(@x, @y, 2)
turn_down
@y += 1
increase_steps
else
try_play_bump(@x, @y+1)
end
end
def move_left(turn_enabled = true)
if turn_enabled
turn_left
end
if passable?(@x, @y, 4)
turn_left
@x -= 1
increase_steps
else
try_play_bump(@x-1, @y)

end
end
def move_right(turn_enabled = true)
if turn_enabled
turn_right
end
if passable?(@x, @y, 6)
turn_right
@x += 1
increase_steps
else
try_play_bump(@x+1, @y)
end
end
def move_up(turn_enabled = true)
if turn_enabled
turn_up
end
if passable?(@x, @y, 8)
turn_up
@y -= 1
increase_steps
else
try_play_bump(@x, @y-1)
end
end
#--------------------------------------------------------------------------
# * Passable Determinants
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6, 8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# Impassable
return false
end
# If debug mode is ON and ctrl key was pressed
if $DEBUG and Input.press?(Input::CTRL)
# Passable
return true
end
super
end
#--------------------------------------------------------------------------
# * Set Map Display Position to Center of Screen
#--------------------------------------------------------------------------
def center(x, y)
if POKEMON_S::_MAPLINK != nil and POKEMON_S::_MAPLINK
$game_map.display_x = x * 128 - CENTER_X
$game_map.display_y = y * 128 - CENTER_Y
else
max_x = ($game_map.width - 20) * 128
max_y = ($game_map.height - 15) * 128
$game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
end
end
#--------------------------------------------------------------------------
# * Move to Designated Position
# x : x-coordinate
# y : y-coordinate
#--------------------------------------------------------------------------
def moveto(x, y)
super
# Centering
center(x, y)
# Make encounter count
make_encounter_count
end
#--------------------------------------------------------------------------
# * Increaase Steps
#--------------------------------------------------------------------------
def increase_steps
super
# If move route is not forcing
unless @move_route_forcing
# Increase steps
$game_party.increase_steps
# Number of steps are an even number
if $game_party.steps % 2 == 0
# Slip damage check
$game_party.check_map_slip_damage
end
end
end
#--------------------------------------------------------------------------
# * Get Encounter Count
#--------------------------------------------------------------------------
def encounter_count
return @encounter_count
end
#--------------------------------------------------------------------------
# * Make Encounter Count
#--------------------------------------------------------------------------
def make_encounter_count
# Image of two dice rolling
if $game_map.map_id != 0
n = $game_map.encounter_step
@encounter_count = rand(n) + rand(n) + 1
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# If party members = 0
if $game_party.actors.size == 0
# Clear character file name and hue
@character_name = ""
@character_hue = 0
# End method
return
end
# Get lead actor
actor = $game_party.actors[0]
# Set character file name and hue
@character_name = actor.character_name
@character_hue = actor.character_hue
# Initialize opacity level and blending method
@opacity = 255
@blend_type = 0
end
#--------------------------------------------------------------------------
# * Same Position Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == @x and event.y == @y and triggers.include?(event.trigger)
# If starting determinant is same position event (other than jumping)
if not event.jumping? and event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# Calculate front event coordinates
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
# If fitting event is not found
if result == false
# If front tile is a counter
if $game_map.counter?(new_x, new_y)
# Calculate 1 tile inside coordinates
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == new_x and event.y == new_y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
if event.x == x and event.y == y and [1,2].include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
# If not moving
unless moving?
# If player was moving last time
if last_moving
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end

# Update du compteur de silence
if @silence_count > 0
@silence_count -= 1
end
end
end

Posté par TouzaxA le 9 Sep - 06:41 (2013)
Tu aurais pu proposer la correction sur le topic concerné, mais c'est sympa à toi.

Posté par Dark_Ray le 10 Sep - 16:37 (2013)
De toutes manières dans l'officiel, le son se répète lorsqu'on reste appuyé, c'est juste qu'il lance le son quand l'autre se termine Clin d'œil foireux

Posté par Ku'rei le 12 Sep - 09:04 (2013)
Oui mais je ne pense pas que la répétition du son soit ici volontaire ^^
J'ai modifié le script en ajoutant les constantes pour le son joué et a durée du silence entre les "bump !"
j'ai aussi ajouter la méthode try_play_bump(x, y) qui remplace tout les :
Code:
if !check_event_trigger_touch(@x-1, @y)
  Audio.se_play(BUMP_SOUND)
end


Le lien vers le Bump ne marche pas (en tout cas pour moi) :
En voici un autre

Bref, voici le script
Script
Code:
 #============================================================================== 
# ** Game_Player 
#------------------------------------------------------------------------------ 
#  This class handles the <b style="color:#D0D1D1">player</b>. Its functions include event starting 
#  determinants and map scrolling. Refer to "$game_player" for the one 
#  instance of this class. 
#============================================================================== 
 
class Game_Player < Game_Character 
  # BUMPER USERS
  BUMP_SOUND      = "Audio/SE/bump.wav" # Chemin et nom du fichier son à jouer (SE Obligatoirement)
  SILENCE_LENGTH  = 40                  # Nombre frames de pause entre chaque"bump !"
  def try_play_bump(x, y)
    if !check_event_trigger_touch(x, y) and @silence_count == 0
        Audio.se_play(BUMP_SOUND)
        @silence_count = SILENCE_LENGTH
    end
  end
 
  #-------------------------------------------------------------------------- 
  # * Invariables 
  #-------------------------------------------------------------------------- 
  CENTER_X = (320 - 16) * 4   # Center screen x-coordinate * 4 
  CENTER_Y = (240 - 16) * 4   # Center screen y-coordinate * 4 
  def initialize(*arg) 
    super(*arg) 
    @lastdir=0 
    @lastdirframe=0
    @silence_count  = 0 # Compteur de silence. 0 => on peut jouer sinon non
  end 
  def pbHasDependentEvents? 
    return $PokemonGlobal.dependentEvents.length>0     
  end 
  def move_down(turn_enabled = true) 
    if turn_enabled 
     turn_down 
    end 
    if passable?(@x, @y, 2) 
      turn_down 
      @y += 1 
      increase_steps 
    else 
      try_play_bump(@x, @y+1)
    end 
  end 
  def move_left(turn_enabled = true) 
    if turn_enabled 
      turn_left 
    end 
    if passable?(@x, @y, 4) 
      turn_left 
      @x -= 1 
      increase_steps 
    else 
      try_play_bump(@x-1, @y)

    end 
  end 
  def move_right(turn_enabled = true) 
    if turn_enabled 
      turn_right 
    end 
    if passable?(@x, @y, 6) 
      turn_right 
      @x += 1 
      increase_steps 
    else 
      try_play_bump(@x+1, @y)
    end 
  end 
  def move_up(turn_enabled = true) 
    if turn_enabled 
      turn_up 
    end 
    if passable?(@x, @y,   8)   
      turn_up 
      @y -= 1 
      increase_steps 
    else 
      try_play_bump(@x, @y-1)
    end 
  end 
  #-------------------------------------------------------------------------- 
  # * Passable Determinants 
  #     x : x-coordinate 
  #     y : y-coordinate 
  #     d : <b style="color:#D0D1D1">direction</b> (0,2,4,6,  8)   
  #         * 0 = Determines if all directions are impassable (for jumping) 
  #-------------------------------------------------------------------------- 
  def passable?(x, y, d) 
    # Get new coordinates 
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) 
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) 
    # If coordinates are outside of map 
    unless $game_map.valid?(new_x, new_y) 
      # Impassable 
      return false 
    end 
    # If debug mode is ON and ctrl key was pressed 
    if $DEBUG and Input.press?(Input::CTRL) 
      # Passable 
      return true 
    end 
    super 
  end 
  #-------------------------------------------------------------------------- 
  # * Set Map Display Position to Center of Screen 
  #-------------------------------------------------------------------------- 
  def center(x, y) 
      if POKEMON_S::_MAPLINK != nil and POKEMON_S::_MAPLINK 
        $game_map.display_x = x * 128 - CENTER_X 
        $game_map.display_y = y * 128 - CENTER_Y 
      else 
        max_x = ($game_map.width - 20) * 128 
        max_y = ($game_map.height - 15) * 128 
        $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max 
        $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max         
      end 
  end   
  #-------------------------------------------------------------------------- 
  # * Move to Designated Position 
  #     x : x-coordinate 
  #     y : y-coordinate 
  #-------------------------------------------------------------------------- 
  def moveto(x, y) 
    super 
    # Centering 
    center(x, y) 
    # Make encounter count 
    make_encounter_count 
  end 
  #-------------------------------------------------------------------------- 
  # * Increaase Steps 
  #-------------------------------------------------------------------------- 
  def increase_steps 
    super 
    # If move route is not forcing 
    unless @move_route_forcing 
      # Increase steps 
      $game_party.increase_steps 
      # Number of steps are an even number 
      if $game_party.steps % 2 == 0 
        # Slip damage check 
        $game_party.check_map_slip_damage 
      end 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # * Get Encounter Count 
  #-------------------------------------------------------------------------- 
  def encounter_count 
    return @encounter_count 
  end 
  #-------------------------------------------------------------------------- 
  # * Make Encounter Count 
  #-------------------------------------------------------------------------- 
  def make_encounter_count 
    # Image of two dice rolling 
    if $game_map.map_id != 0 
      n = $game_map.encounter_step 
      @encounter_count = rand(n) + rand(n) + 1 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # * Refresh 
  #-------------------------------------------------------------------------- 
  def refresh 
    # If party members = 0 
    if $game_party.actors.size == 0 
      # Clear character file name and hue 
      @character_name = "" 
      @character_hue = 0 
      # End method 
      return 
    end 
    # Get lead actor 
    actor = $game_party.actors[0] 
    # Set character file name and hue 
    @character_name = actor.character_name 
    @character_hue = actor.character_hue 
    # Initialize opacity level and blending method 
    @opacity = 255 
    @blend_type = 0 
  end 
  #-------------------------------------------------------------------------- 
  # * Same Position Starting Determinant 
  #-------------------------------------------------------------------------- 
  def check_event_trigger_here(triggers) 
    result = false 
    # If event is running 
    if $game_system.map_interpreter.running? 
      return result 
    end 
    # All event loops 
    for event in $game_map.events.values 
      # If event coordinates and triggers are consistent 
      if event.x == @x and event.y == @y and triggers.include?(event.trigger) 
        # If starting determinant is same position event (other than jumping) 
        if not event.jumping? and event.over_trigger? 
          event.start 
          result = true 
        end 
      end 
    end 
    return result 
  end 
  #-------------------------------------------------------------------------- 
  # * Front Envent Starting Determinant 
  #-------------------------------------------------------------------------- 
  def check_event_trigger_there(triggers) 
    result = false 
    # If event is running 
    if $game_system.map_interpreter.running? 
      return result 
    end 
    # Calculate front event coordinates 
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) 
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) 
    # All event loops 
    for event in $game_map.events.values 
      # If event coordinates and triggers are consistent 
      if event.x == new_x and event.y == new_y and 
         triggers.include?(event.trigger) 
        # If starting determinant is front event (other than jumping) 
        if not event.jumping? and not event.over_trigger? 
          event.start 
          result = true 
        end 
      end 
    end 
    # If fitting event is not found 
    if result == false 
      # If front tile is a counter 
      if $game_map.counter?(new_x, new_y) 
        # Calculate 1 tile inside coordinates 
        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0) 
        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0) 
        # All event loops 
        for event in $game_map.events.values 
          # If event coordinates and triggers are consistent 
          if event.x == new_x and event.y == new_y and 
             triggers.include?(event.trigger) 
            # If starting determinant is front event (other than jumping) 
            if not event.jumping? and not event.over_trigger? 
              event.start 
              result = true 
            end 
          end 
        end 
      end 
    end 
    return result 
  end 
  #-------------------------------------------------------------------------- 
  # * Touch Event Starting Determinant 
  #-------------------------------------------------------------------------- 
  def check_event_trigger_touch(x, y) 
    result = false 
    # If event is running 
    if $game_system.map_interpreter.running? 
      return result 
    end 
    # All event loops 
    for event in $game_map.events.values 
      # If event coordinates and triggers are consistent 
      if event.x == x and event.y == y and [1,2].include?(event.trigger) 
        # If starting determinant is front event (other than jumping) 
        if not event.jumping? and not event.over_trigger? 
          event.start 
          result = true 
        end 
      end 
    end 
    return result 
  end 
  #-------------------------------------------------------------------------- 
  # * Frame Update 
  #-------------------------------------------------------------------------- 
  def update 
    # Remember whether or not moving in local variables 
    last_moving = moving? 
    # If moving, event running, move route forcing, and message window 
    # display are all not occurring 
    unless moving? or $game_system.map_interpreter.running? or 
           @move_route_forcing or $game_temp.message_window_showing 
      # Move <b style="color:#D0D1D1">player</b> in the <b style="color:#D0D1D1">direction</b> the directional button is being pressed 
      case Input.dir4 
      when 2 
        move_down 
      when 4 
        move_left 
      when 6 
        move_right 
      when 8 
        move_up 
      end 
    end 
    # Remember coordinates in local variables 
    last_real_x = @real_x 
    last_real_y = @real_y 
    super 
    # If character moves down and is positioned lower than the center 
    # of the screen 
    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y 
      # Scroll map down 
      $game_map.scroll_down(@real_y - last_real_y) 
    end 
    # If character moves left and is positioned more let on-screen than 
    # center 
    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X 
      # Scroll map left 
      $game_map.scroll_left(last_real_x - @real_x) 
    end 
    # If character moves right and is positioned more right on-screen than 
    # center 
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X 
      # Scroll map right 
      $game_map.scroll_right(@real_x - last_real_x) 
    end 
    # If character moves up and is positioned higher than the center 
    # of the screen 
    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y 
      # Scroll map up 
      $game_map.scroll_up(last_real_y - @real_y) 
    end 
    # If not moving 
    unless moving? 
      # If <b style="color:#D0D1D1">player</b> was moving last time 
      if last_moving 
        # Event determinant is via touch of same position event 
        result = check_event_trigger_here([1,2]) 
        # If event which started does not exist 
        if result == false 
          # Disregard if debug mode is ON and ctrl key was pressed 
          unless $DEBUG and Input.press?(Input::CTRL) 
            # Encounter countdown 
            if @encounter_count > 0 
              @encounter_count -= 1 
            end 
          end 
        end 
      end 
      # If C button was pressed 
      if Input.trigger?(Input::C) 
        # Same position and front event determinant 
        check_event_trigger_here([0]) 
        check_event_trigger_there([0,1,2]) 
      end 
    end
   
    # Update du compteur de silence
    if @silence_count > 0
      @silence_count -= 1
    end
  end 
end


EDIT:: Les corrections discutées dans les réponses suivantes ont été ajoutées

Posté par Izumi le 13 Sep - 12:47 (2013)
Hm... Quand je mets ce script, mon maplink déconne.

Ca fait l'effet "cases qui empiètent sur l'écran et ne disparaissent que quand on avance",

Spoiler

Posté par Ku'rei le 13 Sep - 19:01 (2013)
Et ça ne te le faisait pas avant ?
Parce que mon script ne fait rien du tout de plus... Si il décrémente dans l'update.
Tu as essayé de l'enlever ?

Posté par Izumi le 13 Sep - 23:19 (2013)
Bah quand je l'enlève ça remarche normalement.

Posté par Dark_Ray le 14 Sep - 09:36 (2013)
Code:
CENTER_X = (320 - 16) * 4   # Center screen x-coordinate * 4   
CENTER_Y = (240 - 16) * 4   # Center screen y-coordinate * 4


C'est peut-être à cause de ça !
Ces constantes sont déjà utilisé dans MAPLINK, du coup si on modifie leurs valeurs ça peut foiré les autres scripts les utilisants

Enfin je dis ça, mais j'ai pas essayé ^^


Tente de les renommer autrement partout dans le script, genre au lieu de CENTER_X met CENTRE_X et vice-versa pour Y



EDIT : Oublie tout ce que j'ai dit avant xD

En fait l'erreur est toute simple ! J'ai installé le script et j'ai recherché les conflits qu'il pouvait y avoir ... Et la solution m'as sauté à l’œil quand j'ai vu une "def" commune aux 2, mais pas écrit pareil.


Il suffit de remplacer dans son script ceci :

Code:
def center(x, y)   
    max_x = ($game_map.width - 20) * 128   
    max_y = ($game_map.height - 15) * 128   
    $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max   
    $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max   
end   


Par cela :

Code:
def center(x, y)
      if POKEMON_S::_MAPLINK != nil and POKEMON_S::_MAPLINK
        $game_map.display_x = x * 128 - CENTER_X
        $game_map.display_y = y * 128 - CENTER_Y
      else
        max_x = ($game_map.width - 20) * 128
        max_y = ($game_map.height - 15) * 128
        $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
        $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max       
      end
end


Chez moi ça fonctionne nickel Clin d'œil foireux

Posté par Izumi le 14 Sep - 13:02 (2013)
Pas chez moi >< (j'ai l'impression que rpgmaker aime BEAUCOUP m'énerver en fait xD)

Spoiler
---------- Erreur de script : Game_Player ----------
----- Type
NameError

----- Message
uninitialized constant Game_Player::CENTRE_X

----- Position dans Game_Player
Ligne 111

Posté par Dark_Ray le 14 Sep - 13:44 (2013)
C'est CENTER et pas CENTRE c'est pour ça xD

J'ai copié/collé de mon script sans faire la modif pour vous , mais je l'ai édité Petit saligaud mal élevé

Posté par Ku'rei le 14 Sep - 17:43 (2013)
Merci Doc Emett Imbécile heureux
Izumi, j'aurais besoin de savoir si c'est bon. Comme ça j'édite le script et tout va bien Imbécile heureux

Posté par Izumi le 15 Sep - 11:32 (2013)
Oui ça fonctionne maintenant ^^

Posté par Ku'rei le 15 Sep - 13:00 (2013)
Okay j'ai éditer le script.
Tout devrait maintenant fonctionner.
Tu devrais mettre le sujet à jour.

Posté par Izumi le 6 Oct - 21:21 (2013)
Hm... En fait j'ai l'impression que ça entraîne un autre bug :

Spoiler
---------- Erreur de script : Interpreter Bis ----------
----- Type
NoMethodError

----- Message
- ARGS - []
Section110:940:in `trainer_spotted'undefined method `front_tile_event' for #<Game_Player:0xaea87d8>

----- Position dans Interpreter Bis
Ligne 268