Sujet n°10567
Posté par Zohran le 28 Oct - 10:30 (2011)
Titre : RESOLU ! (voici correction à apporter à PSP DS, profitez en)
Bonjour, j'ai rencontré ces derniers temps un problème.
Lorsque que l'on ouvre la carte ou que l'on va sur les zones de rencontres du pokédex, le curseur a l'apparence du héros, pourquoi?
(PS : j'ai pourtant regardé le manuel)

Posté par Pαlвσlѕку le 28 Oct - 13:02 (2011)
C'est un bug.

J'ai codé dans PSP DS quelque part un code qui permet le changement d'apparence du héros dans les hautes herbes.
Le problème étant que lorsque je ne suis pas dans les hautes herbes, je demande au jeu de mettre l'apparence normale du héros.
Or, sur la carte, nous ne sommes pas dans les hautes herbes, et mon code force l'affichage de l'apparence normale du héros, alors que le curseur est programmé.
La solution serait de dire au jeu que lorsqu'on est sur la carte, de ne pas forcer l'apparence normale du héros, pour que le code du curseur puisse s'exprimer correctement.

Il faut que je regarde ça, si je trouve le temps.

Posté par Zohran le 28 Oct - 14:25 (2011)
Bien, d'accord Palbolsky, merci


C'est bon j'ai résolu le problème, j'ai jamais scripter mais en étant logique, on retrouve la méthode, ça marche parce que j'ai testé:
il faut remplacer le contenu du script Game_Player par ceci:



Posté par Zohran le 25 Déc - 14:33 (2011)
up s'il vous plait, j'ai remarqué que la modification que j'ai faite ne marche pas, une aide serai la bienvenue svp...


Et bien cette fois ci c'est bon, si un admin ou autre regarde ce poste, voici la correction à apporter au script GAME_PLAYER ! Pour PSP DS !
 
#==============================================================================
# ■ Game_Player
# Pokemon Script Project - Krosk 
# 18/07/07
#-----------------------------------------------------------------------------
# Scène à ne pas modifier de préférence
#-----------------------------------------------------------------------------


class Game_Player < Game_Character
  def update    
    # ローカル変数に移動中かどうかを記憶
    time_before_move = 4.7
    last_moving = moving?
    # 移動中、イベント実行中、移動ルート強制中、
    # メッセージウィンドウ表示中のいずれでもない場合
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      # 方向ボタンが押されていれば、その方向へプレイヤーを移動
      if Input.dir4 != 0
        if @turn_count == nil          
           @turn_count = 0
         end 
         @turn_count += 1.175 if @turn_count < time_before_move
      else  
        @turn_count = 0  
      end              
      case Input.dir4        
      when 2           
        @turn_count == time_before_move ? move_down  : turn_down        
      when 4        
        @turn_count == time_before_move ? move_left  : turn_left         
      when 6         
        @turn_count == time_before_move ? move_right : turn_right        
      when 8          
        @turn_count == time_before_move ? move_up    : turn_up       
      end      
    end
    # ローカル変数に座標を記憶
    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
          # デバッグモードが ON かつ CTRL キーが押されている場合を除き
          unless $DEBUG and Input.press?(Input::CTRL)
            rate = $random_encounter[0]
            if rand(2874) < rate * 16
              @encounter_count = 0
            else
              @encounter_count = 1
            end
          end
        end
      end
      # C ボタンが押された場合
      if Input.trigger?(Input::C)
        # 同位置および正面のイベント起動判定
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
        # Implémentation Surf
        if $game_map.passable?(front_tile[0],front_tile[1], 10 - $game_player.direction) and 
            terrain_tag != 7 and $game_map.terrain_tag(front_tile[0], front_tile[1]) == 7 and 
            not $game_system.map_interpreter.running?
          $game_temp.common_event_id = POKEMON_S::Skill_Info.map_use(POKEMON_S::Skill_Info.id("SURF"))
        end
      end
   
   if $game_map.map_id == POKEMON_S::_WMAPID
    $game_player.set_map_character("MAP.PNG", 0)
      elsif $game_variables[17] == 0
        if $game_variables[18] == 0 # Terre             
          if $game_variables[11] == 0 or $game_variables[11] == 1 # Garçon            
            $game_player.set_map_character("Héros Garçon.PNG", 0)  
          elsif $game_variables[11] == 2 # Fille
            $game_player.set_map_character("Héros Fille.PNG", 0)
          end
        elsif $game_variables[18] == 1 # Herbe
          if $game_variables[11] == 0 or $game_variables[11] == 1 # Garçon              
            $game_player.set_map_character("Héros Garçon herbe.PNG", 0)  
          elsif $game_variables[11] == 2 # Fille
            $game_player.set_map_character("Héros Fille herbe.PNG", 0)
          end
        end
      end
      
    end
  end


  def increase_steps
    super
    unless @move_route_forcing
      $pokemon_party.increase_steps
      # Poison damage
      if $pokemon_party.steps % 4 == 0
        # スリップダメージチェック
        $pokemon_party.check_map_slip_damage
      end
      # Loyalty
      if $pokemon_party.steps % 512 == 0
        for pokemon in $pokemon_party.actors
          pokemon.loyalty += 1
          if pokemon.loyalty > 255
            pokemon.loyalty = 255
          end
        end
      end
    end
  end
  
  # Renvoie les coordonnées de la case devant  le héros
  def front_tile
    xf = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    yf = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    return [xf, yf]
  end
  
  # Renvoie l'event
  def front_tile_event
    xf = front_tile[0]
    yf = front_tile[1]
    for event in $game_map.events.values
      if event.x == xf and event.y == yf
        return event
      end
    end
    return nil
  end
  
  # Détecte le nom de l'objet devant soit
  def front_name_detect(name)
    if front_tile_event != nil and front_tile_event.event.name == name
      return true
    end
    return false
  end
  
  # Renvoie l'ID de l'objet devant soit
  def front_tile_id
    if front_tile_event != nil
      return front_tile_event.event.id
    end
    return 0
  end
end