AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  



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

Partagez
 

 Script pour magasin

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Silverwolf
Poulet carnivore Lv.2
Poulet carnivore Lv.2
Silverwolf


Inscrit le : 23/10/2010
Messages : 14

Script pour magasin Empty
MessageSujet: Script pour magasin   Script pour magasin Icon_minitimeDim 24 Oct 2010 - 20:18

Salut à toi scripteur

Oui oui, je parle à vous, celui qui pourrait régler mon problème. Mais pour le régler, d'abord il faut le présenté:

J'aimerais bien créer un magasin avec un marchand qui vend des armes, mais il est impossible dans les event (d'après ce que j'ai vu)

J'aimerais bien (si c'est possible) un menu avec toutes les armes disponible, leur coût et un système de validation (du genre "Voulez vraiment acheter cette article")

Si vous pouvez faire ceci mais aussi pour les compétence, vous serez gentil

Merci !
Revenir en haut Aller en bas
Randal
Voyageur Lv.10
Voyageur Lv.10
Randal


Masculin Age : 30
Inscrit le : 18/03/2009
Messages : 448

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeDim 24 Oct 2010 - 20:23

C'est pas l'onglet 3, l'option "Appeler un magasin..." ?
Revenir en haut Aller en bas
Xavioo
Corsaire Lv.19
Corsaire Lv.19
Xavioo


Masculin Age : 26
Inscrit le : 26/11/2009
Messages : 2508

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeDim 24 Oct 2010 - 20:38

Pour les compétences et l'autre ca se fait en event comme dit Randal
par contre je sais pas comment il fonctionne

Code:
#==============================================================================
# Skill Shop for RMVX Ver 3.1
#==============================================================================
#MediaFire Hosting# By Nechigawara Sanzenin
# WARNING!! : This script can use on RPG Maker VX Only!! (XP Not Support)
#==============================================================================
# Buy Skill Option For RMVX
#==============================================================================
#Version Log
#==============================================================================
#2.0 Add Level requirement - Change Hero Select Window
#3.0 Change How to set Price , Add wait Level Up option
#3.0 Fixed Bug, Edit Price Key Word
#==============================================================================
=begin

Comment l'utiliser:

Vous allez ajouter "$ skill_shop = [Id of Skill]"
Pour appel de script pour définir "id" de compétences pour les vendre.
Vous allez ajouter "$ scene = Scene_Skill_Shop.new"
To Call Shop Skill Windows.

Exemple:
skill_shop = $ [1,2,3,6,7]
scène $ = Scene_Skill_Shop.new

Vous pouvez activer l'option / off sous "# Setting".
Vous pouvez définir un texte à utiliser dans le magasin de compétences sous la rubrique «Apprendre # Texte".
Vous pouvez ajouter «[p-Prix-]" pour l'ensemble de compétences des prix à la note en compétences de base de données.
Exemple: Pour l'ensemble des prix à 150

[p150]

Vous pouvez définir des compétences que le combattant chaque personne peut apprendre sous "# Hero données".

Vous aurez la mise ressembler à cela dans Hero de données
[ID d'habileté, d'exigence de niveau pour apprendre]

Exemple: si vous voulez acteur id 1 peuvent apprendre des compétences id 1 à Lv 4
et je peux apprendre des compétences id 2 chez LV 3. Vous aurez la mise ressembler à ceci

1 => [code d'identification de Acteur
 
  [1,4], [2,3],
 
  ],

=end
#==============================================================================
#module SKILL_SHOP
#==============================================================================

module SKILL_SHOP
  # Setting
  Wait_Lv_Up = false # Wait 1 Lv up for use skill from buy
  Show_cha = true # Show Charactor Graphic in Select Window
 
  # Learn Text
  How_Learn = "À quel héros ?"
  Can_Learn = "Peut apprendre"
  Can_Learn_Lv = "Il faut le Niv."
  Cant_Learn = ""
  Learnt = "Appris"
  Teach = "Apprendre"
  Cancel = "Annuler"
  Next_Lv = "Prochain Niv."
  Can_use = "%s peut employer maintenant !"

  # Price Data For Non Set
  PRICE = 200
  # Hero Data
  SKILL_BUY = {
  # Add what skill can hero buy Here
  # [ID of skill,Level]
 
  1 => [ #Virginn
 
  [1,1],[2,4],[3,6,],[4,1],[128,1],
 
  ],
 
  2 => [ #Kiara
 
  [1,1],[2,4],[3,6,],[116,1],[128,1],
 
  ],
 
  5 => [ #Éqween
 
  [1,1],[2,4],[3,6,],[4,0],[33,10]
  ],
 
  7 => [ #Britany
 
  [1,1],[2,4],[3,6,],[4,0],[110,10]
 
  ],
 
  # End
  }
  # Add Price
  def self.skill_price(id)
    text = $data_skills[id].note
    text.scan(/\[p([0-9]+)\]/)
    if $1.to_i != 0 then
      price = $1.to_i
    else
      price = PRICE
    end
    return price
  end
  # Add Hero id
  def self.skill_buy(id)
    if SKILL_BUY.include?(id)
      return SKILL_BUY[id]
    else
      return []
    end
  end
end

#==============================================================================
#class Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  def setup(actor_id)
    actor = $data_actors[actor_id]
    @actor_id = actor_id
    @name = actor.name
    @character_name = actor.character_name
    @character_index = actor.character_index
    @face_name = actor.face_name
    @face_index = actor.face_index
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id



    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = @exp_list[@level]
    @skills = []
    @le_skills = []
    @le = []
    for i in self.class.learnings
      learn_skill(i.skill_id) if i.level <= @level
    end
    clear_extra_values
    recover_all
  end
  #--------------------------------------------------------------------------
  def le_skills
    result = []
    for i in @le_skills
      result.push($data_skills[i])
    end
    return result
  end
  #--------------------------------------------------------------------------
  def learn_le_skill(skill_id)
    unless skill_learn?($data_skills[skill_id])
      @le_skills.push(skill_id)
      @le_skills.sort!
    end
  end
  #--------------------------------------------------------------------------
  def forget_skill(skill_id)
    @skills.delete(skill_id)
    @le_skills.delete(skill_id)
  end
  #--------------------------------------------------------------------------
  def skill_learn?(skill)
    if @skills.include?(skill.id)
      return true
    elsif @le_skills.include?(skill.id)
      return true
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  def le_learn_skill(skill_id)
    unless @skills.include?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end
  #--------------------------------------------------------------------------
  def skill_can_use?(skill)
    return false if @le_skills.include?(skill.id)
    return false unless skill_learn?(skill)
    return super
  end
  #--------------------------------------------------------------------------
  def learn?(skill)
    learn = skill_learn?(skill)
    if learn == true
      return false
    else
      return true
    end
  end
  #--------------------------------------------------------------------------
  def le_skill?(skill)
    return @le_skills.include?(skill.id)
  end
  #--------------------------------------------------------------------------
  def display_level_up(new_skills)
    $game_message.new_page
    text = sprintf(Vocab::LevelUp, @name, Vocab::level, @level)
    $game_message.texts.push(text)
    for skill in new_skills
      unless @le.include?(skill.id)
        text = sprintf(Vocab::ObtainSkill, skill.name)
        $game_message.texts.push(text)
      end
    end
    for i in 0...@le.size
      id = @le[i]
      name = $data_skills[id].name
      text = sprintf(SKILL_SHOP::Can_use, name)
      $game_message.texts.push(text)
    end
    @le = []
  end
  #--------------------------------------------------------------------------
  alias inc_level_up level_up
  def level_up
    inc_level_up
    @le = []
    for i in 0...@le_skills.size
      id = @le_skills[i]
      le_learn_skill(id)
      @le.push(id)
    end
    @le_skills = []
  end
end

#==============================================================================
#class Window_Skill_ShopBuy
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for skill in @actor.skills
      @data.push(skill)
      if skill.id == @actor.last_skill_id
        self.index = @data.size - 1
      end
    end
    for skill in @actor.le_skills
      @data.push(skill)
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.skill_can_use?(skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      if @actor.le_skill?(skill)
        text = SKILL_SHOP::Next_Lv
      else
        text = @actor.calc_mp_cost(skill)
      end
      self.contents.draw_text(rect, text, 2)
    end
  end
end

#==============================================================================
#class Window_Skill_ShopBuy
#==============================================================================

class Window_Skill_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 304, 304)
    @skill_shop_goods = $skill_shop
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for i in 0...@skill_shop_goods.size
      skill = $data_skills[@skill_shop_goods[i]]
      if skill != nil
        @data.push(skill)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    price = SKILL_SHOP.skill_price(skill.id)
    enabled = (price <= $game_party.gold)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(skill, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, price, 2)
  end
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end

#==============================================================================
#class Window_Skill_ShopStatus
#==============================================================================

class Window_Skill_ShopStatus < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 240, 304)
    @item = nil
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    if @item != nil
      self.contents.font.color = system_color
      self.contents.draw_text(4, 0, 200, WLH, SKILL_SHOP::How_Learn)
      for actor in $game_party.members
        x = 4
        y = WLH * (2 + actor.index * 2)
        draw_actor_can_learn(actor, x, y)
      end
    end
  end
  #--------------------------------------------------------------------------
  def draw_actor_can_learn(actor, x, y)
    can = false
    lv = false
    ac_lv = 0
    can_learn = SKILL_SHOP.skill_buy(actor.id)
    id = @item.id
    for i in 0...can_learn.size
      if can_learn[i][0] == id
        can = true
        if can_learn[i][1] <= actor.level
          lv = true
        else
          lv = false
          ac_lv = can_learn[i][1]
        end
        break
      else
        can = false
      end
    end
    enabled = (can and lv and actor.learn?(@item))
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    if SKILL_SHOP::Show_cha
      name = actor.character_name
      index = actor.character_index
      size = contents.text_size(actor.name).width
      draw_character(name, index, x + 20 + size , y + 30)
    end
    self.contents.draw_text(x, y, 200, WLH, actor.name)
    if can == false
      text = SKILL_SHOP::Cant_Learn
    elsif can == true and lv == false
      ac = ac_lv.to_s
      text = SKILL_SHOP::Can_Learn_Lv + " " + ac + "+"
    elsif actor.learn?(@item) == false
      text = SKILL_SHOP::Learnt
    else
      text = SKILL_SHOP::Can_Learn
    end
    self.contents.draw_text(x, y, 200, WLH, text, 2)
  end
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0
      self.cursor_rect.empty
    elsif @index < @item_max
      y = WLH * (2 + @index * 2)
      unless SKILL_SHOP::Show_cha
        self.cursor_rect.set(0, y , contents.width, WLH)
      else
        self.cursor_rect.set(0, y - 4, contents.width,34)
      end
    end
  end
end

#==============================================================================
#class Scene_Skill_Shop
#==============================================================================

class Scene_Skill_Shop < Scene_Base
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @viewport = Viewport.new(0, 0, 544, 416)
    @help_window = Window_Help.new
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @buy_window = Window_Skill_ShopBuy.new(0, 112)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    @status_window = Window_Skill_ShopStatus.new(304, 112)
    @status_window.visible = false
    @status_window.active = false
  end
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
    @help_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @buy_window.dispose
    @status_window.dispose
  end 
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @buy_window.update
    @status_window.update
    if @command_window.active
      update_command_selection
    elsif @buy_window.active
      update_buy_selection
    elsif @status_window.active
      update_target_selection
    end
  end
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = SKILL_SHOP::Teach
    s2 = SKILL_SHOP::Cancel
    @command_window = Window_Command.new(384, [s1, s2], 2)
    @command_window.y = 56
  end
  #--------------------------------------------------------------------------
  def dispose_command_window
    @command_window.dispose
  end
  #--------------------------------------------------------------------------
  def update_command_selection
    @help_window.set_text("")
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0
        Sound.play_decision
        @command_window.active = false
        @dummy_window.visible = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh
        @status_window.visible = true
      when 1
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_buy_selection
    @status_window.item = @buy_window.skill
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.skill
      @price = SKILL_SHOP.skill_price(@item.id)
      enabled = (@price <= $game_party.gold)
      if not enabled
        Sound.play_buzzer
      else
        Sound.play_decision
        show_target_window
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_target_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      hide_target_window
    elsif Input.trigger?(Input::C)
      @actor = $game_party.members[@status_window.index]
      can = false
      lv = false
      can_learn = SKILL_SHOP.skill_buy(@actor.id)
      id = @item.id
      for i in 0...can_learn.size
        if can_learn[i][0] == id
          can = true
          if can_learn[i][1] <= @actor.level
            lv = true
          else
            lv = false
          end
          break
        else
          can = false
        end
      end
      enabled = (can and lv and @actor.learn?(@item))
      if not enabled
        Sound.play_buzzer
      else
        learn_target(@item.id)
      end
    end
  end
  #--------------------------------------------------------------------------
  def learn_target(skill_id)
    Sound.play_shop
    unless SKILL_SHOP::Wait_Lv_Up
      @actor.learn_skill(skill_id)
    else
      @actor.learn_le_skill(skill_id)
    end
    $game_party.lose_gold(@price)
    @buy_window.refresh
    @gold_window.refresh
    @status_window.refresh
    hide_target_window
  end
  #--------------------------------------------------------------------------
  def show_target_window
    @buy_window.active = false
    @status_window.active = true
    @status_window.index = 0
  end
  #--------------------------------------------------------------------------
  def hide_target_window
    @buy_window.active = true
    @status_window.active = false
    @status_window.index =- 1
  end
end
Revenir en haut Aller en bas
Silverwolf
Poulet carnivore Lv.2
Poulet carnivore Lv.2
Silverwolf


Inscrit le : 23/10/2010
Messages : 14

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeDim 24 Oct 2010 - 23:37

ah... j'Avais pas vu... merci les gars

mais pour le skill shop, comme je comprend pas beaucoup, pourrai-je avoir plus d'information
Revenir en haut Aller en bas
Xavioo
Corsaire Lv.19
Corsaire Lv.19
Xavioo


Masculin Age : 26
Inscrit le : 26/11/2009
Messages : 2508

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeLun 25 Oct 2010 - 0:04


Vous allez ajouter "$ skill_shop = [Id of Skill]"
Pour appel de script pour définir "id" de compétences pour les vendre.
Vous allez ajouter "$ scene = Scene_Skill_Shop.new"
To Call Shop Skill Windows.

Exemple:
skill_shop = $ [1,2,3,6,7]
scène $ = Scene_Skill_Shop.new
Revenir en haut Aller en bas
BARVACHE
Vache Folle
Vache Folle
BARVACHE


Masculin Age : 29
Inscrit le : 22/05/2010
Messages : 3005

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeLun 25 Oct 2010 - 7:27

Pour les armes, ce ne serait pas un bestiaire pour armes que tu voudrais?
Revenir en haut Aller en bas
Blockade
Ex-Admin Cruelle
Ex-Admin Cruelle
Blockade


Féminin Age : 32
Inscrit le : 03/07/2008
Messages : 2441

Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitimeLun 25 Oct 2010 - 9:10

Silverwolf : La prochaine fois pour tes demandes de "scripts" je te conseille de lire ça :
https://rpg-maker-vx.bbactif.com/demande-de-scripts-f23/a-lire-demander-un-script-t10606.htm Wink
Ça fera gagner du temps à tout le monde =)
Merci !
Revenir en haut Aller en bas
Contenu sponsorisé




Script pour magasin Empty
MessageSujet: Re: Script pour magasin   Script pour magasin Icon_minitime

Revenir en haut Aller en bas
 

Script pour magasin

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» Script pour faire un jeu style new super mario bros pour vx ace [Non-Résolue]
» [SCRIPT] script pour combat comme ff XII
» Script pour communication (chat) & de lueur pour le skin.
» Ajout d'une fonction pour le script de pop-up pour un gain
» Script pacman pour vx ace

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker VX :: Entraide :: Scripts :: Requêtes :: Archives-
Créer un forum | ©phpBB | Forum gratuit d'entraide | Signaler un abus | Forum gratuit