RPG Creator : créez votre MMORPG ou RPG sans aucune connaissance en programmation


Disponible le 4 Juin !




- Jouez à votre jeu sur tablettes tactiles, Smartphones et navigateurs Web
- Personnalisez vos menus
- Dessinez facilement et rapidement vos cartes
- Créez des actions pour le combat A-RPG


www.rpgcreator.net


Heures au format UTC + 1 heure [ Heure d’été ]


Règles du forum


Consultez la liste des Scripts : cliquez ici



Publier un nouveau sujet Répondre au sujet  [ 11 messages ]  Aller à la page 1, 2  Suivant
Auteur Message
 Sujet du message: Trier les objets par onglet
MessagePublié: 18 Nov 2009, 20:17 
Ancien membre du staff
Ancien membre du staff
Avatar de l’utilisateur

Inscrit le: 16 Avr 2007, 00:00
Messages: 174
Logiciel(s) préféré(s): RPGMaker XP
Points d'aide: 21/60

Créations :

- Trier les objets par onglet

- Alone

- Icone dans le menu


Voir ses créations

Bonsoir,

je vous propose un script permettant de trier les objets par onglets (on peut en faire autant qu'on veux mais attention à l'affichage qui deviendra surchargé), la méthode pour les trier peut être un peu longue.
A la base je voulais le garder exclusivement pour mon projet, mais comme personne y jouera, il servira peut être à vous...

Image


● Mode d'emploi :
1) Pour créer un onglet il faudra créer un nouvel élément dans la base de donnée contenant le symbole $ et portant le nom de l'onglet
Exemple : Créer l'élément "$Objet" ou encore "$Trésor"
Image

2) Ensuite tout les objets, armes ou armures devant s'afficher dans cet onglet, devra avoir l'élément crée de coché
Image

3) Seul les objets utilisables seront affichés en combat
4) Si aucun élément n'est coché l'objet sera affiché en combat uniquement
5) Si vous voulez trier les objets dans le magasin, prenez le script en 5ème post de cette page
Code: Tout sélectionner
#==============================================================================
# Objets trié par onglets
#----------------------------------
# Script de Sunabozu
# Ce script permet de trier les objets par onglet.
# Merci de ne pas distribuer ce script sans ma permission.
# Si vous avez un probleme, contactez moi sur RPG Creative.
#------------------------------------------------------------------------------
# ● Mode d'emploi :
# ● 1) Pour créer un onglet il faudra créer un nouvel élément dans la base de donnée
# contenant le symbole $ et portant le nom de l'onglet
# Exemple : Créer l'élément "$Objet" ou encore "$Trésor"
# ● 2) Ensuite tout les objets, armes ou armures devant s'afficher dans cet
# onglet devra avoir l'élément crée de coché
# ● 3) Seul les objets consommables seront affichés en combat
# ● 4) Si aucun élément n'est coché l'objet sera affiché en combat uniquement
#========================================================================
# class Window_Command_Item
# affiche les onglets
#========================================================================
class Window_Command_Item < Window_Selectable
 
  #----------------------------------------------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
   
    # initialisation des tableaux
    @commands = []             # nom des onglets
    @commands_id = []        # id de l'attribut
   
    for i in 0...$data_system.elements.size
      # clonage d'une case du tableau contenant les éléments
      tableau_element = $data_system.elements[i].clone
      # si le mot contient la lettre $
      if tableau_element.include?("$")
        # on remplace $ par rien (on supprime)
        tableau_element["$"] = ""
        # ajout de l'element sans le $ au tableau
        @commands[i] = tableau_element
        # ajout de l'id de l'element dans le tableau
        @commands_id[i] = i
      end     
    end
    # compactage des tableaux (supression espace vide)
    @commands.compact!
    @commands_id.compact!
   
    @item_max = @commands.size
    @column_max = @commands.size
   
    refresh
    self.index = 0
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def draw_item(index)
    x = 4 + index * ((640)/@item_max)
    w = self.width / @column_max - 32
    self.contents.draw_text(x, 0, w-4, 32, @commands[index])
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def commands
    return @commands
  end
  #----------------------------------------------------------------------------------------------------------------
  def commands_id
    return @commands_id
  end
end

#========================================================================
# class Window_Item
# affiche les objets
#========================================================================
class Window_Item < Window_Selectable
 
  #----------------------------------------------------------------------------------------------------------------
  def initialize(id=0)
    super(0, 128, 640, 352)
    @column_max = 2
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
    refresh(id)
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def refresh(id=0)
    #-----------------------------------------------------------
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
   
    @data = []
    for i in 1...$data_items.size
      if ($game_party.item_number(i) > 0 and $data_items[i].element_set.include?(id)) or
        ($game_party.item_number(i) > 0 and $game_temp.in_battle)
        @data.push($data_items[i])
      end
    end
   
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0 and $data_weapons[i].element_set.include?(id)
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0 and $data_armors[i].guard_element_set.include?(id)
          @data.push($data_armors[i])
        end
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end

end # class end



#========================================================================
# class Scene_Item
#========================================================================
class Scene_Item
 
  #----------------------------------------------------------------------------------------------------------------
  def main
    #-----------------------------------------------------------
    @help_window = Window_Help.new
    @command_window = Window_Command_Item.new
    @item_window = Window_Item.new(@command_window.commands_id[@command_window.index])
    @item_window.help_window = @help_window
    @help_window.set_text("")
    @target_window = Window_Target.new
    #-----------------------------------------------------------
    @command_window.active = true
    @command_window.visible = true
    @item_window.active = false
    @target_window.visible = false
    @target_window.active = false
    #-----------------------------------------------------------
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    #-----------------------------------------------------------
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
    @command_window.dispose
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def update
    #-----------------------------------------------------------
    @item_window.update
    @target_window.update
    @command_window.update
    #-----------------------------------------------------------
    if @item_window.active
      update_item
      return
    end
    #-----------------------------------------------------------
    if @target_window.active
      update_target
      return
    end
    #-----------------------------------------------------------
    if @command_window.active
      update_command
      return
    end
  end
 
  #----------------------------------------------------------------------------------------------------------------
  def update_item
    #-----------------------------------------------------------
    @help_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @command_window.visible = true
      @item_window.active = false
      @item_window.index = 0
      @help_window.set_text("")
      return
    end
    #-----------------------------------------------------------
    if Input.trigger?(Input::C)
      @item = @item_window.item
      unless @item.is_a?(RPG::Item)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      unless $game_party.item_can_use?(@item.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      if @item.scope >= 3
        @item_window.active = false
        @target_window.x = (@item_window.index + 1) % 2 * 304
        @target_window.visible = true
        @target_window.active = true
        if @item.scope == 4 || @item.scope == 6
          @target_window.index = -1
        else
          @target_window.index = 0
        end
      else
        if @item.common_event_id > 0
          $game_temp.common_event_id = @item.common_event_id
          $game_system.se_play(@item.menu_se)
    #-----------------------------------------------------------
          if @item.consumable
            $game_party.lose_item(@item.id, 1)
            @item_window.draw_item(@item_window.index)
          end
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
 
  #----------------------------------------------------------------------------------------------------------------
    def update_command
      if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
       @item_window.refresh(@command_window.commands_id[@command_window.index])
     end
     #-----------------------------------------------------------
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       $scene = Scene_Menu.new(0)
       return
     end
     #-----------------------------------------------------------
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       @item_window.active = true
       @command_window.active = false
       return
     end
   end

#----------------------------------------------------------------------------------------------------------------
   def update_target
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # If unable to use because items ran out
      unless $game_party.item_can_use?(@item.id)
        # Remake item window contents
        @item_window.refresh(@command_window.commands_id[@command_window.index])
     end
      # Erase target window
      @item_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If items are used up
      if $game_party.item_number(@item.id) == 0
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If target is all
      if @target_window.index == -1
        # Apply item effects to entire party
        used = false
        for i in $game_party.actors
          used |= i.item_effect(@item)
        end
      end
      # If single target
      if @target_window.index >= 0
        # Apply item use effects to target actor
        target = $game_party.actors[@target_window.index]
        used = target.item_effect(@item)
      end
      # If an item was used
      if used
        # Play item use SE
        $game_system.se_play(@item.menu_se)
        # If consumable
        if @item.consumable
          # Decrease used items by 1
          $game_party.lose_item(@item.id, 1)
          # Redraw item window item
          @item_window.draw_item(@item_window.index)
        end
        # Remake target window contents
        @target_window.refresh
        # If all party members are dead
        if $game_party.all_dead?
          # Switch to game over screen
          $scene = Scene_Gameover.new
          return
        end
        # If common event ID is valid
        if @item.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      # If item wasn't used
      unless used
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
#########    FIN DE CLASSE    ########################################
end


Dernière édition par Sunabozu le 14 Jan 2010, 20:41, édité 4 fois au total.

Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 19 Nov 2009, 16:00 
Garde
Garde
Avatar de l’utilisateur

Inscrit le: 26 Sep 2006, 00:00
Messages: 1973
Points d'aide: Illimité

Créations :

Voir ses créations

Juste une question : un objet avec aucune catégorie d'assignée ne s'affichera pas ?

Sinon merci du script, je le reprendrai probablement pour mon projet.

_________________
Image
Image


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 19 Nov 2009, 20:08 
Ancien membre du staff
Ancien membre du staff
Avatar de l’utilisateur

Inscrit le: 16 Avr 2007, 00:00
Messages: 174
Logiciel(s) préféré(s): RPGMaker XP
Points d'aide: 21/60

Créations :

- Trier les objets par onglet

- Alone

- Icone dans le menu


Voir ses créations

Si aucun élément n'est coché l'objet sera affiché en combat uniquement, j'avais oublié de le préciser, merci.
Il faut donc assigné tout les objets c'est mieux(mais un peu long)


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 06 Déc 2009, 16:25 
Artisan (Nv 2)

Inscrit le: 08 Aoû 2008, 00:00
Messages: 137
Points d'aide: 0/60

Créations :

Voir ses créations

ça a l'air sympa et très utile ^^

et j'ai aussi juste une question : c'est prit en compte avec les marchands ?

_________________
Forum de mon projet "Chasseur de reliques."
http://cdr-forum.darkbb.com
Enjoy ! :)


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 06 Déc 2009, 18:10 
Ancien membre du staff
Ancien membre du staff
Avatar de l’utilisateur

Inscrit le: 16 Avr 2007, 00:00
Messages: 174
Logiciel(s) préféré(s): RPGMaker XP
Points d'aide: 21/60

Créations :

- Trier les objets par onglet

- Alone

- Icone dans le menu


Voir ses créations

Voici le script pour avoir les objets du magasin trié par onglet:
Code: Tout sélectionner
#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
#  This window displays buyable goods on the shop screen.
#==============================================================================

class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     shop_goods : goods
  #--------------------------------------------------------------------------
  def initialize(shop_goods, id=0)
    super(0, 192, 368, 288)
    @shop_goods = shop_goods
    refresh(id)
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Item Acquisition
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(id=0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        if $data_items[goods_item[1]].element_set.include?(id)
          item = $data_items[goods_item[1]]
        end
      when 1
        if $data_weapons[goods_item[1]].element_set.include?(id)
          item = $data_weapons[goods_item[1]]
        end
      when 2
        if $data_armors[goods_item[1]].guard_element_set.include?(id)
          item = $data_armors[goods_item[1]]
        end
      end
      if item != nil
        @data.push(item)
      end
      item = nil
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    # Get items in possession
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    # If price is less than money in possession, and amount in possession is
    # not 99, then set to normal text color. Otherwise set to disabled color
    if item.price <= $game_party.gold and number < 99
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

Code: Tout sélectionner
#==============================================================================
# ** Window_ShopSell
#------------------------------------------------------------------------------
#  This window displays items in possession for selling on the shop screen.
#==============================================================================

class Window_ShopSell < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(id=0)
    super(0, 192, 640, 288)
    @column_max = 2
    refresh(id)
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Getting Items
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(id=0)
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0 and $data_items[i].element_set.include?(id)
        @data.push($data_items[i])
      end
    end
    for i in 1...$data_weapons.size
      if $game_party.weapon_number(i) > 0 and $data_weapons[i].element_set.include?(id)
        @data.push($data_weapons[i])
      end
    end
    for i in 1...$data_armors.size
      if $game_party.armor_number(i) > 0 and $data_armors[i].guard_element_set.include?(id)
        @data.push($data_armors[i])
      end
    end
    # If item count is not 0, make a bitmap and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    when RPG::Armor
      number = $game_party.armor_number(item.id)
    end
    # If items are sellable, set to valid text color. If not, set to invalid
    # text color.
    if item.price > 0
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

Code: Tout sélectionner
#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window
    @help_window = Window_Help.new
    # Make tab window
    @tab_window = Window_Command_Item.new
    @tab_window.y = 128
    @tab_window.active = false
    # Make command window
    @command_window = Window_ShopCommand.new
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 64
    # Make dummy window
    @dummy_window = Window_Base.new(0, 192, 640, 288)
    # Make buy window
    @buy_window = Window_ShopBuy.new($game_temp.shop_goods, @tab_window.commands_id[@tab_window.index])
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    # Make sell window
    @sell_window = Window_ShopSell.new
    @sell_window.active = false
    @sell_window.visible = false
    @sell_window.help_window = @help_window
    # Make quantity input window
    @number_window = Window_ShopNumber.new
    @number_window.active = false
    @number_window.visible = false
    # Make status window
    @status_window = Window_ShopStatus.new
    @status_window.visible = false
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @command_window.dispose
    @tab_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @buy_window.dispose
    @sell_window.dispose
    @number_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    @command_window.update
    @tab_window.update
    @gold_window.update
    @dummy_window.update
    @buy_window.update
    @sell_window.update
    @number_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    #
    if @tab_window.active
      update_tab
      return
    end
    # If buy window is active: call update_buy
    if @buy_window.active
      update_buy
      return
    end
    # If sell window is active: call update_sell
    if @sell_window.active
      update_sell
      return
    end
    # If quantity input window is active: call update_number
    if @number_window.active
      update_number
      return
    end   
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # buy
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Change windows to buy mode
        @command_window.active = false
        @tab_window.active = true
      when 1  # sell
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Change windows to sell mode
        @command_window.active = false
        @tab_window.active = true
      when 2  # quit
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to map screen
        $scene = Scene_Map.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when tab window is active)
  #--------------------------------------------------------------------------
  def update_tab
    if Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
      case @command_window.index
      when 0 then @buy_window.refresh(@tab_window.commands_id[@tab_window.index])
      when 1 then @sell_window.refresh(@tab_window.commands_id[@tab_window.index])
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Change windows to initial mode
      @tab_window.index = 0
      @command_window.active = true
      @dummy_window.visible = true
      @tab_window.active = false
      @status_window.visible = false
      @status_window.item = nil
      # Erase help text
      @help_window.set_text("")
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # buy
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Change windows to buy mode
        @dummy_window.visible = false
        @tab_window.active = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh(@tab_window.commands_id[@tab_window.index])
        @status_window.visible = true
      when 1  # sell
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Change windows to sell mode
        @dummy_window.visible = false
        @tab_window.active = false
        @sell_window.active = true
        @sell_window.visible = true
        @sell_window.refresh(@tab_window.commands_id[@tab_window.index])
      when 2  # quit
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to map screen
        $scene = Scene_Map.new
      end
      return
    end
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update (when buy window is active)
  #--------------------------------------------------------------------------
  def update_buy
    # Set status window item
    @status_window.item = @buy_window.item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Change windows to initial mode
      @tab_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      # Erase help text
      @help_window.set_text("")
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get item
      @item = @buy_window.item
      # If item is invalid, or price is higher than money possessed
      if @item == nil or @item.price > $game_party.gold
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Get items in possession count
      case @item
      when RPG::Item
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      # If 99 items are already in possession
      if number == 99
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Calculate maximum amount possible to buy
      max = @item.price == 0 ? 99 : $game_party.gold / @item.price
      max = [max, 99 - number].min
      # Change windows to quantity input mode
      @buy_window.active = false
      @buy_window.visible = false
      @number_window.set(@item, max, @item.price)
      @number_window.active = true
      @number_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when sell window is active)
  #--------------------------------------------------------------------------
  def update_sell
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Change windows to initial mode
      @tab_window.active = true
      @dummy_window.visible = true
      @sell_window.active = false
      @sell_window.visible = false
      @status_window.item = nil
      # Erase help text
      @help_window.set_text("")
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get item
      @item = @sell_window.item
      # Set status window item
      @status_window.item = @item
      # If item is invalid, or item price is 0 (unable to sell)
      if @item == nil or @item.price == 0
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Get items in possession count
      case @item
      when RPG::Item
        number = $game_party.item_number(@item.id)
      when RPG::Weapon
        number = $game_party.weapon_number(@item.id)
      when RPG::Armor
        number = $game_party.armor_number(@item.id)
      end
      # Maximum quanitity to sell = number of items in possession
      max = number
      # Change windows to quantity input mode
      @sell_window.active = false
      @sell_window.visible = false
      @number_window.set(@item, max, @item.price / 2)
      @number_window.active = true
      @number_window.visible = true
      @status_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when quantity input window is active)
  #--------------------------------------------------------------------------
  def update_number
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      # Branch by command window cursor position
      case @command_window.index
      when 0  # buy
        # Change windows to buy mode
        @buy_window.active = true
        @buy_window.visible = true
      when 1  # sell
        # Change windows to sell mode
        @sell_window.active = true
        @sell_window.visible = true
        @status_window.visible = false
      end
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play shop SE
      $game_system.se_play($data_system.shop_se)
      # Set quantity input window to inactive / invisible
      @number_window.active = false
      @number_window.visible = false
      # Branch by command window cursor position
      case @command_window.index
      when 0  # buy
        # Buy process
        $game_party.lose_gold(@number_window.number * @item.price)
        case @item
        when RPG::Item
          $game_party.gain_item(@item.id, @number_window.number)
        when RPG::Weapon
          $game_party.gain_weapon(@item.id, @number_window.number)
        when RPG::Armor
          $game_party.gain_armor(@item.id, @number_window.number)
        end
        # Refresh each window
        @gold_window.refresh
        @buy_window.refresh
        @status_window.refresh
        # Change windows to buy mode
        @buy_window.active = true
        @buy_window.visible = true
      when 1  # sell
        # Sell process
        $game_party.gain_gold(@number_window.number * (@item.price / 2))
        case @item
        when RPG::Item
          $game_party.lose_item(@item.id, @number_window.number)
        when RPG::Weapon
          $game_party.lose_weapon(@item.id, @number_window.number)
        when RPG::Armor
          $game_party.lose_armor(@item.id, @number_window.number)
        end
        # Refresh each window
        @gold_window.refresh
        @sell_window.refresh(@tab_window.commands_id[@tab_window.index])
        @status_window.refresh
        # Change windows to sell mode
        @sell_window.active = true
        @sell_window.visible = true
        @status_window.visible = false
      end
      return
    end
  end
end


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 14 Jan 2010, 19:51 
Villageois (Nv 2)
Avatar de l’utilisateur

Inscrit le: 08 Nov 2009, 09:46
Messages: 36
Niveau RPG Maker: Plutôt bon (ou pas)
Sexe: Masculin
Points d'aide: 0/60

Créations :

Voir ses créations

Super script, et très utile ! Je vais l'utiliser pour mon projet !
En plus, le systeme de rangement par atributs est vraiment pratique, un peu long mais je pense pas qu'on puisse faire plus simple (en tout cas c'est bien plus facile et rapide que de devoir modifier soi-même le script pour assigner chaque objet à sa catégorie :D )

J'y vois juste un petit problème : malheureusement il y à un bug...

Lorsqu'on utilise le dernier objet d'une catégorie (la dernierre potion par exemple), toutes les catégories disparaissent, et il faut faire échap (pour revenir à la fenètre du choix de type d'objet), aller sur un autre type d'objet puis revenir afin de les faire réapparaitre.

Autrement dit (parce que je suis pas sur d'être très clair) :

-Je suis dans la fenètre des "objets"
-J'utilise ma dernière potion
-La catégorie potion disparait de mon sac (normal, j'en ai plus)
-mais toutes les autres catégorie (super potion, remedes...) disparaissent aussi, et le curseur est bloqué dans "le vide"
-Je dois appuier sur "B" pour revenie à la fenètre de choix de type d'objet
-puis sur "droite" pour sélectioner "armures" par exemple
-et enfin revenir sur "objets" pour constater que les objets sont réaparus

Voila j'espére que ce sera facilement réparable...

Mais encore félicitation, à part ce détail, ce script est franchement super ! :D

_________________
Sex, drugs, and rock & roll... enlevez la drogue et vous aurez plus de temps pour les deux autres.
(Steven Tyler, d'Aerosmith)


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 14 Jan 2010, 20:50 
Ancien membre du staff
Ancien membre du staff
Avatar de l’utilisateur

Inscrit le: 16 Avr 2007, 00:00
Messages: 174
Logiciel(s) préféré(s): RPGMaker XP
Points d'aide: 21/60

Créations :

- Trier les objets par onglet

- Alone

- Icone dans le menu


Voir ses créations

Merci d'avoir signalé ce bug, j'ai pu le corriger dans le premier message, à vouloir raccourcir au maximum j'ai supprimé une partie qu'il fallait pas. Voilà, à + et bon making


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 15 Jan 2010, 20:11 
Villageois (Nv 2)
Avatar de l’utilisateur

Inscrit le: 08 Nov 2009, 09:46
Messages: 36
Niveau RPG Maker: Plutôt bon (ou pas)
Sexe: Masculin
Points d'aide: 0/60

Créations :

Voir ses créations

Ah bah voila qui est bien mieux !
Je vais pouvoir tout bien trier !

Merci pour cette correction !

_________________
Sex, drugs, and rock & roll... enlevez la drogue et vous aurez plus de temps pour les deux autres.
(Steven Tyler, d'Aerosmith)


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 25 Aoû 2010, 15:31 
Villageois (Nv 1)
Avatar de l’utilisateur

Inscrit le: 25 Aoû 2010, 15:14
Messages: 10
Points d'aide: 0/60

Créations :

Voir ses créations

Bonjour j'ai un petit probleme je n'arrive pas à faire fonctionner ce scritp, lorsque j'ouvre la fenetre pour aller aux onglet le jeu me marque ceci :

????? 'Window_Selectable ? 104 ??? ZeroDivisionError ????????

divided by 0

Quelq'un sait t'il ce que sa veut dire ? J'ai vraiment besoin de script :( aidez moi please !


Haut
 Profil  
 
 Sujet du message: Re: Trier les objets par onglet
MessagePublié: 26 Aoû 2010, 11:36 
Garde
Garde
Avatar de l’utilisateur

Inscrit le: 26 Sep 2006, 00:00
Messages: 1973
Points d'aide: Illimité

Créations :

Voir ses créations

Peut-être juste que tu as 0 objets/0 catégories ?

_________________
Image
Image


Haut
 Profil  
 
Afficher les messages depuis:  Trier par  
Publier un nouveau sujet Répondre au sujet  [ 11 messages ]  Aller à la page 1, 2  Suivant

Heures au format UTC + 1 heure [ Heure d’été ]


Qui est en ligne ?

Utilisateurs parcourant actuellement ce forum : Aucun utilisateur inscrit et 2 invités


Vous ne pouvez pas publier de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas insérer de pièces jointes dans ce forum

Rechercher pour:
Sauter vers:  
cron
RPG Creative Forum version 5 ; Tous droits réservés
phpBB Group (Traduit par Xaphos)
Optimisé pour une résolution 1024*728