XP 스크립트

http://www.rmxp.net/forums/index.php?showtopic=20169
(내용을 보려면 로그인 필요)
  파티원 교체 스크립트입니다.  스크립트는 첨부된 데모에 들어있음.

**데모에는 SephirothSpawn씨의 랜덤용병 고용 스크립트도 첨가되어 있습니다.  데모에서는 용병NPC를 통해 용병을 스카웃, 고용한 뒤 파티원 교체 NPC를 통해 파티원 교체를 할 수 있습니다.


---------------------------
#==============================================================================
# Scene_Switch class definition
#------------------------------------------------------------------------------
#
# *** P L E A S E R E A D T H I S F I R S T ***
#
# Indeed, this is one huge comment block, but hopefully, everything you need
# to know will be included.
#
# This is currently a 4-page script, but I might eventually make them all in
# one single script, but it will work the same.
#
# This is version 1.04 of this script. I will not change the version number if
# the only changes I have made are in this instruction header. (In other words,
# if it does not change the actual workings of the script, I will not change
# the version number.)
#
# First of all, read the instructions provided in this header. You will find
# them not far below. If you have questions, please read the Mini-FAQ which is
# also in this huge comment header. If (and only if) the question is not
# answered there, please ask it on the "official" topic in the RMXP.net forums
# at the following URL:
# http://www.rmxp.net/forums/index.php?showtopic=20169
# (If RMXP.net is offline, please go to RMXP.org instead and make a topic if
# there is not one already.)
#
# Once again, please read the FAQ and instructions before posting on the forum.
# I will not bother answering a question if the one who asked did not bother to
# read the instructions beforehand. I apologize if I sounded harsh, but it is
# quite unpleasant to be asked to repeat yourself over and over.
#
# On that, happy RPG Making. :)
#
# About the script provided in this file, it is the scene object, which
# provides the basic functionnality to implement a screen for switching
# characters in and out of the party. It works with three (3) other scripts,
# named Window_SwitchParty, Window_SwitchReserve and Window_SwitchStatus.
#------------------------------------------------------------------------------
# VERSION HISTORY
# ---------------
# 1.04: Fixed the incompatilibity with the legal version. Also updated the FAQ
# with a few more common questions, and added a link to the "official"
# topic at RMXP.net in the introduction.
#
# 1.03: Fixed the problem where characters that were subject to any of the
# listed event commands were automatically added to the reserve window.
# Commands: Enter Hero Name, Change HP, Change SP, Change Status
# Complete Healing, Change Experience Points, Change Level
# Change Basic Statistics, Change Skill, Change Equipped Items,
# Change Hero Name, Change Hero Class and Change Hero Graphic.
#
# No more need for setting Game_Party::actors writable, and
# Actor::actor_id readable.
#
# 1.02: Added "Known Issues" section, listing various problems you may
# encounter.
#
# 1.01: Now, the reserve window allows to have as many characters as it can
# fit. The default size is still 10, but if it is greater, it will scroll
# correctly.
#
# Removed a lot of useless/erroneous code.
#
# 1.00: Original version.
#------------------------------------------------------------------------------
# INSTRUCTIONS
# ------------
# 1- Open RPG Maker XP and go to the Script Editor.
# 2- Select script "Game_Actor"
# 3- Find the line "attr_reader :skills", and
# right below, add those two lines:
# attr_accessor :mandatory # if actor can be switched out [R/W]
# attr_accessor :unavailable # if actor appears in reserve [R/W]
# 4- Find the line "actor = $data_actors[actor_id]", which is right under
# "def setup(actor_id)", and add those two lines below:
# @mandatory = false
# @unavailable = true
# 5- Select script "Game_Actors"
# 6- Find the line "class Game_Actors", and right below, add this line:
# attr_reader :data # all initialized actors [R-O]
# 7- Select script "Game_Party"
# 8- Find the line "def setup_starting_members", and between the 4th and the
# 5th line below (between the two "end"), add those lines:
# for actor in @actors
# actor.unavailable = false
# end
# 9- Find the line "actor = $game_actors[actor_id]", and add those two lines
# right below:
# # newly-added characters are made "available" by default
# actor.unavailable = false
# 10- You are done with manual editing. :)
# 11- Create three new scripts. Put them preferably with the others "Window_"
# scripts for quicker reference. Call them "Window_SwitchParty",
# "Window_SwitchReserve", and "Window_SwitchStatus"
# 12- Copy the other three scripts in them.
# 13- Create a fourth script called "Scene_Switch" (Put this one in the Scene_
# scripts) and paste this file into it.
# 14- Click OK, then click File/Save.
#------------------------------------------------------------------------------
# HOW TO USE
# ----------
# To display this screen, just make an event, insert a Call RGSS Script command
# and paste the following code:
# $scene = Scene_Switch.new
#
# I suggest you put this code into a common event, so you do not have to
# remember the code everytime. The screen works very similarily to the party
# switching screens of other (commercial) RPGs. The left window lists the
# selected characters and the right window lists unselected characters that are
# available to be picked. Once you are satisfied with your new party, press B to
# return to the main screen.
#
# This is all there is to know if you simply want to use this screen. However,
# this provides two additional features. One allows to force a character in the
# party, the other make the character unpickable from the right (reserve)
# window.
#
# In most games, you absolutely need to have the main character in your party.
# Using a special feature of this script, it is possible to make a character
# unremovable. (Except by manually removing it.) To do this, create an event,
# add a Call RGSS Script command and paste the following code:
# $game_actors[12345].mandatory = true
# Similarily, if you want to make a character removable again, use this code:
# $game_actors[12345].mandatory = false
# return true # **SEE BUGS AND KNOWN ISSUES FOR THIS**
# In both examples, change 12345 for the number of the character you want to
# affect. For example, the first hero in the database is number 1, the second
# is number 2, etc... (Same numbers you use for the n[12345] commands in
# Show Message.
#
# Also, while the script makes automatically available a characters as soon as
# she/he joins the party, it cannot guess when you want them to leave your
# party. Just like above, there is a simple RGSS line that will do the work for
# us. To make a character unpickable in the switch screen, use this:
# $game_actors[12345].unavailable = true
# And to make it available again:
# $game_actors[12345].unavailable = false
# return true # **SEE BUGS AND KNOWN ISSUES FOR THIS**
#
# Since those two last features require you to modify the script, you cannot
# really put them in a common event like for showing the scene. BUT if you
# really hate having to put scripts manually and prefer using common events,
# you could do this:
# 1- Make a variable called "Switch Param" or something among those lines
# 2- Remember the number of the variable.
# 3- Make a common event called "Set Mandatory" and paste this line, replacing
# 12345 with the number of the variable "Switch Param":
# $game_actors[$game_variables[12345]].mandatory = true
# 4- Repeat for "Reset Mandatory", "Set Unavailable" and "Reset Unavailable"
# 5- When you want to do one of those operations, store the number of the
# character with Change Variable (i.e. 1 for the first hero in the
# database, 2 for the next, etc...) and use Call Common Event to execute
# the operation.
#
# Sometimes, you want the player to have a fixed amount of party members. By
# default, it allows the player to have one, two, three or four characters, but
# you can change this if you want. When you call the switching screen, either
# in an event or in a common event, you can pass parameters to limit the size
# of the party. Like this:
# $scene = Scene_Switch.new(false, 2, 4)
# The first parameters, "false" in this case, must always be "false" and is
# there only for those who intent to implement it in their menu. (Requires
# knowledge in Ruby.) The second parameter, "2", is the minimum amount of
# characters the player is allowed to select. The third, as you can guess, is
# the maximum amount allowed. So in this example, the new party can comprise
# only two, three or four characters, in other words, solos are not accepted.
#------------------------------------------------------------------------------
# BUGS / KNOWN ISSUES
# -------------------
# "This is not a bug, this is a feature." -- Bill Gates, Microsoft Corporation
#
# 1- Calling "$game_actors[12345].mandatory = false" freezes the game.
# This is supposed to be the normal behavior. If you evaluate an
# expression that returns false, the game is supposed to hang and call
# this script again and again until it returns true. Hence why I wrote a
# "return true" line below.
#
# HOWEVER, there is a bug in the default scripts of RPG Maker XP
# affecting this command, that make that special behavior happen ONLY
# when there the script contains only one line. If an expression that
# returns false has several lines, even if all other lines are comments,
# it will not hang the game like it is supposed to do. Of course, this
# bug has nothing to do with my script. You can try a random expression
# that returns false (i.e. "x = false") and you will get the same result,
# as long as the script has only one line.
#
# I have written a topic about it. The way that I wrote it is a little
# confusing, but if you are interested, you may consult it here:
# http://www.rmxp.net/forums/index.php?showtopic=20182
#------------------------------------------------------------------------------
# MINI-FAQ (Frequently Asked Questions)
# -------------------------------------
# Those are questions asked a lot on the old deleted topics, and also questions
# I got by email/PM. I do this from memory, since the deleted topic is...
# deleted! If I get other frequent questions I will add them here without
# increasing the version number.
#
# 1- I am getting "??? Syntax_Error ?" or "??? NoMethod_Error
# ?" errors!
# Unless you modified a part of this script, (in that case double-check
# your code) that is most probably because you made an error while
# editing the scripts (Game_Actors and Game_Party must be modified a
# little for this script to work) or you did not use a Call RGSS Script
# correctly.
#
# 2- Does this work mid-battle?
# No. That is because this screen is a "scene", just like the battle
# screen, and only one scene can be active at once. In other words, if
# you open this scene, you will have to close the battle screen. To make
# it work mid-battle, you will have to make this a sub-screen instead.
# This is not impossible to do, but you have no template or example in
# the default scripts.
#
# 3- How do I incorporate it in my menu?
# Assuming you know have a minimum RGSS knowledge... First prepare your
# menu. (Add a menu command, icon, whatever it takes.) Then call the
# screen like this:
# $scene = Scene_Switch.new(true)
# Set the party size limit if you need. Now, if you are using a modified
# default menu, find the line "$scene = Scene_Menu.new(0)" in
# update_party and set the parameter to the index of the switch command
# in the menu.
#
# 4- How do I allow more places in the reserve window?
# The reserve window will present 10 places by default, and will resize
# itself if you have more characters. But if you want even more places
# even though you do not have that amount of characters, when you call
# the screen, pass the amount of characters you want as a fourth
# parameter. Note that it will always be an even number though. If you
# request an odd number you will have one more place.
#
# 5- Is there a demo? Are there screenshots?
# I no longer use RPGXP, nor do I have it on my harddrive. I cannot do
# this. I would really appreciate if someone could do this though.
#
# 6- Is this script SDK-compatible?
# No. I do not support the SDK at all. I believe that it is not required,
# complicates the work of the coders, and is not even what a real SDK
# should be. I, however, am not trying to force my opinion upon you, so
# if someone were to adapt my work for the SDK, I would have no problem
# in adding a link to the SDK-ed version. Of course, if you have trouble
# with it, I would not be able to help, but at least, you will be given
# the choice.
#
# 7- Help! I do not see the fonts!
# That is because you are using a pirated version. The previous version
# of this script, which was written well before the legal English version
# came on the market, was adapted for the Postiality Knights edition. Now
# that a legal alternative is out, I adapted the script for it. That
# being said, the lines that supports the Postiality Knights edition are
# still in the scripts. I have simply put them in comment. Find them. I
# will keep those lines, unless someone with authority (a moderator or an
# administrator) insists that I delete those lines.
#------------------------------------------------------------------------------
# Version 1.04, by exseiken. March 16th, 2006
#==============================================================================

class Scene_Switch
#----------------------------------------------------------------------------
# Initialize the sub-screen.
#
# Parameters:
# from_menu: Determines whether or not the scene was called from
# the menu or not. Note that although it can return
# to the menu, it will not reposition the menu cursor
# to the right position. It will reposition it to the
# first position, which is usually "Items". You will
# have to edit this script.
# [true|false; default=false]
# min_party_size: The minimum amount of battlers you want to allow
# the player to select. [1-4; default=1]
# max_party_size: The maximum amount of battlers you want to allow
# the player to select. [1-4; default=4]
# reserve_size: How many places there are in the reserve window.
# [default=10]
#----------------------------------------------------------------------------
def initialize(from_menu = false, min_party_size = 1, max_party_size = 4, reserve_size = 10)
# store the data telling whether or not the scene was called from the menu
@from_menu = from_menu

# store the array founds for the max_party_size and the min_party_size
@min_party_size = [[min_party_size, 1].max, 4].min
@max_party_size = [[max_party_size, @min_party_size].max, 4].min

# store the desired reserve size
@reserve_size = reserve_size
end

#----------------------------------------------------------------------------
# The main routine, which controls the switching screen.
#----------------------------------------------------------------------------
def main
# create the window containing the current party members
@party_window = Window_SwitchParty.new

# create the window containing all available party members
@reserve_window = Window_SwitchReserve.new(@reserve_size)

# create the window showing information about the selected character, be it
# from the party window or from the reserve window
@status_window = Window_SwitchStatus.new

# unactivate the reserve_window
@reserve_window.active = false

# set this status window as the two other windows' help window
@party_window.help_window = @status_window
@reserve_window.help_window = @status_window

# display the transition
Graphics.transition

# enter the main loop
loop do
# flip the screen
Graphics.update

# get the keyboard/joypad status
Input.update

# update the sub-screen
update

# if the scene has changed, break out of the main loop
if $scene != self
break
end
end

# stop graphics updating
Graphics.freeze

# destroy the sub-windows
@status_window.dispose
@reserve_window.dispose
@party_window.dispose
end

#----------------------------------------------------------------------------
# Method called on every frame to update the screen's state.
#----------------------------------------------------------------------------
def update
# update all sub-windows
@party_window.update
@reserve_window.update
@status_window.update

# if the active screen is party_window, update it, else update the reserve
# window
if @party_window.active
update_party
else
update_reserve
end
end

#----------------------------------------------------------------------------
# Called when the focus is on the party window. Read on the keyboard and
# update the state of the scene according to the buttons pressed. If the
# played pressed B while this mode is on, the new party will be set and the
# scene will close.
#----------------------------------------------------------------------------
def update_party
# if the B (back) button was pressed, return to the preceeding screen
if Input.trigger?(Input::B)
# remove all holes in the party
new_party = @party_window.new_party.compact

# ensure that the number of party members is within the allowed range
unless (@min_party_size..@max_party_size).include?(new_party.size)
# play the buzzer and exit
$game_system.se_play($data_system.buzzer_se)
return
end

# play the confirm sound
$game_system.se_play($data_system.decision_se)

# set the new party
until $game_party.actors.size == 0
# empty the party
$game_party.remove_actor($game_party.actors[0].id)
end
for actor in new_party
# add the character to the party
$game_party.add_actor(actor.id)
end

# return to the screen who called
if @from_menu
$scene = Scene_Menu.new(0)
else
$scene = Scene_Map.new
end

# refresh the player's sprite
$game_player.refresh

# if the C (confirm) button was pressed, switch the control to the reserve
# window
elsif Input.trigger?(Input::C)
# if the selected character is not nil or is unavailable, play the buzzer
if @party_window.actor != nil and @party_window.actor.mandatory
# play the buzzer
$game_system.se_play($data_system.buzzer_se)
else
# play the decision sound
$game_system.se_play($data_system.decision_se)

# unactivate the party window
@party_window.active = false

# activate the reserve window
@reserve_window.active = true
end
end
end

#----------------------------------------------------------------------------
# Called when the focus is on the reserve window. Read on the keyboard and
# update the state of the scene according to the buttons pressed.
#----------------------------------------------------------------------------
def update_reserve
# if the B (back) button was pressed, give back the focus to the party
# window
if Input.trigger?(Input::B)
# play the cancel sound
$game_system.se_play($data_system.decision_se)

# unactivate the reserve window and activate the party window
@reserve_window.active = false
@party_window.active = true

# if the C (confirm) button was pressed, switch the party member in reserve
# with the one selected in the party
elsif Input.trigger?(Input::C)
# play the confirm sound
$game_system.se_play($data_system.decision_se)

# swap the 2 party members
@party_window.change_selection(@reserve_window.swap_characters(@party_window.actor))

# unactivate the reserve window and activate the party window
@reserve_window.active = false
@party_window.active = true
end
end
end



#==============================================================================
# Window_SwitchParty class definition
#------------------------------------------------------------------------------
# A window that displays all 4 character slots in the party, and offers a
# cursor to modify it.
#
# Read the instructions in the header of Scene_Switch before using!
#------------------------------------------------------------------------------
# Version 1.04, by exseiken. March 16th, 2006
#==============================================================================

class Window_SwitchParty < Window_Selectable
#----------------------------------------------------------------------------
# Public access variables
#----------------------------------------------------------------------------
attr_reader :new_party # party being built [R-O]

#----------------------------------------------------------------------------
# Constructor of the Window. Create and initialize its contents.
#----------------------------------------------------------------------------
def initialize
# create the window
super(0, 0, 256, 480)

# create the content bitmap
self.contents = Bitmap.new(self.width - 32, self.height - 32)

# *** N O T E ***
# -------------------------------------------------------------------------
# Now, this part is dependant on the translation of RPG Maker XP you are
# using. If you are using the legal version of RPGXP, leave this untouched.
# If you are using the illegal Postiality Knights edition and cannot see
# the font, uncomment (remove the '#') the pair of lines below.
# -------------------------------------------------------------------------

# self.contents.font.name = $defaultfonttype
# self.contents.font.size = $defaultfontsize

# make and store a copy of the actual party
@new_party = $game_party.actors.clone

# always 4 party members
@item_max = 4

# select the first slot
self.index = 0

# draw the contents of the window
refresh

# update the cursor rectangle
update_cursor_rect
end

#---------------------------------------------------------------------------
# Return the actor currently selected.
#---------------------------------------------------------------------------
def actor
# return the selected actor or nil if none
return @new_party[self.index]
end

#---------------------------------------------------------------------------
# Update the contents of the window: clear the contents bitmap, then rebuild
# it.
#---------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear

# draw each non-nill party member
for i in 0...@new_party.size
# get the actor
actor = @new_party[i]

# if the actor is valid, draw it on the screen
if actor != nil
# calculate the y coordinate
y = 116 * i

# draw the graphics of the actor
draw_actor_graphic(actor, 24, y + 80)

# print the name of the actor
draw_actor_name(actor, 64, y + 32)

# if the actor is not available, write in red "Cannot Move!"
if actor.mandatory
self.contents.font.color = Color.new(255, 0, 0, 255)
self.contents.draw_text(0, y, 224, 32, "Cannot Move!", 1)
end
end
end
end

#---------------------------------------------------------------------------
# Update the position rectangle of the cursor.
#---------------------------------------------------------------------------
def update_cursor_rect
# reset the cursor rectangle
self.cursor_rect.set(0, 116 * self.index, width - 32, 96)
end

#---------------------------------------------------------------------------
# Change the actor selected for another, then redraw the entire window.
#
# Parameters:
# actors: actor that will replace the selected one
#---------------------------------------------------------------------------
def change_selection(actor)
# change the actor (can be nil to remove it)
@new_party[self.index] = actor

# redraw the window
refresh
end

#---------------------------------------------------------------------------
# Update the help window. (Here, the help window is really the actor status
# window.)
#---------------------------------------------------------------------------
def update_help
# draw the stats of the selected actor, such as its name, level, status
# conditions and stats
@help_window.actor = @new_party[self.index]
end
end



#==============================================================================
# Window_SwitchReserve class definition
#------------------------------------------------------------------------------
# A window that displays all characters available to pick in the party. Offers
# a cursor to select them.
#
# Read the instructions in Scene_Switch's header before using!
#
# Version 1.03, by exseiken. August 8th, 2005
#==============================================================================

class Window_SwitchReserve < Window_Selectable
#----------------------------------------------------------------------------
# Window constructor. Create the contents bitmap and fill it with all
# characters that are not into the party, but that are loaded in the data
# member of the Game_Actors global object.
#
# Parameters:
# max_size: maximum of characters that can fit into that window
#----------------------------------------------------------------------------
def initialize(max_size)
# initialize the window and its contents
super(256, 128, 384, 352)

# initialize the list for the first time
@actor_list = $game_actors.data.clone

# set the maximum amount of characters the list can contain
@item_max = [max_size, @actor_list.size].max

# remove currently active party members
for actor in $game_party.actors
@actor_list[actor.id] = nil
end

# remove all actors that are unavailable
for actor in @actor_list
if not actor.nil? and actor.unavailable == true
@actor_list[actor.id] = nil
end
end

# remove all holes in the list
@actor_list.compact!

# set 2 columns
@column_max = 2

# select the first item but put unactive initially
self.index = 0
self.active = false

# create the contents bitmap
bmp_height = ((@item_max & 0xFE) << 5) + ((@item_max & 0x01) << 6)
self.contents = Bitmap.new(self.width - 32, bmp_height)

# *** N O T E ***
# -------------------------------------------------------------------------
# Now, this part is dependant on the translation of RPG Maker XP you are
# using. If you are using the legal version of RPGXP, leave this untouched.
# If you are using the illegal Postiality Knights edition and cannot see
# the font, uncomment (remove the '#') the pair of lines below.
# -------------------------------------------------------------------------

# self.contents.font.name = $defaultfonttype
# self.contents.font.size = $defaultfontsize

# draw the window's contents
refresh

# draw the cursor rectangle
update_cursor_rect
end

#----------------------------------------------------------------------------
# Completely redraw the contents of the window.
#----------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear

# display all actors
for i in 0...@actor_list.size
# get the concerned actor
actor = @actor_list[i]

# if the actor is non-nil, draw it
unless actor.nil?
# get the coordinates
x = (i % 2) == 1 ? self.width / @column_max : 0
y = (i / 2) * 64

# draw the actor's sprite
draw_actor_graphic(actor, x + 24, y + 48)

# draw the actor's name
draw_actor_name(actor, x + 64, y + 16)
end
end
end

#----------------------------------------------------------------------------
# Update the position rectangle of the cursor.
#----------------------------------------------------------------------------
def update_cursor_rect
# if the screen is not active or the cursor is invalid, don't display the
# cursor
if not self.active or self.index < 0
# set an empty cursor and exit
self.cursor_rect.empty
return
end

# get the row of the item
row = self.index / @column_max

# if the cursor went over the window, scroll up
if row < self.top_row
# set the top row as the current row
self.top_row = row
end

# if the cursor went farther than the bottom of the window, scroll down
if row > self.top_row + self.page_row_max - 1
# set the bottom row as the current row
self.top_row = row - self.page_row_max - 1
end

# set the width of the cursor
cursor_width = self.width / @column_max - 32

# get the upper-left coordinates of the window
x = self.index % @column_max * (cursor_width + 32)
y = self.index / @column_max * 64 - self.oy

# set the cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 64)
end

#----------------------------------------------------------------------------
# Takes a character, put it into the list at the selection position, and
# returns the character that was presently there. (If it was empty, it
# returns nil instead.)
#
# Parameters:
# actor_to_switch: character to put at the selected position
#----------------------------------------------------------------------------
def swap_characters(actor_to_switch)
# store the old actor (needed for swapping)
old_actor = @actor_list[self.index]

# put the new actor at the selected position
@actor_list[self.index] = actor_to_switch

# redraw the window
refresh

# return the old actor
return old_actor
end

#----------------------------------------------------------------------------
# Update the help window. (Here, the help window is really the actor status
# window.)
#----------------------------------------------------------------------------
def update_help
# draw the selected actor's name, level, status condition and stats
@help_window.actor = @actor_list[self.index]
end

#----------------------------------------------------------------------------
# Return the index of the top row, that is, the first row that is displayed
# on the window.
#----------------------------------------------------------------------------
def top_row
# divide the coordinate of the top of the bitmap by the cursor's height,
# 64, returning the index of the top row
return self.oy / 64
end

#----------------------------------------------------------------------------
# Validate, and set the top row too a new value. The validation makes sure
# that the new row is not off-limits.
#
# Parameters
# row: index of the row to be set as the new top row
#----------------------------------------------------------------------------
def top_row=(row)
# forces the new row to be positive
if row < 0
row = 0
end

# forces the new row to be less or equal to the maximum
if row > row_max - 1
row = row_max - 1
end

# return the top of the window by multiplying it by the height of the
# cursor (64)
self.oy = row * 64
end

#---------------------------------------------------------------------------
# Return the maximum amount of rows that can fit in the window without
# scrolling.
#---------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / 64
end
end


#==============================================================================
# Window_SwitchParty class definition
#------------------------------------------------------------------------------
# A window that displays the status of a character being selected.
#
# Read the instructions in the header of Scene_Switch before using!
#------------------------------------------------------------------------------
# Version 1.04, by exseiken. March 16th, 2006
#==============================================================================

class Window_SwitchStatus < Window_Base
#----------------------------------------------------------------------------
# Public access variables
#----------------------------------------------------------------------------
attr_reader :actor # the actor being displayed, or "nil" if none [R-O]

#----------------------------------------------------------------------------
# Constructs the window.
#----------------------------------------------------------------------------
def initialize
# initialize the window
super(256, 0, 384, 128)

# create the contents window
self.contents = Bitmap.new(width - 32, height - 32)

# *** N O T E ***
# -------------------------------------------------------------------------
# Now, this part is dependant on the translation of RPG Maker XP you are
# using. If you are using the legal version of RPGXP, leave this untouched.
# If you are using the illegal Postiality Knights edition and cannot see
# the font, uncomment (remove the '#') the pair of lines below.
# -------------------------------------------------------------------------

# self.contents.font.name = $defaultfonttype
# self.contents.font.size = $defaultfontsize

# no actor to draw presently
@actor = nil

# redraw
refresh
end

#----------------------------------------------------------------------------
# Redraw the window.
#----------------------------------------------------------------------------
def refresh
# clear the contents of the bitmap
self.contents.clear

# if the actor to draw is nil, leave the window empty
if @actor.nil?
return
end

# draw the graphics of the actor
draw_actor_graphic(@actor, 24, 64)

# draw information about the actor, such as the name, level and stats
# (HP/SP)
draw_actor_name(@actor, 64, 0)
draw_actor_level(@actor, 288, 0)
draw_actor_hp(@actor, 64, 32)
draw_actor_sp(@actor, 64, 64)
end

#----------------------------------------------------------------------------
# Change the actor being displayed by the window, then refresh the contents.
#
# Parameters:
# actor: actor to be displayed
#----------------------------------------------------------------------------
def actor=(actor)
# change and refresh only if the actor changed
unless actor == @actor
# set the actor
@actor = actor

# redraw
refresh
end
end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Atachment
첨부 '1'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
761 저장 심플 세이브 로드(1개의 세이브 사용하기) 3 백호 2009.02.22 1971
760 타이틀/게임오버 심심해서 구현해본 타이틀음악만으로 게임 플레이하기 2 백호 2009.02.22 1621
759 기타 실제시간표시스크립트입니다...[중뷁이면지성;;] 4 백호 2009.02.22 1349
758 HUD 시트르산의 나침반 스크립트 19 file 시트르산 2011.01.23 3195
757 액터 시트르산의 XP용 감정 말풍선 표시 스크립트 37 file 시트르산 2011.01.25 6110
756 기타 시작하자 마자 풀 스크린 2 백호 2009.02.21 1082
755 시스템2C 4 file 글러브111 2011.01.15 2118
754 전투 시뮬레이션 턴알 3 file 백호 2009.02.21 3054
753 메뉴 스테이터스 화면에 넥스트 표시 1 file 백호 2009.02.21 1758
752 메뉴 스테이터스 화면 from Harts Horn 2 백호 2009.02.22 1571
751 기타 스테이터스 표시 플러스 1.00ver 백호 2009.02.22 1141
750 메뉴 스테이터스 일람 스크립트 file 백호 2009.02.21 1328
749 메뉴 스탯올리기 시스템 (액알가능) 27 file 백호 2009.02.22 3404
748 스탯 포인트 시스템 3차수정 ( ' 백호 ' 님이 올리신 자료 수정.) 26 카이어덱터 2010.01.04 3345
747 기타 스탯 13 file 이안 2010.01.17 2320
746 기타 스탭 롤 9 file 허걱 2009.08.13 2905
745 스킬 스킬창 업그레이드? ps인간 2009.01.23 3061
744 스킬 스킬제휴 스크립트 file 백호 2009.02.21 1294
743 스킬 스킬샵 스크립트 16 file 독도2005 2009.08.24 4219
742 스킬 스킬북 스크립트 8 WMN 2008.03.17 2452
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 52 Next
/ 52