Ogłoszenie 

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


Administracja Forum


Poprzedni temat «» Następny temat
Party Guest
Autor Wiadomość
aragorn7015 




Preferowany:
RPG Maker VXAce

Pomógł: 15 razy
Dołączył: 20 Kwi 2012
Posty: 186
Skąd: się biorą dzieci?
  Wysłany: Sro 10 Paź, 2012 15:31
Party Guest
~ Party Guest ~


Krótki opis:
Ten skrypt jest świetny, gdy na przykład robi grę o strażniku, który jeździ po świecie z np. królem i go ochrania. Ten twój tymczasowy towarzysz, nie walczy.

Autor:
Mr. Bubble (email nieznany)

Kompatybilność:
RPG Maker VX Ace

Skrypt:
Spoiler:

Kod:
# ™╤╤‹
# Š Party Guests                                          ƒ v1.1 ƒ (7/13/12) Š
# ˜╧╧Œ
# Script by:
#     Mr. Bubble
#--------------------------------------------------------------------------
# This script allows you to have actors as guests in the party
# similarly to various console RPGs. A custom window is added to the
# menu that displays current guests in the party.
#
# Party guests do not require special tags in their noteboxes. They are
# simply actors put into a "guests" group within the party which is
# seperate from any of your battle or reserve members. Because of
# this, guests are not eligible to be chosen for battle at all.
#
# Since guests are just glorified actors, names, face graphics,
# sprite graphics, etc. are defined in the Actors tab in the database
# like normal. Those settings are then used in various display windows
# related to guests.
#
# Guests provide no special effects to the party. However, other existing
# scripts can provide effects if desired.
#
# If an actor is already in the main party and is placed into the
# guest group, the actor will automatically be removed from the
# main party. The same is true vice versa.
#--------------------------------------------------------------------------
#   ++ Changelog ++
#--------------------------------------------------------------------------
# v1.1 : Fixed guest_in_party? Script Call.
#      : Changed instance variable name for Guest ID array. (7/13/2012)
# v1.0 : Initial release. (6/25/2012)
#--------------------------------------------------------------------------
#   ++ Installation ++
#--------------------------------------------------------------------------
# Install this script in the Materials section in your project's
# script editor.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#   ++ Script Calls ++
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The following script calls are meant to be used in "Script..."
# event commands found under Tab 3 when creating a new event.
#
# add_guest(actor_id)
#   Adds an actor to the party guest group. If the actor is already in the
#   main party, the actor will automatically be removed from the main
#   party before being added to the guest group.
#   
# remove_guest(actor_id)
#   Removes the actor from the guest group.
#
# remove_all_guests
#   Removes all actors from the guest group.
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#   ++ Conditional Branch Script Calls ++
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The following script calls are meant to be used in Conditional
# Branch event commands within the Tab 4 "Script" box.
# Each of these script calls will turn the given Game Switch ON
# or OFF, where ON is true and OFF is false.
#   
# guest_in_party?(actor_id)
#   Checks whether the given actor is a guest in the party.
#
#--------------------------------------------------------------------------
#   ++ Compatibility ++
#--------------------------------------------------------------------------
# This script aliases the following default VXA methods:
#
#     Game_Party#initialize
#     Game_Party#add_actor
#
# There are no default method overwrites.
#
# Requests for compatibility with other scripts are welcome.
#--------------------------------------------------------------------------
#   ++ Terms and Conditions ++
#--------------------------------------------------------------------------
# Please do not repost this script elsewhere without permission.
# Free for non-commercial use. For commercial use, contact me first.
#
# Newest versions of this script can be found at
#                                           http://mrbubblewand.wordpress.com/
#==============================================================================

$imported = {} if $imported.nil?
$imported["BubsPartyGuests"] = true

#==========================================================================
# ++ START OF USER CUSTOMIZATION MODULE ++
#==========================================================================
module Bubs
  #==========================================================================
  # ++ Party Guests Settings
  #==========================================================================
  module PartyGuests
   
  #--------------------------------------------------------------------------
  #   Guest Limit
  #--------------------------------------------------------------------------
  # The maximum number of guests that can accompany the party.
  #   !! Use caution when adding too many guests to the party since
  #   !! the Guests window in the menu is not currently suited to handle
  #   !! a large amount of guests to display.
  MAX_GUESTS = 2

  #--------------------------------------------------------------------------
  #   Guest Window Label Text
  #--------------------------------------------------------------------------
  GUEST_WINDOW_TEXT = "Towarzysze"
  #--------------------------------------------------------------------------
  #   Guest Window Display Style
  #--------------------------------------------------------------------------
  # Determines the style in which Guests are shown in the Guests window
  # 0 : Show Guest face portraits
  # 1 : Show Guest map sprites
  GUEST_WINDOW_STYLE = 0
  #--------------------------------------------------------------------------
  #   Hide Guest Window When No Guests
  #--------------------------------------------------------------------------
  # true  : The Guest window will be hidden when there are no guests
  # false : The Guest window will still be visible when there are no guests
  HIDE_WINDOW_WHEN_NO_GUESTS = false

  end # module PartyGuests
end # module Bubs

#==========================================================================
# ++ END OF USER CUSTOMIZATION MODULE ++
#==========================================================================



#==========================================================================
# ++ Game_Party
#==========================================================================
class Game_Party < Game_Unit
  attr_accessor :guest_ids
  #--------------------------------------------------------------------------
  # alias : initialize
  #--------------------------------------------------------------------------
  alias initialize_bubs_party_guests initialize
  def initialize
    initialize_bubs_party_guests # alias
   
    @guest_ids = []
  end
   
  #--------------------------------------------------------------------------
  # new method : guests
  #--------------------------------------------------------------------------
  def guests
    @guest_ids.collect {|id| $game_actors[id] }
  end

  #--------------------------------------------------------------------------
  # new method : party_guests
  #--------------------------------------------------------------------------
  def party_guests
    @guest_ids
  end
 
  #--------------------------------------------------------------------------
  # new method : add_guest
  #--------------------------------------------------------------------------
  def add_guest(actor_id)
    return if @guest_ids.size >= max_guests
    return if @guest_ids.include?(actor_id)
   
    remove_actor(actor_id)
    @guest_ids.push(actor_id)
    $game_player.refresh
    $game_map.need_refresh = true
  end
 
  #--------------------------------------------------------------------------
  # new method : remove_guest
  #--------------------------------------------------------------------------
  def remove_guest(actor_id)
    @guest_ids.delete(actor_id)
    $game_player.refresh
    $game_map.need_refresh = true
  end
 
  #--------------------------------------------------------------------------
  # alias : add_actor
  #--------------------------------------------------------------------------
  alias add_actor_bubs_party_guests add_actor
  def add_actor(actor_id)
    remove_guest(actor_id)
    add_actor_bubs_party_guests(actor_id) # alias
  end
 
  #--------------------------------------------------------------------------
  # new method : max_guests
  #--------------------------------------------------------------------------
  def max_guests
    return Bubs::PartyGuests::MAX_GUESTS
  end
end # class Game_Party


#==========================================================================
# ++ Window_PartyGuests
#==========================================================================
class Window_PartyGuests < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)
    refresh
  end
 
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
 
  #--------------------------------------------------------------------------
  # height
  #--------------------------------------------------------------------------
  def window_height
    fitting_height(guest_window_height)
  end
 
  #--------------------------------------------------------------------------
  # new method : guest_window_height
  #--------------------------------------------------------------------------
  def guest_window_height
    fh = 1
    case Bubs::PartyGuests::GUEST_WINDOW_STYLE
    when 0
      fh = 1 + ($game_party.guest_ids.size * 2)
    when 1
      fh = $game_party.guest_ids.empty? ? 1 : 3
    end
  end
 
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_party_guest_text
    draw_party_guests
  end
 
  #--------------------------------------------------------------------------
  # new method : draw_party_guests
  #--------------------------------------------------------------------------
  def draw_party_guests
    case Bubs::PartyGuests::GUEST_WINDOW_STYLE
    when 0
      draw_party_guest_faces
    when 1
      draw_party_guest_graphics
    end
  end
 
  #--------------------------------------------------------------------------
  # new method : draw_party_guest_faces
  #--------------------------------------------------------------------------
  def draw_party_guest_faces
    $game_party.guests.each_with_index { |actor, i|
      draw_actor_half_face(actor, 20, 48 * i + line_height)
    }
  end
 
  #--------------------------------------------------------------------------
  # new method : draw_party_guest_graphic
  #--------------------------------------------------------------------------
  def draw_party_guest_graphics
    $game_party.guests.each_with_index { |actor, i|
      draw_actor_graphic(actor, 32 * i + 20, 24 * 3)
    }
  end
 
  #--------------------------------------------------------------------------
  # new method : draw_party_guest_text
  #--------------------------------------------------------------------------
  def draw_party_guest_text
    change_color(system_color)
    draw_text(0, 0, 160, line_height, Bubs::PartyGuests::GUEST_WINDOW_TEXT)
  end
 
  #--------------------------------------------------------------------------
  # new method : draw_actor_half_face
  #--------------------------------------------------------------------------
  def draw_actor_half_face(actor, x, y, enabled = true)
    draw_half_face(actor.face_name, actor.face_index, x, y, enabled)
  end

  #--------------------------------------------------------------------------
  # new method : draw_half_face
  #--------------------------------------------------------------------------
  def draw_half_face(face_name, face_index, x, y, enabled = true)
    bitmap = Cache.face(face_name)
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96 + 32, 96, 46)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end
 
  #--------------------------------------------------------------------------
  # open
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end # class Window_PartyGuests


#==========================================================================
# ++ Scene_Menu
#==========================================================================
class Scene_Menu < Scene_MenuBase
  #--------------------------------------------------------------------------
  # alias : start
  #--------------------------------------------------------------------------
  alias start_bubs_party_guests start
  def start
    start_bubs_party_guests # alias
   
    create_guest_window
  end
 
  #--------------------------------------------------------------------------
  # new method : create_guest_window
  #--------------------------------------------------------------------------
  def create_guest_window
    return if $game_party.guests.empty? && Bubs::PartyGuests::HIDE_WINDOW_WHEN_NO_GUESTS
   
    @guest_window = Window_PartyGuests.new
    @guest_window.x = 0
    @guest_window.y = Graphics.height - @gold_window.height - @guest_window.height
  end
end # class Scene_Menu

#==========================================================================
# ++ Game_Actor
#==========================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # new method : guest?
  #--------------------------------------------------------------------------
  def guest?
    $game_party.guest_ids.include?(@actor_id)
  end
end # class Game_Actor

#==========================================================================
# ++ Game_BattlerBase
#==========================================================================
class Game_BattlerBase
  #--------------------------------------------------------------------------
  # new method : guest?
  #--------------------------------------------------------------------------
  def guest?
    return false
  end
end # class Game_BattlerBase


#==========================================================================
# ++ Game_Interpreter
#==========================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # new method : remove_all_guests
  #--------------------------------------------------------------------------
  def remove_all_guests
    $game_party.guest_ids.clear
  end
  alias remove_all_guest remove_all_guests
 
  #--------------------------------------------------------------------------
  # new method : add_guest
  #--------------------------------------------------------------------------
  def add_guest(actor_id)
    $game_party.add_guest(actor_id)
  end
 
  #--------------------------------------------------------------------------
  # new method : remove_guest
  #--------------------------------------------------------------------------
  def remove_guest(actor_id)
    $game_party.remove_guest(actor_id)
  end
 
  #--------------------------------------------------------------------------
  # new method : guest_in_party?
  #--------------------------------------------------------------------------
  def guest_in_party?(actor_id)
    $game_party.guest_ids.include?(actor_id)
  end
  alias has_guest? guest_in_party?
  alias have_guest? guest_in_party?
end # class Game_Interpreter


Screeny:
Spoiler:



Dodatkowe informacje:
Towarzysza dodaje się w ten sposób: add_guest (id bohatera z bazy danych)
Towarzysza usuwa się w ten sposób: remove_guest (id bohatera z bazy danych)
Wszystkich towarzyszy na raz usuwa się w ten sposób: remove_all_guests

Wpisuje się to w jakimś zdarzeniu 3 strona poleceń zdarzeń/zaawansowane/skrypt i wpisujemy którąś z komend które wypisałem wyżej
________________________
Jeśli pomogłem, daj
Spoiler:

POMÓGŁ



Uwielbiam się bawić na zdarzeniach w VX-ie... Więc jeśli masz jakieś pytanie jak coś zrobić na zdarzeniach to napisz. Jeśli będę wiedział to odpowiem
 
 
 
filiotef 




Preferowany:
RPG Maker VXAce

Dołączył: 08 Lip 2011
Posty: 29
Wysłany: Pią 09 Lis, 2012 23:50
Świetny skrypt, dzięki :mrgreen:
________________________

 
 
Nex 




Preferowany:
RPG Maker XP

Pomógł: 15 razy
Dołączył: 27 Paź 2012
Posty: 145
Wysłany: Czw 06 Gru, 2012 08:33
Bardzo przydatny może nawet użyje ;-)
 
 
makerowiec64 




Preferowany:
RPG Maker 95

Pomógł: 2 razy
Dołączył: 02 Wrz 2012
Posty: 181
Skąd: się tu wziąłem?
Wysłany: Czw 06 Gru, 2012 13:19
Sorry :-( ale nie użyję...bo nie robię na Ace...
Ale takie nawet schludne,ładne...fajne :mrgreen:
________________________
99 % świrów czyta mój podpis z ręką na myszce.
Nie odchylaj ręki - jest już za późno :haha:

Wiem,to mogłem zrobić w większym rozmiarze.Przypatrz się bardziej!
 
 
 
ka0909 



Preferowany:
RPG Maker XP

Pomógł: 20 razy
Dołączył: 02 Paź 2010
Posty: 122
Wysłany: Czw 06 Gru, 2012 17:43
Dzięki! Przyda się :)
 
 
Stasiu9696 



Preferowany:
RPG Maker VX

Dołączył: 12 Lip 2011
Posty: 2
Skąd: Dąbrowa Górnicza
Wysłany: Sob 15 Gru, 2012 22:13
a dało by się wcisnąć tego towarzysza do podążających za bohaterem?
 
 
piotrb7 




Preferowany:
RPG Maker VXAce

Dołączył: 15 Sty 2012
Posty: 16
Wysłany: Pon 28 Sty, 2013 17:15
Super skrypt. Może go dodam do projektu.
________________________
 
 
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