Imagin
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
-21%
Le deal à ne pas rater :
LEGO® Icons 10329 Les Plantes Miniatures, Collection Botanique
39.59 € 49.99 €
Voir le deal

Echangeur de place avec events

2 participants

Aller en bas

Echangeur de place avec events Empty Echangeur de place avec events

Message par Kolom Dim 8 Jan - 11:39

Description
Il arrives parfois que les PNJ s en déplacement aléatoire bloque des passages. Grâce a ce script, en appuyant 2 fois dans la direction du PNJ si on se trouve a coté de lui, il va échanger sa place avec le joueur. Ne s'applique pas aux évènements immobiles et aux évènements dont le nom commence par ! (soit un point d'exclamation)

Installation
Copier / coller le script au dessus de main

Code:
#=============================================================================
# Author : S4suk3, Molok
# Permet de Switcher de position avec certains PNJ's
#==============================================================================
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================
class Game_Event
  #--------------------------------------------------------------------------
  # * Alias
  #--------------------------------------------------------------------------
  alias vx_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    collide if @move_type != 0 and @priority_type  == 1 and !(@event.name =~ /^!/)
    vx_update
  end
  #--------------------------------------------------------------------------
  # * Collide with another event
  #--------------------------------------------------------------------------
  def collide
    if(Input.trigger?(Input::LEFT) && @x+1==$game_player.x && @y==$game_player.y  && $game_player.direction==4)
      temp_through = @through
      @through=true
      $game_player.move_straight(4)
      self.move_straight(6)
      @through=temp_through
    end
    if(Input.trigger?(Input::RIGHT) && @x-1==$game_player.x && @y==$game_player.y  && $game_player.direction==6)
      temp_through = @through
      @through=true
      $game_player.move_straight(6)
      self.move_straight(4)
      @through=temp_through
    end
    if(Input.trigger?(Input::UP) && @x==$game_player.x && @y+1==$game_player.y  && $game_player.direction==8)
      temp_through = @through
      @through=true
      $game_player.move_straight(8)
      self.move_straight(2)
      @through=temp_through
    end
    if(Input.trigger?(Input::DOWN) && @x==$game_player.x && @y-1==$game_player.y  && $game_player.direction==2)
      temp_through = @through
      @through=true
      $game_player.move_straight(2)
      self.move_straight(8)
      @through=temp_through
    end
  end
end

Kolom
Poulet trizo Lv.3
Poulet trizo Lv.3

Messages : 16

Fiche
Palmarès: 1
Spécialité: Script
Avertissements: Aucun

http://funkywork.blogspot.com/

Revenir en haut Aller en bas

Echangeur de place avec events Empty Re: Echangeur de place avec events

Message par elm6 Dim 8 Jan - 16:29

Comme déjà dit sur la commu' VX, un script très utile à qui voudra mapper sans trop se soucier des problèmes que posent les déplacements aléatoires des PNJ!

Merci du partage Molok! (et S4s')
elm6
elm6
Justicier Lv.Zero
Justicier Lv.Zero

Messages : 2547
Age : 33

Fiche
Palmarès: 2
Spécialité: Ecriture, making
Avertissements: Aucun

http://imagin.jeunforum.com/portal.htm

Revenir en haut Aller en bas

Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum