Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Visual Equipment (Widoczny Ekwipunek)
Autor Wiadomość
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Wto 30 Mar, 2010 19:31
Visual Equipment (Widoczny Ekwipunek)
Autor: Rataime
Opis: Zmienia grafikę bohatera, gdy nosi wybraną rzecz.
Skrypt:
Spoiler:

Kod:
#=======================================
# ** Visual_Equipment Re-Edited (version Kappa)
#------------------------------------------------------------------------------
#    Written by Rataime
#    New Edits by DerVVulfman
#    February 10, 2008
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
# Revisions to note:
#  1) Added formatted headers and comments throughout the script.
#  2) Encapsulated the working code in a Visual Equipment module.
#  3) Set the equipment array into an instance value to lower resource costs.
#  4) Discovered a 'nil' $game_party bug.  Added 'return if...' statements.
#  5) Removed unnecessary Window_SaveFile edit.
#  6) Interpreter routine for 'Change Equipment' now aliased.
#  7) Interpreter routine for 'Change Equipment' now changes visible equipment.
#  8) Support for 'Change Party Members' now works, even w/ Large Party systems.
#  9) 'Change Equipment' now compatible with Fukuyama's Train Actor script.
# 10) System should now be usable with or without RMXP SDK.
#------------------------------------------------------------------------------
# ** Changing party members or equipment while still visible on the map will
# ** force the map to refresh, giving a slight pause.
#==========================================



#==========================================
# ** module Visual Equipment
#------------------------------------------------------------------------------
#  This module handles the image name and equipment drawing process.
#==========================================

module Visual_Equipment
  module_function
  #--------------------------------------------------------------------------
  # * Update Visual Equipment
  #--------------------------------------------------------------------------
  def equip_update
    @visual_equipment = Array.new
    for i in 0..$game_party.actors.size
      @visual_equipment[i+1] = []
    end

   #==========================================
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #==========================================
   #
   # Syntax to set weapons or armors in this script are as follows:
   #      add_weapon_sprite(weaponID, characterset)
   # -or- add_armor_sprite(armorID, characterset)
   #
   # The ID number is the same as the ID number in the database.
   # The charactersets are the extra graphics for the weapon/armor that is
   # stored in the 'Graphics\Characterset' folder of your project.
 
    # WEAPON LISTINGS
      add_weapon_sprite(IDB, "GrafBr")
    # ARMOR LISTINGS
      add_armor_sprite( IDZ, "GrafZb")
   
   #==========================================
   #  ****   E N D   O F   C O N F I G U R A T I O N   S Y S T E M   ****  #
   #==========================================
 
    #------------------------------------------------------------------------
    # * Visual Equipment Functions
    #------------------------------------------------------------------------
    RPG::Cache.clear
    return if $game_party == nil
    for i in 0...$game_party.actors.size
      for img in @visual_equipment[i+1]
        bitmap = RPG::Cache.character($game_party.actors[i].character_name,
                      $game_party.actors[i].character_hue)
        if img!=true and img!=false
          add_equip(bitmap,img,i)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Add Equipment
  #     sprite    : Original sprite bitmap
  #     to_add    : Equipment characterset
  #     character : Member in party
  #--------------------------------------------------------------------------
  def add_equip(sprite, to_add, character)
    return if $game_party == nil
    bmp = Sprite.new
    bmp.visible = false
    bmp.bitmap  = RPG::Cache.character(to_add,
                      $game_party.actors[character].character_hue)
    color = bmp.bitmap.get_pixel(0, 0)
    x = sprite.width
    y = sprite.height
    if @visual_equipment[0]
      x = x/4
      y = y/4
    end
    for i in 0..x
      for j in 0..y
        color_get = bmp.bitmap.get_pixel(i, j)
        if color_get != color
          sprite.set_pixel(i, j ,color_get)
        end
      end
    end
    bmp = nil
  end
  #--------------------------------------------------------------------------
  # * Add Weapon Sprite
  #     id        : Weapon ID
  #     sprite    : Weapon characterset
  #--------------------------------------------------------------------------
  def add_weapon_sprite(id, sprite)
    return if $game_party == nil
    for i in 0...$game_party.actors.size
      if $game_party.actors[i].weapon_id == id
        @visual_equipment[i+1].push(sprite)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Add Armor Sprite
  #     id        : Armor ID
  #     sprite    : Armor characterset
  #--------------------------------------------------------------------------
  def add_armor_sprite(id, sprite)
    return if $game_party == nil   
    for i in 0...$game_party.actors.size
      if $game_party.actors[i].armor1_id == id or
         $game_party.actors[i].armor2_id == id or
         $game_party.actors[i].armor3_id == id or
         $game_party.actors[i].armor4_id == id
        @visual_equipment[i+1].push(sprite)
      end
    end
  end
end



#==========================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==========================================

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :visual_transfer          # Equipment changed in field switch
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias visual_initialize initialize
  def initialize
    # Perform the original call
    visual_initialize
    @visual_transfer = false              # Equipment changed in field
  end
end



#==========================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==========================================

class Scene_Equip
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_update_right update_right
  #--------------------------------------------------------------------------
  # * Frame Update (when right window is active)
  #--------------------------------------------------------------------------
  def update_right
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Update with the equipment
      Visual_Equipment.equip_update
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(2)
      return
    end
    # Perform the original call
    visual_update_right
  end
end



#==========================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. Its functions include event starting
#  determinants and map scrolling. Refer to "$game_player" for the one
#  instance of this class.
#==========================================

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Do not perform during equipment transfer
    return if $game_temp.visual_transfer == true
    # Perform the original call
    visual_update
  end
end



#==========================================
# ** Interpreter
#------------------------------------------------------------------------------
#  This interpreter runs event commands. This class is used within the
#  Game_System class and the Game_Event class.
#==========================================
class Interpreter
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_command_129 command_129
  alias visual_command_319 command_319
  #--------------------------------------------------------------------------
  # * Change Party Member
  #--------------------------------------------------------------------------
  def command_129
    # Perform the original call
    visual_command_129
    # Update with the equipment
    Visual_Equipment.equip_update
    # Continue
    return true   
  end
  #--------------------------------------------------------------------------
  # * Change Equipment
  #--------------------------------------------------------------------------
  def command_319
    # Perform the original call
    visual_command_319
    # Update with the equipment
    Visual_Equipment.equip_update
    # Turns the transfer system on
    $game_temp.visual_transfer = true
    # Switch to map screen
    $scene = Scene_Map.new   
    # Continue
    return true
  end
end



#==========================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==========================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Perform the original call
    visual_update
    # Turns equipment transfer system off
    $game_temp.visual_transfer = false if $game_temp.visual_transfer == true
  end
end



#==========================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==========================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :character_hue
end



#==========================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==========================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    # Perform the original call
    visual_setup(actor_id)
    @character_hue = (@character_hue+1)%256
  end
end



#==========================================
# ** Scene_Load
#----------------------------------------------------------------------------
#  This class performs load screen processing.
#==========================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_read_save_data read_save_data
  alias visual_on_cancel on_cancel
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Update with the equipment
    Visual_Equipment.equip_update
    # Perform the original call
    visual_on_cancel
  end
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    # Perform the original call
    visual_read_save_data(file)
    # Update with the equipment
    Visual_Equipment.equip_update
  end
end

#==========================================
# ** Scene_Save
#------------------------------------------------------------------------------
#  This class performs save screen processing.
#==========================================

class Scene_Save < Scene_File
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_on_decision on_decision
  alias visual_on_cancel on_cancel
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Update with the equipment
    Visual_Equipment.equip_update
    # Perform the original call
    visual_on_cancel
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(file)
    # Update with the equipment
    Visual_Equipment.equip_update
    # Perform the original call
    visual_on_decision(file)
  end
end



#==========================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==========================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias visual_command_new_game command_new_game
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  def command_new_game
    # Perform the original call
    visual_command_new_game
    # Update with the equipment
    Visual_Equipment.equip_update
  end
end



Konfiguracja:
Kod:
    # WEAPON LISTINGS
      add_weapon_sprite(IDB, "GrafBr")
    # ARMOR LISTINGS
      add_armor_sprite( IDZ, "GrafZb")


IDB - Id broni w bazie danych
GrafBr - grafika broni, gdy ją nosimy (najlepiej bez chara tylko samą broń)
IDZ - Id zbroi w bazie danych
GrafZb - grafika zbroi, gdy ją nosimy(także bez chara tylko sama zbroja)

Zaleta:
Już się nie będziesz męczył z eventami.

Wada:
Jak ma się dwie zbroje, które są ustawione z grafiką to pokazuje tylko tą wyżej położoną w ekwipunku.(chodzi mi o pancerze)

Jakby ktoś mógłby naprawić tę wadę to byłbym wdzięczny.

Pzdr
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
Ostatnio zmieniony przez Ayene Sro 31 Mar, 2010 07:40, w całości zmieniany 1 raz  
 
 
Bezel 




Dołączył: 08 Lis 2009
Posty: 84
Wysłany: Sob 10 Kwi, 2010 19:05
błagam o jakąś instr bo nie kumam o co mu chodzi
Cytat:
(najlepiej bez chara tylko samą broń)
o co chodzi z tym sama broń?
________________________
 
 
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Sob 10 Kwi, 2010 19:09
To jest sam miecz.
Spoiler:



Instrukcja:
1. Robisz grafikę ekwipunku np. w generatorze.
2. Importujesz grafikę do Characters.
3. Ustawiasz w skrypcie grafikę (jest w pierwszym poście).
I to chyba wszystko.
Pzdr.
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
Ostatnio zmieniony przez Nhadala Nie 11 Kwi, 2010 19:53, w całości zmieniany 1 raz  
 
 
Bezel 




Dołączył: 08 Lis 2009
Posty: 84
Wysłany: Sob 10 Kwi, 2010 19:21
a dasz link do generatora?
________________________
 
 
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Sob 10 Kwi, 2010 19:27
Masz w dziale materiały.
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
 
 
Bezel 




Dołączył: 08 Lis 2009
Posty: 84
Wysłany: Nie 11 Kwi, 2010 10:04
niewiem przetestuje z tym :-PP

[ Dodano: Nie 11 Kwi, 2010 10:09 ]
a jak w tym generatorze robić miecze?

[ Dodano: Nie 11 Kwi, 2010 10:17 ]
albo lepiej zkąd mieć takie cudeńka ? :mrgreen:
________________________
 
 
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Nie 11 Kwi, 2010 10:53
Wybierasz jakiś przedmiot robisz screena, wrzuć do painta i usuń grafikę postaci zostawiając sam ekwipunek.
Pzdr.
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
 
 
Bezel 




Dołączył: 08 Lis 2009
Posty: 84
Wysłany: Nie 11 Kwi, 2010 10:55
ale tam jest tylko ten mieczyk co ty daleś do przykładu :-|
________________________
 
 
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Nie 11 Kwi, 2010 11:28
To jest jedyny minus tego generatora.
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
 
 
Bezel 




Dołączył: 08 Lis 2009
Posty: 84
Wysłany: Nie 11 Kwi, 2010 12:03
aha czyli rozumiem mam szperać po necie tak?(minusów jest pełno)
________________________
 
 
rasi 



Preferowany:
RPG Maker XP

Dołączył: 06 Kwi 2010
Posty: 20
Wysłany: Czw 22 Kwi, 2010 18:28
Ja mam taki problem:
Mam zrobione ze jak zaloze jakas tam zbroje to zmienia sie wyglad bohatera, ale mam tak ze stary wyglad zostaje pod spodem :( Ja mam dac tam obrazem samej zbroi czy calej postaci wkleic? bo ja wklejam 10 charactersow kazdy taki sam tylko inna zbroja i tak robie, ale caly czas pod spodem mi zostaje poprzednie :(
 
 
Czeliosss 



Ranga RM:
1 gra

Pomógł: 49 razy
Dołączył: 02 Lis 2009
Posty: 661
Skąd: Wa-wa
Wysłany: Czw 22 Kwi, 2010 18:33
Bo tak jest napisany tek skrypt, aby ten char co jest w bazie danych był dolną warstwą. Char zbroi ma być jak 3 poście.
Pzdr.
________________________
...Amelanduil & FireBlade words will be remembered...
...Amelanduil & FireBlade acts will be remembered...
...Amelanduil & FireBlade never gonna die...

Nie pisać, bo nie odpiszę.
 
 
Sprocik 




Preferowany:
RPG Maker XP

Pomógł: 1 raz
Dołączył: 20 Maj 2010
Posty: 60
Skąd: Wrocław
Wysłany: Pią 16 Lip, 2010 02:59
Re: Visual Equipment (Widoczny Ekwipunek)
ja nie rozumiem gdzie to mam napisać

Kod:
    # WEAPON LISTINGS
      add_weapon_sprite(IDB, "GrafBr")
    # ARMOR LISTINGS
      add_armor_sprite( IDZ, "GrafZb")
________________________
''Non omnis moriar''
''Cogito ergo sum''

Spoiler:



^^ New animation by me� ^^

 
 
 
geerd2123xD 



Dołączył: 16 Paź 2011
Posty: 4
Wysłany: Wto 15 Lis, 2011 18:07
Kod:
# WEAPON LISTINGS
add_weapon_sprite(IDB, "GrafBr")
# ARMOR LISTINGS
add_armor_sprite( IDZ, "GrafZb")


IDB -id broni przykłąd mi chodzi idealnie
add_weapon_sprite(1, "miecz_2")
IDZ -id zbroi przykład ( jeszcze nie testowałem wiec moze byc zle )
add_armor_sprite(1, "zbroja")
spróbuj zrobić tak jak ci pokazałem to moze ci odp i zrób tak jak tłumaczyl Czelioss na zwykłym charze dosłownie w majtkach robisz bron w paincie a nastepnie usuwasz tego chara a sama bron zostawiasz pod koniec jak zapisujesz to podpisujesz np miecz_2 i wtedy ci all chodzi bajkowo
 
 
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Wto 15 Lis, 2011 18:49
Cytat:
Wysłany: Pią 16 Lip, 2010 01:59


________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene