Le Deal du moment :
Pokémon EV06 : où acheter le Bundle Lot ...
Voir le deal

Aller en bas
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty [VXAce]Script d'étage

Lun 17 Fév 2014 - 0:35
Salut a tous je vient vous présenter mon script que je potasse depuis prés d'un mois et demie et qui finalement ce trouve être fonctionnel
Ce script qui permet de faire des étage simple et oui vous ne rêvez pas vous allez enfin pouvoir créer des étage dans rpg maker sans vous casser la tête

EDIT : Version 2.3 disponible

A placer sous material :
Code:

################################################################################
#                  ETAGE BY VINCENT_26                                        #
################################################################################
=begin
Crédit : Vincent_26
Version 2.3
Ce script permet de créer des étages facilement
Pour le mettre n’en place rien de plus simple :
-Ajouter l'id de la map sur laquelle vous voulez activer le script dans le tableau
prévu à cet effet.

-Créer les étages grâce aux régions id
0 : RDC (Rez de chaussé)
1 : escalier
2 : étage (impassable)
3 : étage (au-dessus du héros)
4 : escalier (etage par rapport au RDC)
5 : étage (impassable depuis l'étage 3 mais etage pour le RDC)
6 : étage pour le RDC et l'étage 3
...
C’est tout ^^
############################# BUG ET MAJ #######################################

  MAJ 2.3 :
    *Prise en compte de l'utilisation de l'areonef
    *Legere modif pour limiter le lag
  MAJ 2.2 :
    *Correction bug de creation dans certain cas de changement de map
  MAJ 2.1 :
    *Correction bug menu sauvegarde
  MAJ 2.0 :
    *Modification total du script avec nouveau system plus simple et plus efficace
    *Resolution de l'ecran correctement pris en compte
    *Ombre sur les etage pris en compte
    *Event animée sur un etage pris en compte
    *Eau et tile animée pris en compte
  VERSION 1.0 => obsolete

################################################################################

Contact : zeludtnecniv@gmail.com
         
          http://www.rpgmakervx-fr.com/t15645-vxacescript-d-etage
   
=end
module Etage
  #Si vous utiliser le systeme d'overlay de Yami mettre true :
  YAMI_OVERLAY = false
  #il faut de plus que ce script soit sous le script d'overlay
 
  #Pour recuperer l'etage du perso :
  #  $game_player.etage
 
  #Map d'activation du script
  MAP = [1,6]
 
  #Pour mettre un event a un etage particulier il doit avoir porter ce nom :
  #  ETAGE <id>
  #id est l'etage de l'event
 
end
#╔═════════════════════════════════════╗
#║    Modification du Spriteset_Map    ║
#╚═════════════════════════════════════╝
class Spriteset_Map
 
  if Etage::YAMI_OVERLAY
    alias create_overlay_map_etage create_overlay_map
    def create_overlay_map
      create_overlay_map_etage
      @light.viewport = @viewport4
      @shadow.viewport = @viewport4
      @par.viewport = @viewport4
    end
  end
 
  #Ajout de la variable etage
  alias initialize_etage initialize
  def initialize
    @etage = 0
    initialize_etage
  end
 
  #modification de l'update
  alias update_vincent update
  def update
    update_etage
    update_vincent
  end
 
  #Ajout de la suppression du tilemap
  alias dispose_tilemap_etage dispose_tilemap
  def dispose_tilemap
    dispose_tilemap_etage
    @tilemap2.dispose
  end
 
  #Ajout de la suppression du viewport
  alias dispose_viewports_etage dispose_viewports
  def dispose_viewports
    dispose_viewports_etage
    @viewport4.dispose
  end
 
  #Ajout d'une nouvelle viewport
  alias create_viewports_etage create_viewports
  def create_viewports
    create_viewports_etage
    @viewport4 = Viewport.new
    @viewport4.z = 20
  end
 
  #Mise a jour de l'etage
  def update_etage
    return if @etage == $game_player.etage && @map_id == $game_map.map_id
    @etage = $game_player.etage
    @tilemap2.map_data = $game_map.data.clone
    for i in 0..@tilemap2.map_data.xsize
      for j in 0..@tilemap2.map_data.ysize
        for k in 0..@tilemap2.map_data.zsize
          if $game_map.region_id(i,j) - @etage <= 2
            @tilemap2.map_data[i,j,k] = 0
          else
            unless Etage::MAP.include?($game_map.map_id)
              @tilemap2.map_data[i,j,k] = 0
            end
          end
        end
      end
    end
  end
 
  #Modification du chargement des tileset
  alias load_tileset_etage load_tileset
  def load_tileset
    load_tileset_etage
    @tilemap.flags = @tileset.flags
    @tileset.tileset_names.each_with_index do |name, i|
      @tilemap2.bitmaps[i] = Cache.tileset(name)
    end
    @tilemap2.flags = @tileset.flags
  end
 
  #Ajout de l'update tilemap a l'etage
  alias update_tilemap_etage update_tilemap
  def update_tilemap
    update_tilemap_etage
    if Etage::MAP.include?($game_map.map_id)
      if $game_player.in_airship?
        @tilemap2.visible = false
      else
        @tilemap2.visible = true
        @tilemap2.ox = $game_map.display_x * 32
        @tilemap2.oy = $game_map.display_y * 32
        @tilemap2.update
      end
    else
      @tilemap2.visible = false
    end
  end
 
  #Ajout de l'update de la nouvelle viewport
  alias update_viewports_etage update_viewports
  def update_viewports
    update_viewports_etage
    @viewport1.tone.set(Tone.new)
    @viewport4.tone.set($game_map.screen.tone)
    @viewport4.ox = $game_map.screen.shake
    @viewport4.update
  end
 
  #Changement de l'update des character pour mise a l'etage
  def update_characters
    refresh_characters if @map_id != $game_map.map_id
    for sprite in @character_sprites
      sprite.update
      if (sprite.etage-@etage) >= 2
        sprite.viewport = @viewport4
      else
        sprite.viewport = @viewport1
      end
    end
  end
 
  #Changement de la creation des tilemap (ajout d'un second tile map)
  def create_tilemap
    @tilemap = Tilemap.new(@viewport1)
    @tilemap2 = Tilemap.new(@viewport4)
    @tilemap.map_data = $game_map.data.clone
    @tilemap2.map_data = $game_map.data.clone
    result = []
    for i in 0..@tilemap2.map_data.xsize
      for j in 0..@tilemap2.map_data.ysize
        for k in 0..@tilemap2.map_data.zsize
          if ($game_map.region_id(i,j) - @etage) <= 1
            @tilemap2.map_data[i,j,k] = 0
          else
            unless Etage::MAP.include?($game_map.map_id)
              @tilemap2.map_data[i,j,k] = 0
            end
          end
        end
      end
    end
    load_tileset
  end
 
  #Changement de la creation des character pour mise a l'etage
  def create_characters
    @character_sprites = []
    $game_map.events.values.each do |event|
      if Etage::MAP.include?(@map_id)
        if event.event.name =~ /ETAGE <(\d+)>/
          etage = $1.to_i
          if etage > @etage+1
            @character_sprites.push(Sprite_Character.new(@viewport4, event))
          else
            @character_sprites.push(Sprite_Character.new(@viewport1, event))
          end
        else
          @character_sprites.push(Sprite_Character.new(@viewport1, event))
        end
      else
        @character_sprites.push(Sprite_Character.new(@viewport1, event))
      end
    end
    $game_map.vehicles.each do |vehicle|
      @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
    end
    $game_player.followers.reverse_each do |follower|
      @character_sprites.push(Sprite_Character.new(@viewport1, follower))
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    @map_id = $game_map.map_id
  end
 
end
#╔═══════════════════════════════════╗
#║  Modification du Scene_MenuBase  ║
#╚═══════════════════════════════════╝
class Scene_MenuBase
  #Reajustement de l'image de fond
  alias create_background_etage create_background
  def create_background
    create_background_etage
    @background_sprite.z = 20
  end
end
#╔═══════════════════════════════════╗
#║  Modification du Scene_File      ║
#╚═══════════════════════════════════╝
class Scene_File < Scene_MenuBase
  #Reajuste les viewport (mis au dessus du viewport etage)
  alias create_savefile_viewport_etage create_savefile_viewport
  def create_savefile_viewport
    create_savefile_viewport_etage
    @savefile_viewport.z = 21
  end
end
#╔═════════════════════════════════════╗
#║  Modification du Sprite_Character  ║
#╚═════════════════════════════════════╝
class Sprite_Character
 
  attr_reader :etage
 
  #Ajout de la variable etage
  alias initialize_etage initialize
  def initialize(viewport, character = nil)
    initialize_etage(viewport, character)
    @etage = 0
    begin
      if character.event.name =~ /ETAGE <(\d+)>/
        @etage = $1.to_i
      end
    rescue
      @etage = 0
    end
  end
end
#╔═══════════════════════════════╗
#║  Modification du Game_Event  ║
#╚═══════════════════════════════╝
class Game_Event
  #Ajout de la lecture de l'event associer
  attr_reader :event
end
#╔══════════════════════════════╗
#║ Modification du Game_Player  ║
#╚══════════════════════════════╝
class Game_Player
 
  #Ajout de la variable etage_actuel
  alias initialize_etage initialize
  def initialize
    initialize_etage
    @etage_actuel = 0
  end
 
  #Mise a jour de la variable etage_actuel
  alias update_etage update
  def update
    update_etage
    @etage_actuel = $game_map.region_id(x,y) if ($game_map.region_id(x,y)-@etage_actuel).abs <= 1
    @etage_actuel = 0 if !Etage::MAP.include?($game_map.map_id)
  end
 
  #Lecture de la variable en externe
  def etage
    return @etage_actuel
  end
 
  #Modification de la passabiliter pour l'etage
  alias passable_etage? passable?
  def passable?(x, y, d)
    return passable_etage?(x,y,d) if !Etage::MAP.include?($game_map.map_id)
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    return false if $game_map.region_id(x2,y2)-etage <= -2
    if $game_map.region_id(x2,y2)-etage > 2
      return false if collide_with_characters?(x2, y2)
      return true
    elsif $game_map.region_id(x2,y2)-etage == 2
      return false
    elsif $game_map.region_id(x2,y2) - $game_map.region_id(x,y) <= -2
      return false unless $game_map.valid?(x2, y2)
      return true if @through || debug_through?
      return false unless map_passable?(x2, y2, reverse_dir(d))
      return false if collide_with_characters?(x2, y2)
      return true
    else
      return passable_etage?(x,y,d)
    end
  end
 
  #Modification de la sortie vehicule pour assignation etage
  alias update_vehicle_get_off_etage update_vehicle_get_off
  def update_vehicle_get_off
    @etage_actuel = $game_map.region_id(x,y) if Etage::MAP.include?($game_map.map_id) && in_airship?
    update_vehicle_get_off_etage
  end
 
  #Modification de la detection de collision avec des event
  def collide_with_events?(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      if event.event.name =~ /ETAGE <(\d+)>/ && Etage::MAP.include?($game_map.map_id)
        etage = $1.to_i
        if (etage-@etage_actuel).abs >= 2
          false
        else
          event.normal_priority? || self.is_a?(Game_Event)
        end
      else
        event.normal_priority? || self.is_a?(Game_Event)
      end
    end
  end
 
  #Modification du demarrage des event
  def start_map_event(x, y, triggers, normal)
    return if $game_map.interpreter.running?
    $game_map.events_xy(x, y).each do |event|
      if event.trigger_in?(triggers) && event.normal_priority? == normal
        if event.event.name =~ /ETAGE <(\d+)>/ && Etage::MAP.include?($game_map.map_id)
          etage = $1.to_i
          event.start if (etage-@etage_actuel).abs < 2
        else
          event.start
        end
      end
    end
  end
end


Ce script permet de mettre en place un système d'étage grâce au région d'une carte sans utiliser d'event il est gérer automatiquement il vous suffit simplement de dessiner la zone d'étage grâce au région
0 => RDC
1 => escalier
2 => Pillier (etage sous lequel on ne peut pas passer)
3 => etage
4 => escalier
5 => pillier
6 => etage
...
vous pouvez aussi définir sur quelle map vous voulez que le script agisse

quelque image :
Spoiler:

Démo version 2.0 : (Bug sur les sauvegarde présent !!! )

https://onedrive.live.com/redir?resid=923E0755996810EA!4497&authkey=!ANwE4bTS0NatDUs&ithint=file%2cexe



Dernière édition par vincent26 le Mer 18 Mar 2015 - 19:02, édité 17 fois
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Lun 17 Fév 2014 - 0:39
Ca c'est vraiment extra, très très utile !

Merci et bravo d'avoir fais un script permettant de rendre facile quelque chose que pas mal de débutant n'arrivent pas à faire.
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Lun 17 Fév 2014 - 0:43
De rien ^^'
Je tient a te remercier toi et berka qui m'avait grandement aider (même si vous ne vous en êtes pas forcément douté ^^)
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Lun 17 Fév 2014 - 0:49
On est la pour ça !

Je vais mettre ce script dans mon projet je pense, c'est quand même utile dans certaines circonstances et limite l'utilisation des événements sur la carte Smile
Victor J.
Victor J.
Membre

Nombre de messages : 64
Age : 20
Distinction : aucune
Date d'inscription : 15/02/2014

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Lun 17 Fév 2014 - 11:37
Énorme, merci.
Quelque chose qui parait élémentaire et qui devrait être d'origine dans RPG Maker, mais que je n'ai jamais vu nulle part.
Merci, ce script est juste génial et super pratique. Bravo à toi !
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 19 Fév 2014 - 22:26
Script REmis a jour:

-Prise en compte des perso qui vous suive sur la map
-correction de petit bug
-possibilité de définir le RDC
-Multi étage mis en place
-possibilité de mettre des évent au dessus des étages
NOUVELLE DEMO DISPO (lien mis a jour dans la présentation)

Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 19 Fév 2014 - 23:00
Houla ! Ben la je suis presque obligé de le mettre dans mon projet.

Grand merci pour le partage encore une fois et le suivis de ton script également.
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 15:16
Je pense faire une version plus "professionnelle" pour ceux qui serais près à prendre le temps de configurer un script plus compliqué avec bcp plus de fonctionnalité :
-Choisir quelle couche de map doit comporter l'image (afficher seulement les objet et non le sol ou autre)
-Choisir au cas par cas ce que font les région
...
après si vous avez des idée
la version actuel a encore quelque bug (que je vais essayer de corriger) mais restera de cette forme c'est la forme simple
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 16:02
après si vous avez des idée

Je ne sais pas comment le script se comporte avec l'overlay mapping mais se serait bien si ce n'est pas le cas que celui-ci le prenne en compte.

Ensuite je suis pour une version encore plus complète qu'elle ne l'est déjà Smile

vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 18:41
oki tu as le script d'overlay ? que je test ^^
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 18:58
Oui le voila :

Code:
#==============================================================================
#
# ¥ Yami Engine Ace - Overlay Mapping
# -- Last Updated: 2012.04.16
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSE-OverlayMapping"] = true

#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.04.16 - Reworked with Encrypted Game.
# 2012.04.13 - Ported into Yami Engine.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script based on Hanzo Kimura's idea. This will automatically load map's
# overlay by map ID, and a map can have more than one image per layer, so you
# don't have to create two or more map just for day/night or when an event occur.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Create a folder in Graphics and name it Overlay.
# Put all of your overlay into Graphics/Overlay.
# Your overlay file will have the name: "Filename Prefix" + Map-ID + "-" + Number
# which "Filename Prefix" is the one you will config below
# Map-ID is your map's ID
# Number is 1, 2, 3, ... using for Overlay Variables.
#
# Example: Graphics/Overlay/ground2-1.png
# Which means this will be ground layer, for map 2, variable = 1
#
# Light/Shadow must be .jpg
# Parallax/Ground must be .png
#
#==============================================================================

module YSA
  module OVERLAY
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Switches -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These are switches which are enable overlay layers. Turn them on to show
    # them in your maps.
    #--------------------------------------------------------------------------
    # Default: ON
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT_SWITCH = 501        # Turn on/off light layer
    SHADOW_SWITCH = 502      # Turn on/off shadow layer
    PARALLAX_SWITCH = 503    # Turn on/off parallax layer
    GROUND_SWITCH = 504      # Turn on/off ground layer

    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Variables -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # A map can have more than one image per layer, that means you can have a
    # different light/shadow for day and night, or have a different ground when
    # an event occured.
    #--------------------------------------------------------------------------
    # Default: 1
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT_VARIABLE = 502      # Switch to another light
    SHADOW_VARIABLE = 502    # Switch to another shadow
    PARALLAX_VARIABLE = 501  # Switch to another parallax
    GROUND_VARIABLE = 501  # Switch to another ground
 
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Filename Prefix -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This will make this script automatic, it will check if there are layers in
    # overlay folder
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    LIGHT = "light"        # Light layer's filename prefix
    SHADOW = "shadow"      # Shadow layer's filename prefix
    PARALLAX = "par"        # Parallax layer's filename prefix
    GROUND = "ground"      # Ground layer's filename prefix
 
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Overlay Opacity -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This will make this script automatic, it will check if there are layers in
    # overlay folder
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    GROUND_OPACITY = 255
    PARALLAX_OPACITY = 255
    LIGHT_OPACITY = 128
    SHADOW_OPACITY = 96
   
  end #OVERLAY
end # YSA

#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# ¡ Cache
#==============================================================================

module Cache
 
  #--------------------------------------------------------------------------
  # new method: overlay
  #--------------------------------------------------------------------------
  def self.overlay(filename)
    begin
      self.load_bitmap("Graphics/Overlay/", filename)
    rescue
      self.empty_bitmap
    end
  end
 
end # Cache

#==============================================================================
# ¡ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: setup_new_game
  #--------------------------------------------------------------------------
  class <<self; alias ovm_setup_new_game setup_new_game; end
  def self.setup_new_game
    ovm_setup_new_game
    setup_overlay_mapping
  end
 
  #--------------------------------------------------------------------------
  # new method: setup_overlay_mapping
  #--------------------------------------------------------------------------
  def self.setup_overlay_mapping
    # Control switches
    $game_switches[YSA::OVERLAY::LIGHT_SWITCH] = true
    $game_switches[YSA::OVERLAY::SHADOW_SWITCH] = true
    $game_switches[YSA::OVERLAY::GROUND_SWITCH] = true
    $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] = true
   
    # Control variables
    $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::GROUND_VARIABLE] = 1
    $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] = 1
  end
 
end # DataManager

#==============================================================================
# ¡ Spriteset_Map
#==============================================================================

class Spriteset_Map
 
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias overlay_initialize initialize
  def initialize
    overlay_initialize
    create_overlay_map
    update
  end
 
  #--------------------------------------------------------------------------
  # new method: create_overlay_map
  #--------------------------------------------------------------------------
  def create_overlay_map
    @current_light = 0
    @current_shadow = 0
    @current_par = 0
    @current_ground = 0
    # Ground Layer
    @ground = Sprite.new(@viewport1)
    @ground.z = 1
    @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
    # Light Layer
    @light = Sprite.new(@viewport1)
    @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
    @light.blend_type = 1
    @light.z = 299
    # Shadow Layer
    @shadow = Sprite.new(@viewport1)
    @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
    @shadow.blend_type = 2
    @shadow.z = 298
    # Parallax Layer
    @par = Sprite.new(@viewport1)
    @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
    @par.z = 297
  end
 
  #--------------------------------------------------------------------------
  # alias method: dispose_parallax
  #--------------------------------------------------------------------------
  alias overlay_dispose_parallax dispose_parallax
  def dispose_parallax
    overlay_dispose_parallax
    dispose_overlay_map
  end
 
  #--------------------------------------------------------------------------
  # new method: dispose_overlay_map
  #--------------------------------------------------------------------------
  def dispose_overlay_map
    @ground.dispose
    @light.dispose
    @shadow.dispose
    @par.dispose
  end
 
  #--------------------------------------------------------------------------
  # alias method: update_parallax
  #--------------------------------------------------------------------------
  alias overlay_update_parallax update_parallax
  def update_parallax
    overlay_update_parallax
    update_overlay
  end
 
  #--------------------------------------------------------------------------
  # new method: update_overlay
  #--------------------------------------------------------------------------
  def update_overlay
    update_om_ground
    update_om_par
    update_om_light
    update_om_shadow
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_ground
  #--------------------------------------------------------------------------
  def update_om_ground
    return unless @ground
    @ground.visible = $game_switches[YSA::OVERLAY::GROUND_SWITCH] if @ground.visible != $game_switches[YSA::OVERLAY::GROUND_SWITCH]
    @ground.ox = $game_map.display_x * 32 if @ground.ox != $game_map.display_x * 32
    @ground.oy = $game_map.display_y * 32 if @ground.oy != $game_map.display_y * 32
    if @current_ground != $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
      filename = YSA::OVERLAY::GROUND
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s
      @ground.bitmap = Cache.overlay(filename)
      @current_ground = $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_par
  #--------------------------------------------------------------------------
  def update_om_par
    return unless @par
    @par.visible = $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] if @par.visible != $game_switches[YSA::OVERLAY::PARALLAX_SWITCH]
    @par.ox = $game_map.display_x * 32 if @par.ox != $game_map.display_x * 32
    @par.oy = $game_map.display_y * 32 if @par.oy != $game_map.display_y * 32
    if @current_par != $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
      filename = YSA::OVERLAY::PARALLAX
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s
      @par.bitmap = Cache.overlay(filename)
      @current_par = $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_light
  #--------------------------------------------------------------------------
  def update_om_light
    return unless @light
    @light.visible = $game_switches[YSA::OVERLAY::LIGHT_SWITCH] if @light.visible != $game_switches[YSA::OVERLAY::LIGHT_SWITCH]
    @light.ox = $game_map.display_x * 32 if @light.ox != $game_map.display_x * 32
    @light.oy = $game_map.display_y * 32 if @light.oy != $game_map.display_y * 32
    if @current_light != $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
      filename = YSA::OVERLAY::LIGHT
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s
      @light.bitmap = Cache.overlay(filename)
      @current_light = $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
    end
  end
 
  #--------------------------------------------------------------------------
  # new method: update_om_shadow
  #--------------------------------------------------------------------------
  def update_om_shadow
    return unless @shadow
    @shadow.visible = $game_switches[YSA::OVERLAY::SHADOW_SWITCH] if @shadow.visible != $game_switches[YSA::OVERLAY::SHADOW_SWITCH]
    @shadow.ox = $game_map.display_x * 32 if @shadow.ox != $game_map.display_x * 32
    @shadow.oy = $game_map.display_y * 32 if @shadow.oy != $game_map.display_y * 32
    if @current_shadow != $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
      filename = YSA::OVERLAY::SHADOW
      filename += $game_map.map_id.to_s
      filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s
      @shadow.bitmap = Cache.overlay(filename)
      @current_shadow = $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
    end
  end
 
end # Spriteset_Map

#==============================================================================
# ¡ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
 
  #--------------------------------------------------------------------------
  # alias method: post_transfer
  #--------------------------------------------------------------------------
  alias overlay_post_transfer post_transfer
  def post_transfer
    @spriteset.dispose_overlay_map
    @spriteset.create_overlay_map
    @spriteset.update
    overlay_post_transfer
  end

end # Scene_Map

#==============================================================================
#
# ¥ End of File
#
#==============================================================


Merci Smile
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 20:51
J'ai fait en sorte que tout soit au dessus de mon image mais pas le sol ça te va ?
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 20:57
Ok je pense que c'est bien ainsi, je testerai et te dirai quoi Smile
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 21:29
c'est bien Yami le créateur du script d'overlay ?
Code:

################################################################################
#                   ETAGE BY VINCENT_26                                        #
################################################################################
=begin
Crédit : Vincent_26 (vous n’êtes pas obliger ^^)
Ce script permet de créer des étages facilement
Pour le mettre n’en place rien de plus simple :
-Ajouter l'id de la map sur laquelle vous voulez activer le script dans le tableau
prévu à cet effet.

-Créer les étages grâce aux régions id (ici ex avec RDC = 0 )
0 : RDC (Rez de chaussé)
1 : escalier
2 : étage (impassable)
3 : étage (au-dessus du héros)
4 : escalier (etage par rapport au RDC)
5 : étage (impassable depuis l'étage 3 mais etage pour le RDC)
6 : étage pour le RDC et l'étage 3
...
C’est tout ^^
############################# BUG ET MAJ #######################################
-Event non pris en compte comme étant à l'étage ou non

-Ombre non pris en compte

-Bug avec l'autotile 1 si mis en étage

Ces différents bugs vont-être mis à jour dès que possible
=end
#Si vous utiliser le systeme d'overlay de Yami mettre true :
YAMI_OVERLAY = true
#il faut de plus que ce script soit sous le script d'overlay
#ID Variable d'enregistrement de l'étage actuel (variable in game)
VAR = 1
#Map d'activation du script
MAP = [1,2]
#Définir région RDC (Toute les région de 0 a la valeur définit ferons office de RDC)
RDC = 0
#Nom des event :
#ETAGE <id>

###### NE RIEN TOUCHER SOUS CETTE LIGNE SANS SAVOIR CE QUE VOUS FAITES #########
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Modification du test de collision du perso                               ║
#║    Update de l'étage depuis l'update du héros                               ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_CharacterBase
  
  alias map_passable2? map_passable?
  def map_passable?(x, y, d)
    if (MAP.include?($game_map.map_id) == true)
      @boucle4 = 0 if @boucle4 == nil
      @boucle4 = 0 if @boucle4 == 4
      if (@boucle4 == 0)
        $game_etage.save_coordonnée_arrivée(d)
        $game_etage.take_info_map($myx,$myy)
        $game_etage.determine_position_perso
      end
      $game_etage.create_sprite
      @boucle4 += 1
      return true if Input.press?(:CTRL)
      return determine_passability(x,y,d)
    else
      return true if Input.press?(:CTRL)
      return map_passable2?(x, y, d)
    end
  end
  
  def determine_passability(x,y,d)
    return true if Input.press?(:CTRL)
    if $dessous_heros
      return true
    elsif $test == true
      a = map_passable2?(x, y, d)
      if (($game_variables[VAR] < $a[49]-2)&&(d == 8))||(($game_variables[VAR] < $a[39]-2)&&(d == 6))||(($game_variables[VAR] < $a[41]-2)&&(d == 4))||(($game_variables[VAR] < $a[31]-2)&&(d == 2))
        return true
      else
        return a
     end
    elsif $test == false
      return false
    end
  end
  
  alias collide_with_events_etage? collide_with_events?
 def collide_with_events?(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            return event.normal_priority? || self.is_a?(Game_Event)
          else
            return false
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            return event.normal_priority? || self.is_a?(Game_Event)
          else
            return false
          end
        end
      else
        return event.normal_priority? || self.is_a?(Game_Event)
      end
    end
  end
  
  alias update2 update
  def update
    update_animation
    $spriteset_map_bloc.update if ($spriteset_map_bloc != nil) && (moving? == false)
    return update_jump if jumping?
    return update_move if moving?
    return update_stop
  end
  
  alias update_move2 update_move
  def update_move
    @real_x = [@real_x - distance_per_frame, @x].max if @x < @real_x
    @real_x = [@real_x + distance_per_frame, @x].min if @x > @real_x
    @real_y = [@real_y - distance_per_frame, @y].max if @y < @real_y
    @real_y = [@real_y + distance_per_frame, @y].min if @y > @real_y
    $spriteset_map_bloc.update if $spriteset_map_bloc != nil
    update_bush_depth unless moving?
  end
  
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Réinitialize l'image au changement de map                                ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Player < Game_Character
  alias perform_transfer_etage perform_transfer
  def perform_transfer
    perform_transfer_etage
    $game_etage.initialize_map
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Ajoute une fonction de récuperation des event de la map                  ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Map
  def map_event
    @map.events
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Modification des contact avec les event si au-dessus du héros            ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Player < Game_Character
  alias check_event_trigger_touch_etage check_event_trigger_touch
  def start_map_event(x, y, triggers, normal)
    return if $game_map.interpreter.running?
    $game_map.events_xy(x, y).each do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            if event.trigger_in?(triggers) && event.normal_priority? == normal
              event.start
            end
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            if event.trigger_in?(triggers) && event.normal_priority? == normal
              event.start
            end
          end
        end
      else
        if event.trigger_in?(triggers) && event.normal_priority? == normal
          event.start
        end
      end
    end
  end
  def check_event_trigger_touch(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            check_event_trigger_touch_etage(x,y)
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            check_event_trigger_touch_etage(x,y)
          end
        end
      else
        check_event_trigger_touch_etage(x,y)
      end
    end
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Class principale (calcul et détermine les variables nécessaires au sprite) ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Etage
  
  def initialize_map
    if (MAP.include?($game_map.map_id) == true)
      $myy = 0
      $myx = 0
      take_info_map($myx,$myy)
      determine_position_perso
      $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
      $spriteset_map_bloc.create_viewports
      $spriteset_map_bloc.create_bloc
      $spriteset_map_bloc.show_sprite
      $spriteset_map_bloc.update
      $game_variables[VAR] = RDC if $game_variables[VAR] < RDC
   end
  end
  
  def save_coordonnée_arrivée(d)
    $myx = (2-(d % 6))/2
    $myy = (d % 4) - 1 - ((2-(d % 6))/2)
  end
  
  def take_coordonnée_etage_map
    return [($game_player.x+$myx-1)*32,($game_player.y+$myy-1.5)*32]
  end
  
  def take_info_map(x,y)
    region_info(x,y)
    $c = []
    for i in 0..80
      $c.push(1) if ($a[i] > $game_variables[VAR]+1)
      $c.push(0) if ($a[i] <= $game_variables[VAR]+1)
    end
  end
  
  def determine_position_perso
    $test = false
    if (($a[40]-$game_variables[VAR] > 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] > 2)&&($a[40] < RDC))
      $dessous_heros = true
    elsif (($a[40]-$game_variables[VAR] == 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] == 2)&&($a[40] < RDC))
      $dessous_heros = false
    elsif (($a[40]-$game_variables[VAR] > (-2))&&($a[40]-$game_variables[VAR] < 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] > (-2))&&(RDC-$game_variables[VAR] < 2)&&($a[40] < RDC))
      $dessous_heros = false
      $test = true
    elsif (($a[40]-$game_variables[VAR] <= (-2))&&($a[40] >= RDC))||((RDC-$game_variables[VAR] <= (-2))&&($a[40] < RDC))
      $dessous_heros = false
    end
  end
  
  def create_sprite
    if (MAP.include?($game_map.map_id) == true)
      if $c.include?(1) == true
        $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
        $spriteset_map_bloc.show_sprite
      else
        $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
        $spriteset_map_bloc.hide_sprite
      end
    end
  end
  
  def determine_passability(x,y,d)
    return true if Input.press?(:CTRL)
    if true
      return map_passable2?(x, y, d)
    elsif @pictures_ok
      return true
    else
      return false
    end
  end
  
  #r-hori-vert
  #      00 01 02 03 04 05 06 07 08
  #      09 10 11 12 13 14 15 16 17
  #      18 19 20 21 22 23 24 25 26
  #      27 28 29 30 31 32 33 34 35
  #      36 37 38 39 40 41 42 43 44
  #      45 46 47 48 49 50 51 52 53
  #      54 55 56 57 58 59 60 61 62
  #      63 64 65 66 67 68 69 70 71
  #      72 73 74 75 76 77 78 79 80
  def region_info(x,y)
    $b = [[$game_player.x-4+x,$game_player.y-4+y], #0
          [$game_player.x-3+x,$game_player.y-4+y], #1
          [$game_player.x-2+x,$game_player.y-4+y], #2
          [$game_player.x-1+x,$game_player.y-4+y], #3
          [$game_player.x+x,$game_player.y-4+y],   #4
          [$game_player.x+1+x,$game_player.y-4+y], #5
          [$game_player.x+2+x,$game_player.y-4+y], #6
          [$game_player.x+3+x,$game_player.y-4+y], #7
          [$game_player.x+4+x,$game_player.y-4+y], #8
          [$game_player.x-4+x,$game_player.y-3+y], #9
          [$game_player.x-3+x,$game_player.y-3+y], #10
          [$game_player.x-2+x,$game_player.y-3+y], #11
          [$game_player.x-1+x,$game_player.y-3+y], #12
          [$game_player.x+x,$game_player.y-3+y],   #13
          [$game_player.x+1+x,$game_player.y-3+y], #14
          [$game_player.x+2+x,$game_player.y-3+y], #15
          [$game_player.x+3+x,$game_player.y-3+y], #16
          [$game_player.x+4+x,$game_player.y-3+y], #17
          [$game_player.x-4+x,$game_player.y-2+y], #18
          [$game_player.x-3+x,$game_player.y-2+y], #19
          [$game_player.x-2+x,$game_player.y-2+y], #20
          [$game_player.x-1+x,$game_player.y-2+y], #21
          [$game_player.x+x,$game_player.y-2+y],   #22
          [$game_player.x+1+x,$game_player.y-2+y], #23
          [$game_player.x+2+x,$game_player.y-2+y], #24
          [$game_player.x+3+x,$game_player.y-2+y], #25
          [$game_player.x+4+x,$game_player.y-2+y], #26
          [$game_player.x-4+x,$game_player.y-1+y], #27
          [$game_player.x-3+x,$game_player.y-1+y], #28
          [$game_player.x-2+x,$game_player.y-1+y], #29
          [$game_player.x-1+x,$game_player.y-1+y], #30
          [$game_player.x+x,$game_player.y-1+y],   #31
          [$game_player.x+1+x,$game_player.y-1+y], #32
          [$game_player.x+2+x,$game_player.y-1+y], #33
          [$game_player.x+3+x,$game_player.y-1+y], #34
          [$game_player.x+4+x,$game_player.y-1+y], #35
          [$game_player.x-4+x,$game_player.y+y],   #36
          [$game_player.x-3+x,$game_player.y+y],   #37
          [$game_player.x-2+x,$game_player.y+y],   #38
          [$game_player.x-1+x,$game_player.y+y],   #39
          [$game_player.x+x,$game_player.y+y],     #40
          [$game_player.x+1+x,$game_player.y+y],   #41
          [$game_player.x+2+x,$game_player.y+y],   #42
          [$game_player.x+3+x,$game_player.y+y],   #43
          [$game_player.x+4+x,$game_player.y+y],   #44
          [$game_player.x-4+x,$game_player.y+1+y], #45
          [$game_player.x-3+x,$game_player.y+1+y], #46
          [$game_player.x-2+x,$game_player.y+1+y], #47
          [$game_player.x-1+x,$game_player.y+1+y], #48
          [$game_player.x+x,$game_player.y+1+y],   #49
          [$game_player.x+1+x,$game_player.y+1+y], #50
          [$game_player.x+2+x,$game_player.y+1+y], #51
          [$game_player.x+3+x,$game_player.y+1+y], #52
          [$game_player.x+4+x,$game_player.y+1+y], #53
          [$game_player.x-4+x,$game_player.y+2+y], #54
          [$game_player.x-3+x,$game_player.y+2+y], #55
          [$game_player.x-2+x,$game_player.y+2+y], #56
          [$game_player.x-1+x,$game_player.y+2+y], #57
          [$game_player.x+x,$game_player.y+2+y],   #58
          [$game_player.x+1+x,$game_player.y+2+y], #59
          [$game_player.x+2+x,$game_player.y+2+y], #60
          [$game_player.x+3+x,$game_player.y+2+y], #61
          [$game_player.x+4+x,$game_player.y+2+y], #62
          [$game_player.x-4+x,$game_player.y+3+y], #63
          [$game_player.x-3+x,$game_player.y+3+y], #64
          [$game_player.x-2+x,$game_player.y+3+y], #65
          [$game_player.x-1+x,$game_player.y+3+y], #66
          [$game_player.x+x,$game_player.y+3+y],   #67
          [$game_player.x+1+x,$game_player.y+3+y], #68
          [$game_player.x+2+x,$game_player.y+3+y], #69
          [$game_player.x+3+x,$game_player.y+3+y], #70
          [$game_player.x+4+x,$game_player.y+3+y], #71
          [$game_player.x-4+x,$game_player.y+4+y], #72
          [$game_player.x-3+x,$game_player.y+4+y], #73
          [$game_player.x-2+x,$game_player.y+4+y], #74
          [$game_player.x-1+x,$game_player.y+4+y], #75
          [$game_player.x+x,$game_player.y+4+y],   #76
          [$game_player.x+1+x,$game_player.y+4+y], #77
          [$game_player.x+2+x,$game_player.y+4+y], #78
          [$game_player.x+3+x,$game_player.y+4+y], #79
          [$game_player.x+4+x,$game_player.y+4+y]] #80
    $a = [$game_map.region_id($game_player.x-4+x,$game_player.y-4+y), #0
          $game_map.region_id($game_player.x-3+x,$game_player.y-4+y), #1
          $game_map.region_id($game_player.x-2+x,$game_player.y-4+y), #2
          $game_map.region_id($game_player.x-1+x,$game_player.y-4+y), #3
          $game_map.region_id($game_player.x+x,$game_player.y-4+y),   #4
          $game_map.region_id($game_player.x+1+x,$game_player.y-4+y), #5
          $game_map.region_id($game_player.x+2+x,$game_player.y-4+y), #6
          $game_map.region_id($game_player.x+3+x,$game_player.y-4+y), #7
          $game_map.region_id($game_player.x+4+x,$game_player.y-4+y), #8
          $game_map.region_id($game_player.x-4+x,$game_player.y-3+y), #9
          $game_map.region_id($game_player.x-3+x,$game_player.y-3+y), #10
          $game_map.region_id($game_player.x-2+x,$game_player.y-3+y), #11
          $game_map.region_id($game_player.x-1+x,$game_player.y-3+y), #12
          $game_map.region_id($game_player.x+x,$game_player.y-3+y),   #13
          $game_map.region_id($game_player.x+1+x,$game_player.y-3+y), #14
          $game_map.region_id($game_player.x+2+x,$game_player.y-3+y), #15
          $game_map.region_id($game_player.x+3+x,$game_player.y-3+y), #16
          $game_map.region_id($game_player.x+4+x,$game_player.y-3+y), #17
          $game_map.region_id($game_player.x-4+x,$game_player.y-2+y), #18
          $game_map.region_id($game_player.x-3+x,$game_player.y-2+y), #19
          $game_map.region_id($game_player.x-2+x,$game_player.y-2+y), #20
          $game_map.region_id($game_player.x-1+x,$game_player.y-2+y), #21
          $game_map.region_id($game_player.x+x,$game_player.y-2+y),   #22
          $game_map.region_id($game_player.x+1+x,$game_player.y-2+y), #23
          $game_map.region_id($game_player.x+2+x,$game_player.y-2+y), #24
          $game_map.region_id($game_player.x+3+x,$game_player.y-2+y), #25
          $game_map.region_id($game_player.x+4+x,$game_player.y-2+y), #26
          $game_map.region_id($game_player.x-4+x,$game_player.y-1+y), #27
          $game_map.region_id($game_player.x-3+x,$game_player.y-1+y), #28
          $game_map.region_id($game_player.x-2+x,$game_player.y-1+y), #29
          $game_map.region_id($game_player.x-1+x,$game_player.y-1+y), #30
          $game_map.region_id($game_player.x+x,$game_player.y-1+y),   #31
          $game_map.region_id($game_player.x+1+x,$game_player.y-1+y), #32
          $game_map.region_id($game_player.x+2+x,$game_player.y-1+y), #33
          $game_map.region_id($game_player.x+3+x,$game_player.y-1+y), #34
          $game_map.region_id($game_player.x+4+x,$game_player.y-1+y), #35
          $game_map.region_id($game_player.x-4+x,$game_player.y+y),   #36
          $game_map.region_id($game_player.x-3+x,$game_player.y+y),   #37
          $game_map.region_id($game_player.x-2+x,$game_player.y+y),   #38
          $game_map.region_id($game_player.x-1+x,$game_player.y+y),   #39
          $game_map.region_id($game_player.x+x,$game_player.y+y),     #40
          $game_map.region_id($game_player.x+1+x,$game_player.y+y),   #41
          $game_map.region_id($game_player.x+2+x,$game_player.y+y),   #42
          $game_map.region_id($game_player.x+3+x,$game_player.y+y),   #43
          $game_map.region_id($game_player.x+4+x,$game_player.y+y),   #44
          $game_map.region_id($game_player.x-4+x,$game_player.y+1+y), #45
          $game_map.region_id($game_player.x-3+x,$game_player.y+1+y), #46
          $game_map.region_id($game_player.x-2+x,$game_player.y+1+y), #47
          $game_map.region_id($game_player.x-1+x,$game_player.y+1+y), #48
          $game_map.region_id($game_player.x+x,$game_player.y+1+y),   #49
          $game_map.region_id($game_player.x+1+x,$game_player.y+1+y), #50
          $game_map.region_id($game_player.x+2+x,$game_player.y+1+y), #51
          $game_map.region_id($game_player.x+3+x,$game_player.y+1+y), #52
          $game_map.region_id($game_player.x+4+x,$game_player.y+1+y), #53
          $game_map.region_id($game_player.x-4+x,$game_player.y+2+y), #54
          $game_map.region_id($game_player.x-3+x,$game_player.y+2+y), #55
          $game_map.region_id($game_player.x-2+x,$game_player.y+2+y), #56
          $game_map.region_id($game_player.x-1+x,$game_player.y+2+y), #57
          $game_map.region_id($game_player.x+x,$game_player.y+2+y),   #58
          $game_map.region_id($game_player.x+1+x,$game_player.y+2+y), #59
          $game_map.region_id($game_player.x+2+x,$game_player.y+2+y), #60
          $game_map.region_id($game_player.x+3+x,$game_player.y+2+y), #61
          $game_map.region_id($game_player.x+4+x,$game_player.y+2+y), #62
          $game_map.region_id($game_player.x-4+x,$game_player.y+3+y), #63
          $game_map.region_id($game_player.x-3+x,$game_player.y+3+y), #64
          $game_map.region_id($game_player.x-2+x,$game_player.y+3+y), #65
          $game_map.region_id($game_player.x-1+x,$game_player.y+3+y), #66
          $game_map.region_id($game_player.x+x,$game_player.y+3+y),   #67
          $game_map.region_id($game_player.x+1+x,$game_player.y+3+y), #68
          $game_map.region_id($game_player.x+2+x,$game_player.y+3+y), #69
          $game_map.region_id($game_player.x+3+x,$game_player.y+3+y), #70
          $game_map.region_id($game_player.x+4+x,$game_player.y+3+y), #71
          $game_map.region_id($game_player.x-4+x,$game_player.y+4+y), #72
          $game_map.region_id($game_player.x-3+x,$game_player.y+4+y), #73
          $game_map.region_id($game_player.x-2+x,$game_player.y+4+y), #74
          $game_map.region_id($game_player.x-1+x,$game_player.y+4+y), #75
          $game_map.region_id($game_player.x+x,$game_player.y+4+y),   #76
          $game_map.region_id($game_player.x+1+x,$game_player.y+4+y), #77
          $game_map.region_id($game_player.x+2+x,$game_player.y+4+y), #78
          $game_map.region_id($game_player.x+3+x,$game_player.y+4+y), #79
          $game_map.region_id($game_player.x+4+x,$game_player.y+4+y)] #80
  end
        
  def tile_test(id)
    if id < 1024
      if (id/256).floor == 0
        return [5,[id%256,0]]#B
      elsif (id/256).to_i == 1
        return [6,[id%256,0]]#C
      elsif (id/256).to_i == 2
        return [7,[id%256,0]]#D
      else
        return [8,[id%256,0]] #E
      end
    elsif id < 1664
      return [4,[(id-1024)%128,0]]#A5
    elsif id < 2816
      return [0,[(id-1664)/48,(id-1664)%48]]#A1
    elsif id < 4352
      return [1,[(id-2816)/48,(id-2816)%48]]#A2
    elsif id < 5888
      return [2,[(id-4352)/48,(id-4352)%48]]#A3
    else
      return [3,[(id-5888)/48,((id-5888)%48)]]#A4
    end
  end
  
  def map_change(id)
    return ($game_map.map_id == id)
  end
  
end
class Scene_MenuBase < Scene_Base
  alias create_background_etage create_background
  def create_background
    create_background_etage
    if $spriteset_map_bloc != nil
      @background_sprite0 = Sprite.new
      @background_sprite0.bitmap = $spriteset_map_bloc.take_sprite_etage(0)
      @background_sprite0.color.set(16, 16, 16, 128)
      @background_sprite1 = Sprite.new
      @background_sprite1.bitmap = $spriteset_map_bloc.take_sprite_etage(1)
      @background_sprite1.color.set(16, 16, 16, 128)
      @background_sprite2 = Sprite.new
      @background_sprite2.bitmap = $spriteset_map_bloc.take_sprite_etage(2)
      @background_sprite2.color.set(16, 16, 16, 128)
      $spriteset_map_bloc.hide_sprite
    end
  end

  def dispose_background
    @background_sprite.dispose
    @background_sprite0.dispose
    @background_sprite1.dispose
    @background_sprite2.dispose
    $spriteset_map_bloc.show_sprite
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Modifie le script d'overlay si présent pour adaptation au sprite (hauteur) ║
#╚═════════════════════════════════════════════════════════════════════════════╝
if YAMI_OVERLAY
  class Spriteset_Map
    def create_overlay_map
      @current_light = 0
      @current_shadow = 0
      @current_par = 0
      @current_ground = 0
      # Ground Layer
      @ground = Sprite.new(@viewport1)
      @ground.z = 1
      @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
      # Light Layer
      @light = Sprite.new(@viewport2)
      @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
      @light.blend_type = 1
      @light.z = 0#299
      # Shadow Layer
      @shadow = Sprite.new(@viewport2)
      @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
      @shadow.blend_type = 2
      @shadow.z = -1#298
      # Parallax Layer
      @par = Sprite.new(@viewport2)
      @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
      @par.z = -1#297
    end
  end
end
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 21:29
En 2 partie (il est trop long ^^)
Code:

#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Création de l'image de l'étage                                            ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Spriteset_Map_Bloc  #Spriteset_Map_Bloc

  def initialize
    create_viewports
    create_bloc
    @update_sprite_direction = 0
    @boucle_update = 0
    @update_centre = false
  end
 
  def create_viewports
    @viewport4 = Viewport.new
  end
 
  def create_sprite
    @sprite_bloc1 = Sprite.new(@viewport4)
    @sprite_bloc2 = Sprite.new(@viewport4)
    @sprite_bloc3 = Sprite.new(@viewport4)
    @sprite_bloc4 = Sprite.new(@viewport4)
    @sprite_bloc1.z = 0
    @sprite_bloc2.z = 1
    @sprite_bloc3.z = 3
    @sprite_bloc4.z = 2
    @rect = Rect.new(0,0,16,16)
  end
   
  def update
    if $game_player.moving?
      if (@boucle_update == 0)&&($test == true)
        $game_variables[VAR] = $a[40] if $a[40] >= RDC
        $game_variables[VAR] = RDC if $a[40] < RDC
      end
      update_sprite($myx,$myy) if @update_ok == true
      x = take_coord_update(1)
      y = take_coord_update(2)
      @sprite_bloc1.x = x
      @sprite_bloc1.y = y
      @sprite_bloc2.x = x
      @sprite_bloc2.y = y
      @sprite_bloc3.x = x
      @sprite_bloc3.y = y
      @sprite_bloc4.x = x
      @sprite_bloc4.y = y
      @boucle_update = @boucle_update + 1
      @update_centre = true
    else
      @boucle_update = 0
      @update_ok = true
      update_sprite_2 if @update_sprite_direction != 0
      x = $game_player.screen_x - 144
      y = $game_player.screen_y - 156
      @sprite_bloc1.x = x
      @sprite_bloc1.y = y
      @sprite_bloc2.x = x
      @sprite_bloc2.y = y
      @sprite_bloc3.x = x
      @sprite_bloc3.y = y
      @sprite_bloc4.x = x
      @sprite_bloc4.y = y
      update_bloc_centre if @update_centre
      @update_centre = false
    end
  end
 
  def take_coord_update(id)
    if id == 1
      if ($game_map.display_x != 0)&&($game_map.display_x != $game_map.width-17)
        return $game_player.screen_x - 144 - (($game_map.display_x-$game_map.display_x.floor) * 32)
      else
        return $game_player.screen_x - ( ( $game_player.screen_x - 16) % 32) - 144
      end
    elsif id == 2
      if ($game_map.display_y != 0)&&($game_map.display_y != $game_map.height-13)
        @y_sprite_update = $game_player.screen_y - 156 - (($game_map.display_y-$game_map.display_y.floor) * 32)
        return @y_sprite_update
      else
        if $game_player.real_move_speed == 1
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=134)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=134)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=133)
        elsif $game_player.real_move_speed == 2
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=63)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=62)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=61)
        elsif $game_player.real_move_speed == 3
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=50)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=26)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=25)
        elsif $game_player.real_move_speed == 4
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=50)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=8)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=7)
        else
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=1)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)
        end
        return $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 0)
        return @y_sprite_update
      end
    end
  end
 
  def hide_sprite
    @sprite_bloc1.visible = false
  @sprite_bloc2.visible = false
  @sprite_bloc3.visible = false
  @sprite_bloc4.visible = false
 end
 
 def show_sprite
    @sprite_bloc1.visible = true
    @sprite_bloc2.visible = true
  @sprite_bloc3.visible = true
    @sprite_bloc4.visible = true
  end
 
  def take_sprite_etage(couche)
    return @sprite_bloc1.bitmap.blur if couche==0
    return @sprite_bloc2.bitmap.blur if couche==1
    return @sprite_bloc3.bitmap.blur if couche==2
    return @sprite_bloc4.bitmap.blur if couche==3
  end
 
  def update_sprite(x,y)
    @update_ok = false
    if x == -1 #gauche
      update_bloc_gauche
    elsif x == 1 #droite
      @update_sprite_direction = 6
    elsif y == 1 #bas
      @update_sprite_direction = 2
    elsif y == -1 #haut
      update_bloc_haut
    end
  end
 
  def update_sprite_2
    case @update_sprite_direction;
    when 2;
      update_bloc_bas
      @update_sprite_direction = 0
    when 4;
      update_bloc_gauche
      @update_sprite_direction = 0
    when 8;
      update_bloc_haut
      @update_sprite_direction = 0
    when 6;
      update_bloc_droite
      @update_sprite_direction = 0
    end
  end
 
  def update_bloc_centre
    $game_etage.take_info_map(0,0)
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,288,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    @sprite_intermédiaire1.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire2.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire3.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire4.clear_rect(96, 96, 96, 96)
    list = [30,31,32,39,40,41,48,49,50]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_haut
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,288,256)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,32,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,32,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,32,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,32,@sprite_bloc4.bitmap,@recthaut)
    list = [0,1,2,3,4,5,6,7,8]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_gauche
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,256,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(32,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(32,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(32,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(32,0,@sprite_bloc4.bitmap,@recthaut)
    list = [0,9,18,27,36,45,54,63]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_droite
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(32,0,256,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    list = [8,17,26,35,44,53,62,71]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_bas
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,32,288,256)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    list = [63,64,65,66,67,68,69,70,71]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def sprit_intermediaire_initialize
    @sprite_intermédiaire1 = Bitmap.new(288,288)
    @sprite_intermédiaire2 = Bitmap.new(288,288)
    @sprite_intermédiaire3 = Bitmap.new(288,288)
    @sprite_intermédiaire4 = Bitmap.new(288,288)
  end
 
  def create_bloc_bitmap_update(list)
    @rect2 = Rect.new(0,0,32,32)
    for i in 0..(list.length-1)
      for j in 0..2
        @blocb = Bitmap.new(32,32)
        for k in 0..3
          if ($b[list[i]][0]>=0)&&($b[list[i]][1]>=0)&&($c[list[i]]==1)
            take_texture($b[list[i]],2-j,k)
            @blocb.blt((k%2)*16,((k-(k%2))/2)*16, @secondary_bitmap, @rect2)
          end
        end
        @sprite_intermédiaire1.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 0
        @sprite_intermédiaire2.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 1
        @sprite_intermédiaire3.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 2
      end
      $game_map.events_xy_nt((list[i]%9)-4+$game_player.x,((list[i]-(list[i]%9))/9)-4+$game_player.y).any? do |event|
        @blocb = Bitmap.new(32,32)
        take_graphic_event(event)
        @sprite_intermédiaire4.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2)
      end
    end
  end
 
  def take_graphic_event(event)
    test = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
    if ($game_map.map_event[event.id].name.include? "ETAGE")&&($game_variables[VAR] < test-1)
      a = $game_map.map_event[event.id].pages
      for i in 0..a.length-1
        b = $game_map.map_event[event.id].pages[i].condition
        if conditions_met?(b,event)
          c = a[i].graphic
          name = c.character_name
          id = c.character_index
        direction = c.direction
          pattern = c.pattern
          picture = Cache.character(name)
          x = (id % 4)*96 +pattern*32
          y = (id/4).floor*128 + (direction/2-1)*32
          rect = Rect.new(x,y,32,32)
          @blocb.blt(0,0,picture,rect)
          i = a.length
        end
      end
    end
  end
 
  def conditions_met?(c,event)
    if c.switch1_valid
      return false unless $game_switches[c.switch1_id]
    end
    if c.switch2_valid
      return false unless $game_switches[c.switch2_id]
    end
    if c.variable_valid
      return false if $game_variables[c.variable_id] < c.variable_value
    end
    if c.self_switch_valid
      key = [$game_map.map_id, event.id, c.self_switch_ch]
      return false if $game_self_switches[key] != true
    end
    if c.item_valid
      item = $data_items[c.item_id]
      return false unless $game_party.has_item?(item)
    end
    if c.actor_valid
      actor = $game_actors[c.actor_id]
      return false unless $game_party.members.include?(actor)
    end
    return true
  end
 
  def create_bloc
    @tiles_list = $game_map.tileset.tileset_names
    create_sprite
    create_bloc_bitmap
    @sprite_bloc1.bitmap = @bloc0
    @sprite_bloc1.src_rect.set(0, 0, 288, 288)
    @sprite_bloc2.bitmap = @bloc1
    @sprite_bloc2.src_rect.set(0, 0, 288, 288)
    @sprite_bloc3.bitmap = @bloc2
    @sprite_bloc3.src_rect.set(0, 0, 288, 288)
    @sprite_bloc4.bitmap = @bloc3
    @sprite_bloc4.src_rect.set(0, 0, 288, 288)
  end
 
  #r-hori-vert
  #      h48 h80 h68
  #      r48 r80 r68
  #      r40 r00 r60
  #      r42 r20 r62
  #
  def create_bloc_bitmap
    @bloc0 = Bitmap.new(288,288)
    @bloc1 = Bitmap.new(288,288)
    @bloc2 = Bitmap.new(288,288)
    @bloc3 = Bitmap.new(288,288)
    @rect2 = Rect.new(0,0,32,32)
    for i in 0..71
      for j in 0..2
        @blocb = Bitmap.new(32,32)
        for k in 0..3
          if ($b[i][0]>=0)&&($b[i][1]>=0)&&($c[i]==1)
            take_texture($b[i],2-j,k)
            @blocb.blt((k%2)*16,((k-(k%2))/2)*16, @secondary_bitmap, @rect2)
          end
        end
        @bloc0.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 0
        @bloc1.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 1
        @bloc2.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 2
      end
      $game_map.events_xy_nt((i%9)-4+$game_player.x,((i-(i%9))/9)-4+$game_player.y).any? do |event|
        take_graphic_event(event)
        @bloc3.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2)
      end
    end
  end
 
  def take_texture(coord_map,couche,angle_square)
    create_auto_tile_table(coord_map[0],coord_map[1])
    @value_table = nil
    @secondary_bitmap = Bitmap.new(16,16)
    @value_table = $game_etage.tile_test(@table_tile[couche]) if  (@table_tile[couche] != 0)#&&(couche != 0)
    take_angle(@value_table[0],@value_table[1][0],@value_table[1][1],angle_square) if @value_table != nil
  end
 
  def take_angle(tile,id,type,angle)
    x = nil
    y = nil
    if tile >= 4 #Tile basic B,C,D,E,A5 MARCHE !!!
      x = (id % 8)*32 + (angle % 2)*16 +(8*32)*((id/128).floor)
      y = ((id - (id % 8))/8)*32 + ((angle-(angle % 2))/2)*16 -(16*32)*((id/128).floor)
    elsif tile == 0  #auto tile A1
      auto_tile_A1(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif tile == 1  #auto tile A2  MARCHE !!!
      auto_tile_A2(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif  tile == 2 #mur toit A3    MARCHE !!!
      auto_tile_A3(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif  tile == 3 #mur toit A4 avec auto tile  MARCHE !!!
      auto_tile_A4(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    end
    @bitmap_stockage = Cache.tileset(@tiles_list[tile])
    x = 0 if x == nil
    y = 0 if y == nil
    @rect = Rect.new(x,y,16,16)
    @secondary_bitmap = Bitmap.new(16,16)
    @secondary_bitmap.blt(0,0, @bitmap_stockage, @rect)
  end
 
  def create_auto_tile_table(x,y)
    @table_tile = $game_map.all_tiles(x,y)
  end
 
  ##############################################################################
  def auto_tile_A1(tile,id,type,angle)
    x_sous_tile = (id % * 64
    y_sous_tile = ((id-(id%8))/8)*96
    if angle == 0
      if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile
      elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+64
      elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
      if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile
      elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+64
      elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile
      end
    elsif angle == 2
      if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+48
      elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+64+16
      elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+16
      end
    elsif angle == 3
        if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+64+16
      elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile+16
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A2(tile,id,type,angle)
    x_sous_tile = (id % * 64
    y_sous_tile = ((id-(id%8))/8)*96
    if angle == 0
      if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile
      elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+64
      elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
      if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile
      elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+64
      elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile
      end
    elsif angle == 2
      if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+48
        elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+64+16
      elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+16
      end
    elsif angle == 3
      if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+64+16
      elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile+16
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A3(tile,id,type,angle)
    x_sous_tile = (id % * 64
    y_sous_tile = ((id-(id % 8))/8) * 64
    if angle == 0
      if [0,4,8,12].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [1,9,5,13].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+32
      elsif  [2,6,10,14].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile
      elsif  [3,7,11,15].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
    if [0,1,8,9].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [4,12,5,13].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+32
      elsif  [2,3,11,10].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile
      elsif  [6,14,7,15].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+48
        y = y_sous_tile
      end
    elsif angle == 2
      if [0,2,4,6].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif  [1,3,5,7].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+16
      elsif  [8,12,14,10].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+48
      elsif  [9,11,13,15].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+48
      end
    elsif angle == 3
      if [3,2,1,0].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+16
      elsif  [6,4,7,5].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif  [9,8,11,10].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [12,14,13,15].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+48
        y = y_sous_tile+48
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A4(tile,id,type,angle)
    x_sous_tile = (id % * 64
    y2 = ((id-(id % 8))/8)
    y_sous_tile = ((y2-(y2%2))/2)*64 + ((y2+(y2%2))/2)*96
    if ( y2 % 2 ) == 1
      if angle == 0
        if [0,4,8,12].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+32
        elsif  [1,9,5,13].include?(type)#barre verticale haut gauche
          x = x_sous_tile
          y = y_sous_tile+32
        elsif  [2,6,10,14].include?(type)#barre horizontal haut gauche
          x = x_sous_tile+32
          y = y_sous_tile
        elsif  [3,7,11,15].include?(type)#angle haut gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile
        end
      elsif angle == 1
      if [0,1,8,9].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+32
        elsif  [4,12,5,13].include?(type)#barre verticale haut droit
          x = x_sous_tile+48
          y = y_sous_tile+32
        elsif  [2,3,11,10].include?(type)#barre horizontal haut droit
          x = x_sous_tile+16
          y = y_sous_tile
        elsif  [6,14,7,15].include?(type)#angle haut droit vers l'interieur
          x = x_sous_tile+48
          y = y_sous_tile
        end
      elsif angle == 2
        if [0,2,4,6].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+16
        elsif  [1,3,5,7].include?(type)#barre verticale bas gauche
          x = x_sous_tile
          y = y_sous_tile+16
        elsif  [8,12,14,10].include?(type)#barre horizontal bas gauche
          x = x_sous_tile+32
          y = y_sous_tile+48
        elsif  [9,11,13,15].include?(type)#angle bas gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile+48
        end
      elsif angle == 3
        if [3,2,1,0].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+16
        elsif  [6,4,7,5].include?(type)#barre verticale bas droit
          x = x_sous_tile+48
          y = y_sous_tile+16
        elsif  [9,8,11,10].include?(type)#barre horizontal bas droit
          x = x_sous_tile+16
          y = y_sous_tile+48
        elsif  [12,14,13,15].include?(type)#angle bas droit vers l'interieur
          x = x_sous_tile+48
          y = y_sous_tile+48
        end
      end
    else
    if angle == 0
        if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
          x = x_sous_tile+32
          y = y_sous_tile
        elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+64
        elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
          x = x_sous_tile
          y = y_sous_tile+64
        elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
          x = x_sous_tile+32
          y = y_sous_tile+32
        elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile
        end
      elsif angle == 1
        if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
          x = x_sous_tile+48
          y = y_sous_tile
        elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+64
        elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
          x = x_sous_tile+48
          y = y_sous_tile+64
        elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
          x = x_sous_tile+16
          y = y_sous_tile+32
        elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
          x = x_sous_tile+16
          y = y_sous_tile
        end
      elsif angle == 2
        if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
          x = x_sous_tile+32
          y = y_sous_tile+16
        elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+48
        elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
          x = x_sous_tile
          y = y_sous_tile+48
        elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
          x = x_sous_tile+32
          y = y_sous_tile+64+16
        elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile+16
        end
      elsif angle == 3
        if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
          x = x_sous_tile+48
          y = y_sous_tile+16
        elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+48
        elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
          x = x_sous_tile+48
          y = y_sous_tile+48
        elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
          x = x_sous_tile+16
          y = y_sous_tile+64+16
        elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
          x = x_sous_tile+16
          y = y_sous_tile+16
        end
      end
    end
    @xy = [x,y]
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Réinitialization de l'image de l'étage au changement de map                ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Scene_Map < Scene_Base
  alias start_etage start
  def start
    start_etage
    $game_etage.initialize_map
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Ajout de la class principale au démarrage                                  ║
#╚═════════════════════════════════════════════════════════════════════════════╝
module DataManager
  class << self
    alias :create_game_objects_etage :create_game_objects
    def create_game_objects
      create_game_objects_etage
      $game_etage      = Game_Etage.new
    end
  end
end
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 21:48
Oui c'est bien Yami le créateur, merci pour la modification Smile
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Jeu 20 Fév 2014 - 23:16
je me suis rendu compte d'un petit problème avec les évent sur les étage de plus de 32*32 pixel je vais essayer de le corriger Smile
doudou08
doudou08
Membre

Nombre de messages : 23
Distinction : aucune
Date d'inscription : 28/12/2012

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Dim 23 Fév 2014 - 16:49
Euh en fait moi quand j'utilise le scrip, in game quand je passe sous certains objet/murs celui ci...s'allume on va dire, il change de couleur, est-ce normal?^^"

Je vous remercie d'avance de la réponse, sinon super script Smile
aranna
aranna
Membre

Nombre de messages : 340
Age : 39
Localisation : rouen
Distinction : Maman depuis le 17 juin 2014
Date d'inscription : 02/05/2013

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Dim 23 Fév 2014 - 17:06
un script très intéressant je retiens ! pour l'instant je ne m'étais pas penchez sur ce type d'étages mais sa devrait permettre des map bien plus intéressantes ! Merci pour ce travail !
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 26 Fév 2014 - 21:27
Salut j'ai eu de gros probleme avec ma co internet mais voici le script (en 2 partie car trop long pour un message :

Code:

################################################################################
#                   ETAGE BY VINCENT_26                                        #
################################################################################
=begin
Crédit : Vincent_26 (vous n’êtes pas obliger ^^)
Ce script permet de créer des étages facilement
Pour le mettre n’en place rien de plus simple :
-Ajouter l'id de la map sur laquelle vous voulez activer le script dans le tableau
prévu à cet effet.

-Créer les étages grâce aux régions id (ici ex avec RDC = 0 )
0 : RDC (Rez de chaussé)
1 : escalier
2 : étage (impassable)
3 : étage (au-dessus du héros)
4 : escalier (etage par rapport au RDC)
5 : étage (impassable depuis l'étage 3 mais etage pour le RDC)
6 : étage pour le RDC et l'étage 3
...
C’est tout ^^
############################# BUG ET MAJ #######################################
-Event non pris en compte comme étant à l'étage ou non

-Ombre non pris en compte

-Bug avec l'autotile 1 si mis en étage

Ces différents bugs vont-être mis à jour dès que possible
=end
#Si vous utiliser le systeme d'overlay de Yami mettre true :
YAMI_OVERLAY = true
#il faut de plus que ce script soit sous le script d'overlay
#ID Variable d'enregistrement de l'étage actuel (variable in game)
VAR = 1
#Map d'activation du script
MAP = [1,2]
#Définir région RDC (Toute les région de 0 a la valeur définit ferons office de RDC)
RDC = 0
#Nom des event :
#ETAGE <id>

###### NE RIEN TOUCHER SOUS CETTE LIGNE SANS SAVOIR CE QUE VOUS FAITES #########
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Modification du test de collision du perso                               ║
#║    Update de l'étage depuis l'update du héros                               ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_CharacterBase
  
  alias map_passable2? map_passable?
  def map_passable?(x, y, d)
    if (MAP.include?($game_map.map_id) == true)
      @boucle4 = 0 if @boucle4 == nil
      @boucle4 = 0 if @boucle4 == 4
      if (@boucle4 == 0)
        $game_etage.save_coordonnée_arrivée(d)
        $game_etage.take_info_map($myx,$myy)
        $game_etage.determine_position_perso
      end
      $game_etage.create_sprite
      @boucle4 += 1
      return true if Input.press?(:CTRL)
      return determine_passability(x,y,d)
    else
      return true if Input.press?(:CTRL)
      return map_passable2?(x, y, d)
    end
  end
  
  def determine_passability(x,y,d)
    return true if Input.press?(:CTRL)
    if $dessous_heros
      return true
    elsif $test == true
      a = map_passable2?(x, y, d)
      if (($game_variables[VAR] < $a[49]-2)&&(d == 8))||(($game_variables[VAR] < $a[39]-2)&&(d == 6))||(($game_variables[VAR] < $a[41]-2)&&(d == 4))||(($game_variables[VAR] < $a[31]-2)&&(d == 2))
        return true
      else
        return a
     end
    elsif $test == false
      return false
    end
  end
  
  alias collide_with_events_etage? collide_with_events?
 def collide_with_events?(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            return event.normal_priority? || self.is_a?(Game_Event)
          else
            return false
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            return event.normal_priority? || self.is_a?(Game_Event)
          else
            return false
          end
        end
      else
        return event.normal_priority? || self.is_a?(Game_Event)
      end
    end
  end
  
  alias update2 update
  def update
    update_animation
    $spriteset_map_bloc.update if ($spriteset_map_bloc != nil) && (moving? == false)
    return update_jump if jumping?
    return update_move if moving?
    return update_stop
  end
  
  alias update_move2 update_move
  def update_move
    @real_x = [@real_x - distance_per_frame, @x].max if @x < @real_x
    @real_x = [@real_x + distance_per_frame, @x].min if @x > @real_x
    @real_y = [@real_y - distance_per_frame, @y].max if @y < @real_y
    @real_y = [@real_y + distance_per_frame, @y].min if @y > @real_y
    $spriteset_map_bloc.update if $spriteset_map_bloc != nil
    update_bush_depth unless moving?
  end
  
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Réinitialize l'image au changement de map                                ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Player < Game_Character
  alias perform_transfer_etage perform_transfer
  def perform_transfer
    perform_transfer_etage
    $game_etage.initialize_map
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Ajoute une fonction de récuperation des event de la map                  ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Map
  def map_event
    @map.events
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║    Modification des contact avec les event si au-dessus du héros            ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Player < Game_Character
  alias check_event_trigger_touch_etage check_event_trigger_touch
  def start_map_event(x, y, triggers, normal)
    return if $game_map.interpreter.running?
    $game_map.events_xy(x, y).each do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            if event.trigger_in?(triggers) && event.normal_priority? == normal
              event.start
            end
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            if event.trigger_in?(triggers) && event.normal_priority? == normal
              event.start
            end
          end
        end
      else
        if event.trigger_in?(triggers) && event.normal_priority? == normal
          event.start
        end
      end
    end
  end
  def check_event_trigger_touch(x, y)
    $game_map.events_xy_nt(x, y).any? do |event|
      if (MAP.include?($game_map.map_id) == true)
        if ($game_map.map_event[event.id].name.include? "ETAGE")
          a = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
          if ($game_variables[VAR] == a-1)||($game_variables[VAR] == a)||($game_variables[VAR] == a+1)
            check_event_trigger_touch_etage(x,y)
          end
        else
          if ($game_variables[VAR] == RDC)||($game_variables[VAR] == RDC+1)
            check_event_trigger_touch_etage(x,y)
          end
        end
      else
        check_event_trigger_touch_etage(x,y)
      end
    end
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Class principale (calcul et détermine les variables nécessaires au sprite) ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Game_Etage
  
  def initialize_map
    if (MAP.include?($game_map.map_id) == true)
      $myy = 0
      $myx = 0
      take_info_map($myx,$myy)
      determine_position_perso
      $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
      $spriteset_map_bloc.create_viewports
      $spriteset_map_bloc.create_bloc
      $spriteset_map_bloc.show_sprite
      $spriteset_map_bloc.update
      $game_variables[VAR] = RDC if $game_variables[VAR] < RDC
   end
  end
  
  def save_coordonnée_arrivée(d)
    $myx = (2-(d % 6))/2
    $myy = (d % 4) - 1 - ((2-(d % 6))/2)
  end
  
  def take_coordonnée_etage_map
    return [($game_player.x+$myx-1)*32,($game_player.y+$myy-1.5)*32]
  end
  
  def take_info_map(x,y)
    region_info(x,y)
    $c = []
    for i in 0..80
      $c.push(1) if ($a[i] > $game_variables[VAR]+1)
      $c.push(0) if ($a[i] <= $game_variables[VAR]+1)
    end
  end
  
  def determine_position_perso
    $test = false
    if (($a[40]-$game_variables[VAR] > 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] > 2)&&($a[40] < RDC))
      $dessous_heros = true
    elsif (($a[40]-$game_variables[VAR] == 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] == 2)&&($a[40] < RDC))
      $dessous_heros = false
    elsif (($a[40]-$game_variables[VAR] > (-2))&&($a[40]-$game_variables[VAR] < 2)&&($a[40] >= RDC))||((RDC-$game_variables[VAR] > (-2))&&(RDC-$game_variables[VAR] < 2)&&($a[40] < RDC))
      $dessous_heros = false
      $test = true
    elsif (($a[40]-$game_variables[VAR] <= (-2))&&($a[40] >= RDC))||((RDC-$game_variables[VAR] <= (-2))&&($a[40] < RDC))
      $dessous_heros = false
    end
  end
  
  def create_sprite
    if (MAP.include?($game_map.map_id) == true)
      if $c.include?(1) == true
        $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
        $spriteset_map_bloc.show_sprite
      else
        $spriteset_map_bloc = Spriteset_Map_Bloc.new if $spriteset_map_bloc == nil
        $spriteset_map_bloc.hide_sprite
      end
    end
  end
  
  def determine_passability(x,y,d)
    return true if Input.press?(:CTRL)
    if true
      return map_passable2?(x, y, d)
    elsif @pictures_ok
      return true
    else
      return false
    end
  end
  
  #r-hori-vert
  #      00 01 02 03 04 05 06 07 08
  #      09 10 11 12 13 14 15 16 17
  #      18 19 20 21 22 23 24 25 26
  #      27 28 29 30 31 32 33 34 35
  #      36 37 38 39 40 41 42 43 44
  #      45 46 47 48 49 50 51 52 53
  #      54 55 56 57 58 59 60 61 62
  #      63 64 65 66 67 68 69 70 71
  #      72 73 74 75 76 77 78 79 80
  def region_info(x,y)
    $b = [[$game_player.x-4+x,$game_player.y-4+y], #0
          [$game_player.x-3+x,$game_player.y-4+y], #1
          [$game_player.x-2+x,$game_player.y-4+y], #2
          [$game_player.x-1+x,$game_player.y-4+y], #3
          [$game_player.x+x,$game_player.y-4+y],   #4
          [$game_player.x+1+x,$game_player.y-4+y], #5
          [$game_player.x+2+x,$game_player.y-4+y], #6
          [$game_player.x+3+x,$game_player.y-4+y], #7
          [$game_player.x+4+x,$game_player.y-4+y], #8
          [$game_player.x-4+x,$game_player.y-3+y], #9
          [$game_player.x-3+x,$game_player.y-3+y], #10
          [$game_player.x-2+x,$game_player.y-3+y], #11
          [$game_player.x-1+x,$game_player.y-3+y], #12
          [$game_player.x+x,$game_player.y-3+y],   #13
          [$game_player.x+1+x,$game_player.y-3+y], #14
          [$game_player.x+2+x,$game_player.y-3+y], #15
          [$game_player.x+3+x,$game_player.y-3+y], #16
          [$game_player.x+4+x,$game_player.y-3+y], #17
          [$game_player.x-4+x,$game_player.y-2+y], #18
          [$game_player.x-3+x,$game_player.y-2+y], #19
          [$game_player.x-2+x,$game_player.y-2+y], #20
          [$game_player.x-1+x,$game_player.y-2+y], #21
          [$game_player.x+x,$game_player.y-2+y],   #22
          [$game_player.x+1+x,$game_player.y-2+y], #23
          [$game_player.x+2+x,$game_player.y-2+y], #24
          [$game_player.x+3+x,$game_player.y-2+y], #25
          [$game_player.x+4+x,$game_player.y-2+y], #26
          [$game_player.x-4+x,$game_player.y-1+y], #27
          [$game_player.x-3+x,$game_player.y-1+y], #28
          [$game_player.x-2+x,$game_player.y-1+y], #29
          [$game_player.x-1+x,$game_player.y-1+y], #30
          [$game_player.x+x,$game_player.y-1+y],   #31
          [$game_player.x+1+x,$game_player.y-1+y], #32
          [$game_player.x+2+x,$game_player.y-1+y], #33
          [$game_player.x+3+x,$game_player.y-1+y], #34
          [$game_player.x+4+x,$game_player.y-1+y], #35
          [$game_player.x-4+x,$game_player.y+y],   #36
          [$game_player.x-3+x,$game_player.y+y],   #37
          [$game_player.x-2+x,$game_player.y+y],   #38
          [$game_player.x-1+x,$game_player.y+y],   #39
          [$game_player.x+x,$game_player.y+y],     #40
          [$game_player.x+1+x,$game_player.y+y],   #41
          [$game_player.x+2+x,$game_player.y+y],   #42
          [$game_player.x+3+x,$game_player.y+y],   #43
          [$game_player.x+4+x,$game_player.y+y],   #44
          [$game_player.x-4+x,$game_player.y+1+y], #45
          [$game_player.x-3+x,$game_player.y+1+y], #46
          [$game_player.x-2+x,$game_player.y+1+y], #47
          [$game_player.x-1+x,$game_player.y+1+y], #48
          [$game_player.x+x,$game_player.y+1+y],   #49
          [$game_player.x+1+x,$game_player.y+1+y], #50
          [$game_player.x+2+x,$game_player.y+1+y], #51
          [$game_player.x+3+x,$game_player.y+1+y], #52
          [$game_player.x+4+x,$game_player.y+1+y], #53
          [$game_player.x-4+x,$game_player.y+2+y], #54
          [$game_player.x-3+x,$game_player.y+2+y], #55
          [$game_player.x-2+x,$game_player.y+2+y], #56
          [$game_player.x-1+x,$game_player.y+2+y], #57
          [$game_player.x+x,$game_player.y+2+y],   #58
          [$game_player.x+1+x,$game_player.y+2+y], #59
          [$game_player.x+2+x,$game_player.y+2+y], #60
          [$game_player.x+3+x,$game_player.y+2+y], #61
          [$game_player.x+4+x,$game_player.y+2+y], #62
          [$game_player.x-4+x,$game_player.y+3+y], #63
          [$game_player.x-3+x,$game_player.y+3+y], #64
          [$game_player.x-2+x,$game_player.y+3+y], #65
          [$game_player.x-1+x,$game_player.y+3+y], #66
          [$game_player.x+x,$game_player.y+3+y],   #67
          [$game_player.x+1+x,$game_player.y+3+y], #68
          [$game_player.x+2+x,$game_player.y+3+y], #69
          [$game_player.x+3+x,$game_player.y+3+y], #70
          [$game_player.x+4+x,$game_player.y+3+y], #71
          [$game_player.x-4+x,$game_player.y+4+y], #72
          [$game_player.x-3+x,$game_player.y+4+y], #73
          [$game_player.x-2+x,$game_player.y+4+y], #74
          [$game_player.x-1+x,$game_player.y+4+y], #75
          [$game_player.x+x,$game_player.y+4+y],   #76
          [$game_player.x+1+x,$game_player.y+4+y], #77
          [$game_player.x+2+x,$game_player.y+4+y], #78
          [$game_player.x+3+x,$game_player.y+4+y], #79
          [$game_player.x+4+x,$game_player.y+4+y]] #80
    $a = [$game_map.region_id($game_player.x-4+x,$game_player.y-4+y), #0
          $game_map.region_id($game_player.x-3+x,$game_player.y-4+y), #1
          $game_map.region_id($game_player.x-2+x,$game_player.y-4+y), #2
          $game_map.region_id($game_player.x-1+x,$game_player.y-4+y), #3
          $game_map.region_id($game_player.x+x,$game_player.y-4+y),   #4
          $game_map.region_id($game_player.x+1+x,$game_player.y-4+y), #5
          $game_map.region_id($game_player.x+2+x,$game_player.y-4+y), #6
          $game_map.region_id($game_player.x+3+x,$game_player.y-4+y), #7
          $game_map.region_id($game_player.x+4+x,$game_player.y-4+y), #8
          $game_map.region_id($game_player.x-4+x,$game_player.y-3+y), #9
          $game_map.region_id($game_player.x-3+x,$game_player.y-3+y), #10
          $game_map.region_id($game_player.x-2+x,$game_player.y-3+y), #11
          $game_map.region_id($game_player.x-1+x,$game_player.y-3+y), #12
          $game_map.region_id($game_player.x+x,$game_player.y-3+y),   #13
          $game_map.region_id($game_player.x+1+x,$game_player.y-3+y), #14
          $game_map.region_id($game_player.x+2+x,$game_player.y-3+y), #15
          $game_map.region_id($game_player.x+3+x,$game_player.y-3+y), #16
          $game_map.region_id($game_player.x+4+x,$game_player.y-3+y), #17
          $game_map.region_id($game_player.x-4+x,$game_player.y-2+y), #18
          $game_map.region_id($game_player.x-3+x,$game_player.y-2+y), #19
          $game_map.region_id($game_player.x-2+x,$game_player.y-2+y), #20
          $game_map.region_id($game_player.x-1+x,$game_player.y-2+y), #21
          $game_map.region_id($game_player.x+x,$game_player.y-2+y),   #22
          $game_map.region_id($game_player.x+1+x,$game_player.y-2+y), #23
          $game_map.region_id($game_player.x+2+x,$game_player.y-2+y), #24
          $game_map.region_id($game_player.x+3+x,$game_player.y-2+y), #25
          $game_map.region_id($game_player.x+4+x,$game_player.y-2+y), #26
          $game_map.region_id($game_player.x-4+x,$game_player.y-1+y), #27
          $game_map.region_id($game_player.x-3+x,$game_player.y-1+y), #28
          $game_map.region_id($game_player.x-2+x,$game_player.y-1+y), #29
          $game_map.region_id($game_player.x-1+x,$game_player.y-1+y), #30
          $game_map.region_id($game_player.x+x,$game_player.y-1+y),   #31
          $game_map.region_id($game_player.x+1+x,$game_player.y-1+y), #32
          $game_map.region_id($game_player.x+2+x,$game_player.y-1+y), #33
          $game_map.region_id($game_player.x+3+x,$game_player.y-1+y), #34
          $game_map.region_id($game_player.x+4+x,$game_player.y-1+y), #35
          $game_map.region_id($game_player.x-4+x,$game_player.y+y),   #36
          $game_map.region_id($game_player.x-3+x,$game_player.y+y),   #37
          $game_map.region_id($game_player.x-2+x,$game_player.y+y),   #38
          $game_map.region_id($game_player.x-1+x,$game_player.y+y),   #39
          $game_map.region_id($game_player.x+x,$game_player.y+y),     #40
          $game_map.region_id($game_player.x+1+x,$game_player.y+y),   #41
          $game_map.region_id($game_player.x+2+x,$game_player.y+y),   #42
          $game_map.region_id($game_player.x+3+x,$game_player.y+y),   #43
          $game_map.region_id($game_player.x+4+x,$game_player.y+y),   #44
          $game_map.region_id($game_player.x-4+x,$game_player.y+1+y), #45
          $game_map.region_id($game_player.x-3+x,$game_player.y+1+y), #46
          $game_map.region_id($game_player.x-2+x,$game_player.y+1+y), #47
          $game_map.region_id($game_player.x-1+x,$game_player.y+1+y), #48
          $game_map.region_id($game_player.x+x,$game_player.y+1+y),   #49
          $game_map.region_id($game_player.x+1+x,$game_player.y+1+y), #50
          $game_map.region_id($game_player.x+2+x,$game_player.y+1+y), #51
          $game_map.region_id($game_player.x+3+x,$game_player.y+1+y), #52
          $game_map.region_id($game_player.x+4+x,$game_player.y+1+y), #53
          $game_map.region_id($game_player.x-4+x,$game_player.y+2+y), #54
          $game_map.region_id($game_player.x-3+x,$game_player.y+2+y), #55
          $game_map.region_id($game_player.x-2+x,$game_player.y+2+y), #56
          $game_map.region_id($game_player.x-1+x,$game_player.y+2+y), #57
          $game_map.region_id($game_player.x+x,$game_player.y+2+y),   #58
          $game_map.region_id($game_player.x+1+x,$game_player.y+2+y), #59
          $game_map.region_id($game_player.x+2+x,$game_player.y+2+y), #60
          $game_map.region_id($game_player.x+3+x,$game_player.y+2+y), #61
          $game_map.region_id($game_player.x+4+x,$game_player.y+2+y), #62
          $game_map.region_id($game_player.x-4+x,$game_player.y+3+y), #63
          $game_map.region_id($game_player.x-3+x,$game_player.y+3+y), #64
          $game_map.region_id($game_player.x-2+x,$game_player.y+3+y), #65
          $game_map.region_id($game_player.x-1+x,$game_player.y+3+y), #66
          $game_map.region_id($game_player.x+x,$game_player.y+3+y),   #67
          $game_map.region_id($game_player.x+1+x,$game_player.y+3+y), #68
          $game_map.region_id($game_player.x+2+x,$game_player.y+3+y), #69
          $game_map.region_id($game_player.x+3+x,$game_player.y+3+y), #70
          $game_map.region_id($game_player.x+4+x,$game_player.y+3+y), #71
          $game_map.region_id($game_player.x-4+x,$game_player.y+4+y), #72
          $game_map.region_id($game_player.x-3+x,$game_player.y+4+y), #73
          $game_map.region_id($game_player.x-2+x,$game_player.y+4+y), #74
          $game_map.region_id($game_player.x-1+x,$game_player.y+4+y), #75
          $game_map.region_id($game_player.x+x,$game_player.y+4+y),   #76
          $game_map.region_id($game_player.x+1+x,$game_player.y+4+y), #77
          $game_map.region_id($game_player.x+2+x,$game_player.y+4+y), #78
          $game_map.region_id($game_player.x+3+x,$game_player.y+4+y), #79
          $game_map.region_id($game_player.x+4+x,$game_player.y+4+y)] #80
  end
        
  def tile_test(id)
    if id < 1024
      if (id/256).floor == 0
        return [5,[id%256,0]]#B
      elsif (id/256).to_i == 1
        return [6,[id%256,0]]#C
      elsif (id/256).to_i == 2
        return [7,[id%256,0]]#D
      else
        return [8,[id%256,0]] #E
      end
    elsif id < 1664
      return [4,[(id-1024)%128,0]]#A5
    elsif id < 2816
      return [0,[(id-1664)/48,(id-1664)%48]]#A1
    elsif id < 4352
      return [1,[(id-2816)/48,(id-2816)%48]]#A2
    elsif id < 5888
      return [2,[(id-4352)/48,(id-4352)%48]]#A3
    else
      return [3,[(id-5888)/48,((id-5888)%48)]]#A4
    end
  end
  
  def map_change(id)
    return ($game_map.map_id == id)
  end
  
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Ajoute le masquage des image lors de l'ouverture du menu                   ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Scene_MenuBase < Scene_Base
  alias create_background_etage create_background
  def create_background
    create_background_etage
    if $spriteset_map_bloc != nil
      @background_sprite0 = Sprite.new
      @background_sprite0.bitmap = $spriteset_map_bloc.take_sprite_etage(0)
      @background_sprite0.color.set(16, 16, 16, 128)
      @background_sprite1 = Sprite.new
      @background_sprite1.bitmap = $spriteset_map_bloc.take_sprite_etage(1)
      @background_sprite1.color.set(16, 16, 16, 128)
      @background_sprite2 = Sprite.new
      @background_sprite2.bitmap = $spriteset_map_bloc.take_sprite_etage(2)
      @background_sprite2.color.set(16, 16, 16, 128)
      $spriteset_map_bloc.hide_sprite
    end
  end

  alias dispose_background_etage dispose_background
  def dispose_background
    dispose_background_etage
    if $spriteset_map_bloc != nil
      @background_sprite0.dispose
      @background_sprite1.dispose
      @background_sprite2.dispose
      $spriteset_map_bloc.show_sprite
    end
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Modifie le script d'overlay si présent pour adaptation au sprite (hauteur) ║
#╚═════════════════════════════════════════════════════════════════════════════╝
if YAMI_OVERLAY
  class Spriteset_Map
    def create_overlay_map
      @current_light = 0
      @current_shadow = 0
      @current_par = 0
      @current_ground = 0
      # Ground Layer
      @ground = Sprite.new(@viewport1)
      @ground.z = 1
      @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
      # Light Layer
      @light = Sprite.new(@viewport2)
      @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
      @light.blend_type = 1
      @light.z = 0#299
      # Shadow Layer
      @shadow = Sprite.new(@viewport2)
      @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
      @shadow.blend_type = 2
      @shadow.z = -1#298
      # Parallax Layer
      @par = Sprite.new(@viewport2)
      @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
      @par.z = -1#297
    end
  end
end


Dernière édition par vincent26 le Mer 5 Mar 2014 - 17:17, édité 2 fois
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 26 Fév 2014 - 21:28
la suite :
Code:

#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Création de l'image de l'étage                                            ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Spriteset_Map_Bloc  #Spriteset_Map_Bloc

  def initialize
    create_viewports
    create_bloc
    @update_sprite_direction = 0
    @boucle_update = 0
    @update_centre = false
  end
 
  def create_viewports
    @viewport4 = Viewport.new
  end
 
  def create_sprite
    @sprite_bloc1 = Sprite.new(@viewport4)
    @sprite_bloc2 = Sprite.new(@viewport4)
    @sprite_bloc3 = Sprite.new(@viewport4)
    @sprite_bloc4 = Sprite.new(@viewport4)
    @sprite_bloc1.z = 0
    @sprite_bloc2.z = 1
    @sprite_bloc3.z = 3
    @sprite_bloc4.z = 2
    @rect = Rect.new(0,0,16,16)
  end
   
  def update
    if $game_player.moving?
      if (@boucle_update == 0)&&($test == true)
        $game_variables[VAR] = $a[40] if $a[40] >= RDC
        $game_variables[VAR] = RDC if $a[40] < RDC
      end
      update_sprite($myx,$myy) if @update_ok == true
      x = take_coord_update(1)
      y = take_coord_update(2)
      @sprite_bloc1.x = x
      @sprite_bloc1.y = y
      @sprite_bloc2.x = x
      @sprite_bloc2.y = y
      @sprite_bloc3.x = x
      @sprite_bloc3.y = y
      @sprite_bloc4.x = x
      @sprite_bloc4.y = y
      @boucle_update = @boucle_update + 1
      @update_centre = true
    else
      @boucle_update = 0
      @update_ok = true
      update_sprite_2 if @update_sprite_direction != 0
      x = $game_player.screen_x - 144
      y = $game_player.screen_y - 156
      @sprite_bloc1.x = x
      @sprite_bloc1.y = y
      @sprite_bloc2.x = x
      @sprite_bloc2.y = y
      @sprite_bloc3.x = x
      @sprite_bloc3.y = y
      @sprite_bloc4.x = x
      @sprite_bloc4.y = y
      update_bloc_centre if @update_centre
      @update_centre = false
    end
  end
 
  def take_coord_update(id)
    if id == 1
      if ($game_map.display_x != 0)&&($game_map.display_x != $game_map.width-17)
        return $game_player.screen_x - 144 - (($game_map.display_x-$game_map.display_x.floor) * 32)
      else
        return $game_player.screen_x - ( ( $game_player.screen_x - 16) % 32) - 144
      end
    elsif id == 2
      if ($game_map.display_y != 0)&&($game_map.display_y != $game_map.height-13)
        @y_sprite_update = $game_player.screen_y - 156 - (($game_map.display_y-$game_map.display_y.floor) * 32)
        return @y_sprite_update
      else
        if $game_player.real_move_speed == 1
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=134)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=134)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=133)
        elsif $game_player.real_move_speed == 2
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=63)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=62)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=61)
        elsif $game_player.real_move_speed == 3
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=50)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=26)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=25)
        elsif $game_player.real_move_speed == 4
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=50)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)&&(@boucle_update>=8)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 1)&&(@boucle_update<=7)
        else
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == -1)&&(@boucle_update<=1)
          @y_sprite_update = $game_player.screen_y - ( $game_player.screen_y % 32) - 160 if ($myy == 1)
        end
        return $game_player.screen_y - ( $game_player.screen_y % 32) - 128 if ($myy == 0)
        return @y_sprite_update
      end
    end
  end
 
  def hide_sprite
    @sprite_bloc1.visible = false
    @sprite_bloc2.visible = false
    @sprite_bloc3.visible = false
    @sprite_bloc4.visible = false
  end
 
  def show_sprite
    @sprite_bloc1.visible = true
    @sprite_bloc2.visible = true
    @sprite_bloc3.visible = true
    @sprite_bloc4.visible = true
  end
 
  def take_sprite_etage(couche)
    return @sprite_bloc1.bitmap.blur if couche==0
    return @sprite_bloc2.bitmap.blur if couche==1
    return @sprite_bloc3.bitmap.blur if couche==2
    return @sprite_bloc4.bitmap.blur if couche==3
  end
 
  def update_sprite(x,y)
    @update_ok = false
    if x == -1 #gauche
      update_bloc_gauche
    elsif x == 1 #droite
      @update_sprite_direction = 6
    elsif y == 1 #bas
      @update_sprite_direction = 2
    elsif y == -1 #haut
      update_bloc_haut
    end
  end
 
  def update_sprite_2
    case @update_sprite_direction;
    when 2;
      update_bloc_bas
      @update_sprite_direction = 0
    when 4;
      update_bloc_gauche
      @update_sprite_direction = 0
    when 8;
      update_bloc_haut
      @update_sprite_direction = 0
    when 6;
      update_bloc_droite
      @update_sprite_direction = 0
    end
  end
 
  def update_bloc_centre
    $game_etage.take_info_map(0,0)
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,288,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    @sprite_intermédiaire1.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire2.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire3.clear_rect(96, 96, 96, 96)
    @sprite_intermédiaire4.clear_rect(96, 96, 96, 96)
    list = [30,31,32,39,40,41,48,49,50]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_haut
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,288,256)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,32,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,32,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,32,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,32,@sprite_bloc4.bitmap,@recthaut)
    list = [0,1,2,3,4,5,6,7,8]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_gauche
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,0,256,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(32,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(32,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(32,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(32,0,@sprite_bloc4.bitmap,@recthaut)
    list = [0,9,18,27,36,45,54,63]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_droite
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(32,0,256,288)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    list = [8,17,26,35,44,53,62,71]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def update_bloc_bas
    @tiles_list = $game_map.tileset.tileset_names
    @recthaut = Rect.new(0,32,288,256)
    sprit_intermediaire_initialize
    @sprite_intermédiaire1.blt(0,0,@sprite_bloc1.bitmap,@recthaut)
    @sprite_intermédiaire2.blt(0,0,@sprite_bloc2.bitmap,@recthaut)
    @sprite_intermédiaire3.blt(0,0,@sprite_bloc3.bitmap,@recthaut)
    @sprite_intermédiaire4.blt(0,0,@sprite_bloc4.bitmap,@recthaut)
    list = [63,64,65,66,67,68,69,70,71]
    create_bloc_bitmap_update(list)
    @sprite_bloc1.bitmap = @sprite_intermédiaire1
    @sprite_bloc2.bitmap = @sprite_intermédiaire2
    @sprite_bloc3.bitmap = @sprite_intermédiaire3
    @sprite_bloc4.bitmap = @sprite_intermédiaire4
  end
 
  def sprit_intermediaire_initialize
    @sprite_intermédiaire1 = Bitmap.new(288,288)
    @sprite_intermédiaire2 = Bitmap.new(288,288)
    @sprite_intermédiaire3 = Bitmap.new(288,288)
    @sprite_intermédiaire4 = Bitmap.new(288,288)
  end
 
  def create_bloc_bitmap_update(list)
    @rect2 = Rect.new(0,0,32,32)
    for i in 0..(list.length-1)
      for j in 0..2
        @blocb = Bitmap.new(32,32)
        for k in 0..3
          if ($b[list[i]][0]>=0)&&($b[list[i]][1]>=0)&&($c[list[i]]==1)
            take_texture($b[list[i]],2-j,k)
            @blocb.blt((k%2)*16,((k-(k%2))/2)*16, @secondary_bitmap, @rect2)
          end
        end
        @sprite_intermédiaire1.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 0
        @sprite_intermédiaire2.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 1
        @sprite_intermédiaire3.blt((list[i]%9)*32,((list[i]-(list[i]%9))/9)*32,@blocb,@rect2) if j == 2
      end
      $game_map.events_xy_nt((list[i]%9)-4+$game_player.x,((list[i]-(list[i]%9))/9)-4+$game_player.y).any? do |event|
        @blocb = Bitmap.new(32,32)
        @rect_event = Rect.new(0,0,32,32)
        take_graphic_event(event)
        rect = Rect.new(0,0,@blocb.width,@blocb.height)
        @sprite_intermédiaire4.blt((list[i]%9)*32-(@blocb.width-32)/2,((list[i]-(list[i]%9))/9)*32-(@blocb.height-32),@blocb,rect)
      end
    end
  end
 
  def take_graphic_event(event)
    test = $game_map.map_event[event.id].name[7..$game_map.map_event[event.id].name.length-2].to_i
    if ($game_map.map_event[event.id].name.include? "ETAGE")&&($game_variables[VAR] < test-1)
      a = $game_map.map_event[event.id].pages
      for i in 0..a.length-1
        b = $game_map.map_event[event.id].pages[i].condition
        if conditions_met?(b,event)
          c = a[i].graphic
          name = c.character_name
          id = c.character_index
          direction = c.direction
          pattern = c.pattern
          picture = Cache.character(name)
          x = (id % 4)*(picture.width/4) +pattern*(picture.width/12)
          y = (id/4).floor*(picture.height/2) + (direction/2-1)*(picture.height/8)
          @rect_event = Rect.new(x,y,picture.width/12,picture.height/8)
          @blocb = Bitmap.new(picture.width/12,picture.height/8)
          @blocb.blt(0,0,picture,@rect_event)
          puts [picture.width/12,picture.height/8].to_s
          i = a.length
        end
      end
    end
  end
 
  def conditions_met?(c,event)
    if c.switch1_valid
      return false unless $game_switches[c.switch1_id]
    end
    if c.switch2_valid
      return false unless $game_switches[c.switch2_id]
    end
    if c.variable_valid
      return false if $game_variables[c.variable_id] < c.variable_value
    end
    if c.self_switch_valid
      key = [$game_map.map_id, event.id, c.self_switch_ch]
      return false if $game_self_switches[key] != true
    end
    if c.item_valid
      item = $data_items[c.item_id]
      return false unless $game_party.has_item?(item)
    end
    if c.actor_valid
      actor = $game_actors[c.actor_id]
      return false unless $game_party.members.include?(actor)
    end
    return true
  end
 
  def create_bloc
    @tiles_list = $game_map.tileset.tileset_names
    create_sprite
    create_bloc_bitmap
    @sprite_bloc1.bitmap = @bloc0
    @sprite_bloc1.src_rect.set(0, 0, 288, 288)
    @sprite_bloc2.bitmap = @bloc1
    @sprite_bloc2.src_rect.set(0, 0, 288, 288)
    @sprite_bloc3.bitmap = @bloc2
    @sprite_bloc3.src_rect.set(0, 0, 288, 288)
    @sprite_bloc4.bitmap = @bloc3
    @sprite_bloc4.src_rect.set(0, 0, 288, 288)
  end
 
  #r-hori-vert
  #      h48 h80 h68
  #      r48 r80 r68
  #      r40 r00 r60
  #      r42 r20 r62
  #
  def create_bloc_bitmap
    @bloc0 = Bitmap.new(288,288)
    @bloc1 = Bitmap.new(288,288)
    @bloc2 = Bitmap.new(288,288)
    @bloc3 = Bitmap.new(288,288)
    @rect2 = Rect.new(0,0,32,32)
    for i in 0..80
      for j in 0..2
        @blocb = Bitmap.new(32,32)
        for k in 0..3
          if ($b[i][0]>=0)&&($b[i][1]>=0)&&($c[i]==1)
            take_texture($b[i],2-j,k)
            @blocb.blt((k%2)*16,((k-(k%2))/2)*16, @secondary_bitmap, @rect2)
          end
        end
        @bloc0.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 0
        @bloc1.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 1
        @bloc2.blt((i%9)*32,((i-(i%9))/9)*32,@blocb,@rect2) if j == 2
      end
      $game_map.events_xy_nt((i%9)-4+$game_player.x,((i-(i%9))/9)-4+$game_player.y).any? do |event|
        @blocb = Bitmap.new(32,32)
        @rect_event = Rect.new(0,0,32,32)
        take_graphic_event(event)
        rect = Rect.new(0,0,@blocb.width,@blocb.height)
        @bloc3.blt((i%9)*32-(@blocb.width-32)/2,((i-(i%9))/9)*32-(@blocb.height-32),@blocb,rect)
      end
    end
  end
 
  def create_bloc_bitmap_event
    for i in 0..80
      $game_map.events_xy_nt((i%9)-4+$game_player.x,((i-(i%9))/9)-4+$game_player.y).any? do |event|
        @blocb = Bitmap.new(32,32)
        @rect_event = Rect.new(0,0,32,32)
        take_graphic_event(event)
        rect = Rect.new(0,0,@blocb.width,@blocb.height)
        @bloc3.blt((i%9)*32-(@blocb.width-32)/2,((i-(i%9))/9)*32-(@blocb.height-32),@blocb,rect)
      end
    end
  end
 
  def take_texture(coord_map,couche,angle_square)
    create_auto_tile_table(coord_map[0],coord_map[1])
    @value_table = nil
    @secondary_bitmap = Bitmap.new(16,16)
    @value_table = $game_etage.tile_test(@table_tile[couche]) if  (@table_tile[couche] != 0)#&&(couche != 0)
    take_angle(@value_table[0],@value_table[1][0],@value_table[1][1],angle_square) if @value_table != nil
  end
 
  def take_angle(tile,id,type,angle)
    x = nil
    y = nil
    if tile >= 4 #Tile basic B,C,D,E,A5 MARCHE !!!
      x = (id % 8)*32 + (angle % 2)*16 +(8*32)*((id/128).floor)
      y = ((id - (id % 8))/8)*32 + ((angle-(angle % 2))/2)*16 -(16*32)*((id/128).floor)
    elsif tile == 0  #auto tile A1
      auto_tile_A1(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif tile == 1  #auto tile A2  MARCHE !!!
      auto_tile_A2(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif  tile == 2 #mur toit A3    MARCHE !!!
      auto_tile_A3(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    elsif  tile == 3 #mur toit A4 avec auto tile  MARCHE !!!
      auto_tile_A4(tile,id,type,angle)
      x = @xy[0]
      y = @xy[1]
    end
    @bitmap_stockage = Cache.tileset(@tiles_list[tile])
    x = 0 if x == nil
    y = 0 if y == nil
    @rect = Rect.new(x,y,16,16)
    @secondary_bitmap = Bitmap.new(16,16)
    @secondary_bitmap.blt(0,0, @bitmap_stockage, @rect)
  end
 
  def create_auto_tile_table(x,y)
    @table_tile = $game_map.all_tiles(x,y)
  end
 
  ##############################################################################
  def auto_tile_A1(tile,id,type,angle)
    x_sous_tile = (id % 8) * 64
    y_sous_tile = ((id-(id%8))/8)*96
    if angle == 0
      if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile
      elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+64
      elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
      if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile
      elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+64
      elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile
      end
    elsif angle == 2
      if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+48
      elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+64+16
      elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+16
      end
    elsif angle == 3
        if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+64+16
      elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile+16
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A2(tile,id,type,angle)
    x_sous_tile = (id % 8) * 64
    y_sous_tile = ((id-(id%8))/8)*96
    if angle == 0
      if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile
      elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+64
      elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
      if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile
      elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+64
      elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+64
      elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile
      end
    elsif angle == 2
      if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+48
        elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+64+16
      elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+16
      end
    elsif angle == 3
      if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+48
      elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+64+16
      elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+16
        y = y_sous_tile+16
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A3(tile,id,type,angle)
    x_sous_tile = (id % 8) * 64
    y_sous_tile = ((id-(id % 8))/8) * 64
    if angle == 0
      if [0,4,8,12].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+32
      elsif  [1,9,5,13].include?(type)#barre verticale haut gauche
        x = x_sous_tile
        y = y_sous_tile+32
      elsif  [2,6,10,14].include?(type)#barre horizontal haut gauche
        x = x_sous_tile+32
        y = y_sous_tile
      elsif  [3,7,11,15].include?(type)#angle haut gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile
      end
    elsif angle == 1
      if [0,1,8,9].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+32
      elsif  [4,12,5,13].include?(type)#barre verticale haut droit
        x = x_sous_tile+48
        y = y_sous_tile+32
      elsif  [2,3,11,10].include?(type)#barre horizontal haut droit
        x = x_sous_tile+16
        y = y_sous_tile
      elsif  [6,14,7,15].include?(type)#angle haut droit vers l'interieur
        x = x_sous_tile+48
        y = y_sous_tile
      end
    elsif angle == 2
      if [0,2,4,6].include?(type)#rien
        x = x_sous_tile+32
        y = y_sous_tile+16
      elsif  [1,3,5,7].include?(type)#barre verticale bas gauche
        x = x_sous_tile
        y = y_sous_tile+16
      elsif  [8,12,14,10].include?(type)#barre horizontal bas gauche
        x = x_sous_tile+32
        y = y_sous_tile+48
      elsif  [9,11,13,15].include?(type)#angle bas gauche vers l'interieur
        x = x_sous_tile
        y = y_sous_tile+48
      end
    elsif angle == 3
      if [3,2,1,0].include?(type)#rien
        x = x_sous_tile+16
        y = y_sous_tile+16
      elsif  [6,4,7,5].include?(type)#barre verticale bas droit
        x = x_sous_tile+48
        y = y_sous_tile+16
      elsif  [9,8,11,10].include?(type)#barre horizontal bas droit
        x = x_sous_tile+16
        y = y_sous_tile+48
      elsif  [12,14,13,15].include?(type)#angle bas droit vers l'interieur
        x = x_sous_tile+48
        y = y_sous_tile+48
      end
    end
    @xy = [x,y]
  end
  ##############################################################################
  def auto_tile_A4(tile,id,type,angle)
    x_sous_tile = (id % 8) * 64
    y2 = ((id-(id % 8))/8)
    y_sous_tile = ((y2-(y2%2))/2)*64 + ((y2+(y2%2))/2)*96
    if ( y2 % 2 ) == 1
      if angle == 0
        if [0,4,8,12].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+32
        elsif  [1,9,5,13].include?(type)#barre verticale haut gauche
          x = x_sous_tile
          y = y_sous_tile+32
        elsif  [2,6,10,14].include?(type)#barre horizontal haut gauche
          x = x_sous_tile+32
          y = y_sous_tile
        elsif  [3,7,11,15].include?(type)#angle haut gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile
        end
      elsif angle == 1
        if [0,1,8,9].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+32
        elsif  [4,12,5,13].include?(type)#barre verticale haut droit
          x = x_sous_tile+48
          y = y_sous_tile+32
        elsif  [2,3,11,10].include?(type)#barre horizontal haut droit
          x = x_sous_tile+16
          y = y_sous_tile
        elsif  [6,14,7,15].include?(type)#angle haut droit vers l'interieur
          x = x_sous_tile+48
          y = y_sous_tile
        end
      elsif angle == 2
        if [0,2,4,6].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+16
        elsif  [1,3,5,7].include?(type)#barre verticale bas gauche
          x = x_sous_tile
          y = y_sous_tile+16
        elsif  [8,12,14,10].include?(type)#barre horizontal bas gauche
          x = x_sous_tile+32
          y = y_sous_tile+48
        elsif  [9,11,13,15].include?(type)#angle bas gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile+48
        end
      elsif angle == 3
        if [3,2,1,0].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+16
        elsif  [6,4,7,5].include?(type)#barre verticale bas droit
          x = x_sous_tile+48
          y = y_sous_tile+16
        elsif  [9,8,11,10].include?(type)#barre horizontal bas droit
          x = x_sous_tile+16
          y = y_sous_tile+48
        elsif  [12,14,13,15].include?(type)#angle bas droit vers l'interieur
          x = x_sous_tile+48
          y = y_sous_tile+48
        end
      end
    else
      if angle == 0
        if [1,3,5,7,9,11,13,15,26,27,29,31,39].include?(type)#angle haut gauche vers l'exterieur
          x = x_sous_tile+32
          y = y_sous_tile
        elsif [0,2,4,6,8,10,12,14,24,25,28,30,38].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+64
        elsif  [16,17,18,19,32,40,41,44].include?(type)#barre verticale haut gauche
          x = x_sous_tile
          y = y_sous_tile+64
        elsif  [20,21,22,23,33,36,37,45].include?(type)#barre horizontal haut gauche
          x = x_sous_tile+32
          y = y_sous_tile+32
        elsif  [34,35,42,43,46].include?(type)#angle haut gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile
        end
      elsif angle == 1
        if [2,3,6,7,10,11,14,15,17,19,30,31,41].include?(type)#angle haut droit vers l'exterieur
          x = x_sous_tile+48
          y = y_sous_tile
        elsif [0,1,4,5,8,9,12,13,16,18,28,29,40].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+64
        elsif  [24,25,26,27,32,38,39,44].include?(type)#barre verticale haut droit
          x = x_sous_tile+48
          y = y_sous_tile+64
        elsif  [20,21,22,23,33,34,35,43].include?(type)#barre horizontal haut droit
          x = x_sous_tile+16
          y = y_sous_tile+32
        elsif  [36,37,42,45,46].include?(type)#angle haut droit vers l'interieur
          x = x_sous_tile+16
          y = y_sous_tile
        end
      elsif angle == 2
        if [8,9,10,11,12,13,14,15,22,23,25,27,37].include?(type)#angle bas gauche vers l'exterieur
          x = x_sous_tile+32
          y = y_sous_tile+16
        elsif [0,1,2,3,4,5,6,7,20,21,24,26,36].include?(type)#rien
          x = x_sous_tile+32
          y = y_sous_tile+48
        elsif  [16,17,18,19,32,34,35,42].include?(type)#barre verticale bas gauche
          x = x_sous_tile
          y = y_sous_tile+48
        elsif  [28,29,30,31,33,38,39,45].include?(type)#barre horizontal bas gauche
          x = x_sous_tile+32
          y = y_sous_tile+64+16
        elsif  [40,41,43,44,46].include?(type)#angle bas gauche vers l'interieur
          x = x_sous_tile
          y = y_sous_tile+16
        end
      elsif angle == 3
        if [4,5,6,7,12,13,14,15,18,19,21,23,35].include?(type)#angle bas droit vers l'exterieur
          x = x_sous_tile+48
          y = y_sous_tile+16
        elsif [0,1,2,3,8,9,10,11,16,17,20,22,34].include?(type)#rien
          x = x_sous_tile+16
          y = y_sous_tile+48
        elsif  [24,25,26,27,32,36,37,42].include?(type)#barre verticale bas droit
          x = x_sous_tile+48
          y = y_sous_tile+48
        elsif  [28,29,30,31,33,40,41,43].include?(type)#barre horizontal bas droit
          x = x_sous_tile+16
          y = y_sous_tile+64+16
        elsif  [38,39,44,45,46].include?(type)#angle bas droit vers l'interieur
          x = x_sous_tile+16
          y = y_sous_tile+16
        end
      end
    end
    @xy = [x,y]
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Réinitialization de l'image de l'étage au changement de map                ║
#╚═════════════════════════════════════════════════════════════════════════════╝
class Scene_Map < Scene_Base
  alias start_etage start
  def start
    start_etage
    $game_etage.initialize_map
  end
end
#╔═════════════════════════════════════════════════════════════════════════════╗
#║  Ajout de la class principale au démarrage                                  ║
#╚═════════════════════════════════════════════════════════════════════════════╝
module DataManager
  class << self
    alias :create_game_objects_etage :create_game_objects
    def create_game_objects
      create_game_objects_etage
      $game_etage      = Game_Etage.new
    end
  end
end
Spytje
Spytje
Administrateur

Nombre de messages : 5935
Localisation : La terre
Distinction : Spiraliste [Korn']
Forestia : Projet du mois juillet 2014
Papy Pulkigrat [Yama']
Date d'inscription : 16/03/2008

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 26 Fév 2014 - 21:40
Merci Vincent, désolé je n'ai pas encore eu le temps de vraiment tester mais je vais le faire Smile
MrPsit
MrPsit
Membre

Nombre de messages : 29
Age : 28
Localisation : Auvergne
Distinction : aucune
Date d'inscription : 26/02/2014

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 5 Mar 2014 - 14:16
Bonjour/Bonsoir Vincent,
Sur tes bons conseils je me suis décidé à utiliser ton script pour mon histoire d'arche. Je l'ai donc appliqué uniquement sur les arches et cela fonctionne parfaitement ! Un grand merci à toi !
Aucun problème ni rien. Fabuleux.
Je continue donc de mapper un peu, et lorsque j'ai voulu retester, tout marche, MAIS lorsque j'appuie sur "Esc" deux fois (ouvrir le menu puis le fermer) j'obtiens ceci :

Bug ?:

Voilà, je ne sais pas trop ce que j'ai pu faire pour provoquer ceci, je continue de chercher mais je tenais tout de même à te faire parvenir ce petit souci, au cas où...

Merci encore pour ce formidable script quoi qu'il en soit !
Je te souhaite une bonne continuation !
vincent26
vincent26
Membre

Nombre de messages : 766
Age : 28
Localisation : baume de transit le village paumé
Distinction : aucune
Date d'inscription : 17/08/2010

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 5 Mar 2014 - 17:09
Merci ça me fait plaisir qu'il serve ^^ je vais corriger le bug dès que possible je crois savoir d'on cela provient

EDIT : Script modifier dans les messages précedent Wink
MrPsit
MrPsit
Membre

Nombre de messages : 29
Age : 28
Localisation : Auvergne
Distinction : aucune
Date d'inscription : 26/02/2014

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

Mer 5 Mar 2014 - 18:29
Juste par curiosité, histoire de mieux comprendre ce que j'utilise (et puis j'essaye de me former aux scripts depuis peu), qu'est-ce qui provoquait une erreur ?

Merci beaucoup en tout cas pour cette réponse rapide !
Contenu sponsorisé

[VXAce]Script d'étage Empty Re: [VXAce]Script d'étage

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