Zarok RPG Maker
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
AccueilDernières imagesS'enregistrerConnexion
Le deal à ne pas rater :
Funko POP! Jumbo One Piece Kaido Dragon Form : où l’acheter ?
Voir le deal

Partagez | 
 

 TVA Dans les Magasin

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Aiden
Matière
Matière
Aiden


Masculin Messages : 142
Age : 28
Date d'inscription : 30/07/2008

Caractéristiques du membre
Evolution: Atome
Job: Scenariste-Event
XP:
TVA Dans les Magasin Left_bar_bleue20/20TVA Dans les Magasin Empty_bar_bleue  (20/20)

TVA Dans les Magasin Empty
MessageSujet: TVA Dans les Magasin   TVA Dans les Magasin EmptyLun 4 Aoû 2008 - 0:13

Ce Scipt permet de payer une TVA de 10% en plus pour un objet ou équipement achetée .
Auteur:Darklord
Trouvée sur RPGfans-forum

Pour l'exemple, une potion qui vaudra 50 gils coutera en magasin 55 gils, et selon les magasins vous aurez des différentes taxes.

Démo : http://www.megaupload.com/?d=ZX8RGBUH

Créez un nouveau script au dessus de main, et nommez le " tax_script1 "



--------------------------------------------------------------------------------


Code:
#============================================================================
# Tax script 1.1
# Requested by Mega Flare
#----------------------------------------------------------------------------
# By The_Darklord
# Thanks to SephirothSpawn for help
#----------------------------------------------------------------------------
# The following methods are rewritten:
# Window_ShopBuy(draw_iten(index), Scene_Shop(update_buy, update_number)
# Window_ShopStatus(refresh)
#============================================================================

class Game_System
attr_accessor :tax
  alias declaration initialize
  def initialize
  declaration
  @tax = 0
  end
end

class Window_ShopBuy < Window_Selectable
  alias make_item draw_item
  #--------------------------------------------------------------------------
  # * Draw Item
  #    index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    #--------------------------------------------------------------------------
    # * Reputation Tax Calculator
    #--------------------------------------------------------------------------
    if $game_variables[1] < 1000
      $game_variables[2] = 10
    elsif $game_variables[1] < 5000
      $game_variables[2] = 8
    elsif $game_variables[1] < 10000
      $game_variables[2] = 5
    elsif $game_variables[1] < 25000
      $game_variables[2] = 1
    elsif $game_variables[1] < 50000
      $game_variables[2] = -4
    elsif $game_variables[1] < 100000
      $game_variables[2] = -7
    else
      $game_variables[2] = -10
    end
    item = @data[index]
    a = item.price
    item.price = Integer(a * ( (100 + $game_variables[2]) / 100.0))
    make_item(index)
    item.price = a
  end
end

#------------------------------------------------------------------------------

class Scene_Shop
  #--------------------------------------------------------------------------
  # * 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
      @command_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
      a = @item.price
      @item.price = Integer(a * ( (100 + $game_variables[2]) / 100.0))
      # 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
      @item.price = a
    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
        a = @item.price
        @item.price = Integer(a * ( (100 + $game_system.tax) / 100.0))
        $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
        @item.price = a
        # 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
        @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

#------------------------------------------------------------------------------

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @item == nil
      return
    end
    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
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "Objets en Possesion")
    self.contents.font.color = normal_color
    self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 86, "Taxe Valeur Ajoutée")
    self.contents.font.color = normal_color
    self.contents.draw_text(172, 0, 64, 86, $game_variables[2].to_s + "%", 2)
    if @item.is_a?(RPG::Item)
      return
    end
    # Equipment adding information
    for i in 0...$game_party.actors.size
      # Get actor
      actor = $game_party.actors[i]
      # If equippable, then set to normal text color. If not, set to
      # invalid text color.
      if actor.equippable?(@item)
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      # Draw actor's name
      self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
      # Get current equipment
      if @item.is_a?(RPG::Weapon)
        item1 = $data_weapons[actor.weapon_id]
      elsif @item.kind == 0
        item1 = $data_armors[actor.armor1_id]
      elsif @item.kind == 1
        item1 = $data_armors[actor.armor2_id]
      elsif @item.kind == 2
        item1 = $data_armors[actor.armor3_id]
      else
        item1 = $data_armors[actor.armor4_id]
      end
      # If equippable
      if actor.equippable?(@item)
        # If weapon
        if @item.is_a?(RPG::Weapon)
          atk1 = item1 != nil ? item1.atk : 0
          atk2 = @item != nil ? @item.atk : 0
          change = atk2 - atk1
        end
        # If armor
        if @item.is_a?(RPG::Armor)
          pdef1 = item1 != nil ? item1.pdef : 0
          mdef1 = item1 != nil ? item1.mdef : 0
          pdef2 = @item != nil ? @item.pdef : 0
          mdef2 = @item != nil ? @item.mdef : 0
          change = pdef2 - pdef1 + mdef2 - mdef1
        end
        # Draw parameter change values
        self.contents.draw_text(124, 64 + 64 * i, 112, 32,
          sprintf("%+d", change), 2)
      end
      # Draw item
      if item1 != nil
        x = 4
        y = 64 + 64 * i + 32
        bitmap = RPG::Cache.icon(item1.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, item1.name)
      end
    end
  end
end

Edit d' Atwars:N'oublie pas de mettre les scripts entre balise Wink
Revenir en haut Aller en bas
http://www.crysmaker.weebly.com
tsukune
Atome
Atome
tsukune


Féminin Messages : 49
Age : 31
Date d'inscription : 31/07/2008

Caractéristiques du membre
Evolution: Atome
Job: Programmation,3D
XP:
TVA Dans les Magasin Left_bar_bleue20/20TVA Dans les Magasin Empty_bar_bleue  (20/20)

TVA Dans les Magasin Empty
MessageSujet: Re: TVA Dans les Magasin   TVA Dans les Magasin EmptyLun 4 Aoû 2008 - 0:34

Ah déjà qu'on a la TVA dans la vie réel faut l'appliquer dans le monde virtuel maintenant lol!
Sérieux sa peut servir a des projet,pourquoi pas Wink
Revenir en haut Aller en bas
Aiden
Matière
Matière
Aiden


Masculin Messages : 142
Age : 28
Date d'inscription : 30/07/2008

Caractéristiques du membre
Evolution: Atome
Job: Scenariste-Event
XP:
TVA Dans les Magasin Left_bar_bleue20/20TVA Dans les Magasin Empty_bar_bleue  (20/20)

TVA Dans les Magasin Empty
MessageSujet: Re: TVA Dans les Magasin   TVA Dans les Magasin EmptyLun 4 Aoû 2008 - 10:03

Oui iil est simple a comprendre peut aussi aidez pour des projet a la pokemon en ameliorer dans les shop sympa !

^^
Revenir en haut Aller en bas
http://www.crysmaker.weebly.com
Atwars
Atwars


Grade : Paysan lvl1
Masculin Messages : 1392
Age : 30
Date d'inscription : 04/02/2007

Caractéristiques du membre
Evolution: Humain
Job:
XP:
TVA Dans les Magasin Left_bar_bleue0/5TVA Dans les Magasin Empty_bar_bleue  (0/5)

TVA Dans les Magasin Empty
MessageSujet: Re: TVA Dans les Magasin   TVA Dans les Magasin EmptyLun 4 Aoû 2008 - 12:40

Il est vieux ce script,^^.Je l'ai vu y'a pas mal d'année(compte sur ses doigts,^^,)Il y était quand j'ai commencer à maker.

Je l'avais pas trouver et je le trouve pas mal.Ce qu'est bien c'st que quand le truc est trop cher ça baisse le prix mais inversement aussi....
Revenir en haut Aller en bas
Contenu sponsorisé



TVA Dans les Magasin Empty
MessageSujet: Re: TVA Dans les Magasin   TVA Dans les Magasin Empty

Revenir en haut Aller en bas
 

TVA Dans les Magasin

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

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

 :: SCRIPTS :: Script XP :: Scripts d'interfaces/ menus
-
Sauter vers: