赞 | 5 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 620
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
脚本更新
- 2009/2/11
* 放出半成品
- 2009/2/15
* 支援功能:主角装备可以设定成纸娃娃部件
预计下次更新:
支援角色加上胡须、疤痕的部件(素材制作中)
设定方式:
在武器/防具的备注里面添加
*charapart 文件名 优先度
乃设定该武器/装备的行走图,
优先度留空的话,使用默认设定
行走图的index与角色一致
急需素材完成:http://rpg.blue/viewthread.php?tid=118515
范例:点我下载
进入游戏後会看到灰发的拉尔夫
与右边的女孩对话,进入颜色设定
按L、R调整RGB的亮度,右边会显示出效果
设定完毕後按取消键退出,就可以看到效果了
然後进入装备画面,卸下武器,回到地图看看效果
脚本:
主要部分
- #==============================================================================
- # ■ Sprite_Character
- #------------------------------------------------------------------------------
- # 角色显示用脚本。监视 Game_Character 类的实例、自动变化脚本状态。
- #==============================================================================
- class Sprite_Character < Sprite_Base
- alias snstar2006_zhiwawa_initialize initialize
- def initialize(viewport, character = nil)
- if character.paper_doll?
- @chara_part_sprites = {}
-
- chara_w_part_sprite = Sprite.new
- chara_a1_part_sprite = Sprite.new
- chara_a2_part_sprite = Sprite.new
- chara_a3_part_sprite = Sprite.new
- chara_a4_part_sprite = Sprite.new
-
- chara_h_part_sprite = Sprite.new
- chara_s_part_sprite = Sprite.new
- chara_e_part_sprite = Sprite.new
- chara_b_part_sprite = Sprite.new
-
- @chara_part_sprites["weapon"] = [chara_w_part_sprite, 3]
- @chara_part_sprites["armor"] = [chara_a1_part_sprite, 1]
- @chara_part_sprites["helmet"] = [chara_a2_part_sprite, 9]
- @chara_part_sprites["shield"] = [chara_a3_part_sprite, 10]
- @chara_part_sprites["accesory"] = [chara_a4_part_sprite, 1]
-
- @chara_part_sprites["hair"] = [chara_h_part_sprite, 4]
- @chara_part_sprites["eye"] = [chara_e_part_sprite, 2]
- @chara_part_sprites["beard"] = [chara_b_part_sprite, 4]
- @chara_part_sprites["scar"] = [chara_s_part_sprite, 3]
-
- end
- snstar2006_zhiwawa_initialize(viewport, character)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- alias snstar2006_zhiwawa_update update
- def update
- snstar2006_zhiwawa_update
- if @character.paper_doll?
- # 更新部件座标
- update_parts("weapon")
- update_parts("armor")
- update_parts("helmet")
- update_parts("shield", true)
- update_parts("accesory")
-
- update_parts("hair")
- update_parts("eye")
- update_parts("beard")
- update_parts("scar")
- end
-
- end
- #--------------------------------------------------------------------------
- # ● 更新部件
- # l 左手持的防具/武器
- #--------------------------------------------------------------------------
- def update_parts(type, l=false)
- # 获取精灵物件
- sprite = @chara_part_sprites[type][0]
- case type
- when "weapon"
- # 获取武器部件
- wid = $game_player.weapon_id
- pic_name = wid > 0 ? $data_weapons[wid].part[0] : ""
- prty = wid > 0 ? $data_weapons[wid].part[1] : 0
- when "helmet"
- # 获取头部部件
- aid = $game_player.armor2_id
- pic_name = aid > 0 ? $data_armors[aid].part[0] : ""
- prty = aid > 0 ? $data_weapons[aid].part[1] : 0
- when "armor"
- # 获取盔甲部件
- aid = $game_player.armor3_id
- pic_name = aid > 0 ? $data_armors[aid].part[0] : ""
- prty = aid > 0 ? $data_weapons[aid].part[1] : 0
- when "shield"
- # 获取盾牌部件
- aid = $game_player.armor1_id
- pic_name = aid > 0 ? $data_armors[aid].part[0] : ""
- prty = aid > 0 ? $data_weapons[aid].part[1] : 0
- when "accesory"
- # 获取饰品部件
- aid = $game_player.armor4_id
- pic_name = aid > 0 ? $data_armors[aid].part[0] : ""
- prty = aid > 0 ? $data_weapons[aid].part[1] : 0
- when "hair"
- # 获取发型部件
- pic_name = "hair1"
- prty = 0
- $color ||= Color.new(255, 0, 0, 64)
- sprite.color = $color
- when "eye"
- # 获取眼睛部件
- pic_name = ""
- prty = 0
- when "scar"
- # 获取疤痕部件
- pic_name = ""
- prty = 0
- when "beard"
- # 获取胡须部件
- pic_name = ""
- prty = 0
- else
- pic_name = ""
- prty = 0
- end
-
- # 设定精灵物件
- sprite.bitmap = Cache.charapart(pic_name)
- sprite.src_rect = self.src_rect
- sprite.x = (self.x - 32)
- sprite.y = (self.y - 64)
- d = @character.direction
- k = (d%4==0 ? -101 : 10)
- #sprite.z = @character.screen_z
- @chara_part_sprites[type][1] = prty if prty > 0
- pr = @chara_part_sprites[type][1]
- case d
- when 2
- sprite.z = self.z + pr
- when 4
- sprite.z = self.z + (l ? pr : -pr)
- when 6
- sprite.z = self.z - (l ? pr : -pr)
- when 8
- sprite.z = self.z - pr
- end
- if Input.trigger?(Input::X) and type == "shield"
- p [type, pr]
- end
- end
-
- alias snstar2006_zhiwawa_dispose dispose
- def dispose
- if @character.paper_doll?
- @chara_part_sprites.clear
- end
- snstar2006_zhiwawa_dispose
- end
- end
- class Game_Player < Game_Character
- def weapon_id
- return $game_party.members[0].weapon_id
- end
- def armor1_id
- return $game_party.members[0].armor1_id
- end
- def armor2_id
- return $game_party.members[0].armor3_id
- end
- def armor3_id
- return $game_party.members[0].armor3_id
- end
- def armor4_id
- return $game_party.members[0].armor4_id
- end
- def paper_doll?
- return true
- end
- def actor?
- return true
- end
- end
- class Game_Character
- def paper_doll?
- return false
- end
- def actor?
- return false
- end
- end
- module Cache
- #--------------------------------------------------------------------------
- # * 获取角色行走图部件图档
- # filename : 文件名
- #--------------------------------------------------------------------------
- def self.charapart(filename)
- if filename == ""
- return Bitmap.new(64, 64)
- else
- load_bitmap("Graphics/Characters/parts/", filename)
- end
- end
- end
- module PaperDoll
- def part
- self.note.split(/[\r\n]+/).each { |line|
- if line =~ /\*charapart (\w*|use_icon)(?: (\d*)|)/
- name = $1
- name = self.icon_index if $1 == "use_icon"
- return [name, $2.to_i] if $2
- return [name, 0]
- end
- }
- return [name, 0]
- end
- end
- class RPG::Weapon < RPG::BaseItem
- include PaperDoll
- end
- class RPG::Armor < RPG::BaseItem
- include PaperDoll
- end
复制代码
编辑部分(现在只有调整发色功能)
- #~ class Window_Base < Window
- #~ alias snstar2006_zhiwawa_initialize initialize
- #~ def initialize(x, y, width, height)
- #~ snstar2006_zhiwawa_initialize(x, y, width, height)
- #~ @character_sprite = []
- #~ end
- #~ def draw_character(character_party_index, x, y)
- #~ i = character_party_index
- #~ v = self.viewport
- #~ @character_sprite[i] ||= Sprite_Character.new(v, $game_party.members[i])
- #~ @character_sprite[i].visible = true
- #~ end
- #~ end
- class Window_ChooseColor < Window_Selectable
- def initialize(x, y)
- super(x, y, 176, 128)
- @item_max = 4
- @column_max = 1
- @red ||= 0
- @green ||= 0
- @blue ||= 0
- @alpha ||= 64
- @color_R1 = Color.new(0, 0, 0)
- @color_R2 = Color.new(255, 0, 0)
- @color_G1 = Color.new(0, 0, 0)
- @color_G2 = Color.new(0, 255, 0)
- @color_B1 = Color.new(0, 0, 0)
- @color_B2 = Color.new(0, 0, 255)
- self.color = $color
- @arrow_R_sprite = Sprite.new
- @arrow_G_sprite = Sprite.new
- @arrow_B_sprite = Sprite.new
- @arrow_A_sprite = Sprite.new
- @arrow_R_sprite.bitmap = @arrow_G_sprite.bitmap = @arrow_B_sprite.bitmap = @arrow_A_sprite.bitmap = Cache.system("Window")
- @arrow_R_sprite.src_rect = @arrow_G_sprite.src_rect = @arrow_B_sprite.src_rect = @arrow_A_sprite.src_rect = Rect.new(96, 80, 16, 16)
- @arrow_R_sprite.x = self.x + 48 + (64*@red/255)
- @arrow_G_sprite.x = self.x + 48 + (64*@green/255)
- @arrow_B_sprite.x = self.x + 48 + (64*@blue/255)
- @arrow_A_sprite.x = self.x + 48 + (64*@alpha/255)
- @arrow_R_sprite.z = @arrow_G_sprite.z = @arrow_B_sprite.z = @arrow_A_sprite.z = self.x + 100
- @arrow_R_sprite.y = y + 8
- @arrow_G_sprite.y = y + 32
- @arrow_B_sprite.y = y + 56
- @arrow_A_sprite.y = y + 80
-
- refresh
- end
- def refresh
- self.contents.clear
- @color_R1.set(0, @green , @blue)
- @color_R2.set(255, @green , @blue)
- @color_G1.set(@red, 0 , @blue)
- @color_G2.set(@red, 255 , @blue)
- @color_B1.set(@red, @green , 0)
- @color_B2.set(@red, @green , 255)
- c1 = color.clone
- c2 = color.clone
- c1.alpha = 0
- c2.alpha = 255
- self.contents.draw_text(0, 0, 24, WLH, "R")
- self.contents.draw_text(0, 24, 24, WLH, "G")
- self.contents.draw_text(0, 48, 24, WLH, "B")
- self.contents.draw_text(0, 72, 24, WLH, "A")
- self.contents.draw_text(12, 0, 24, WLH, @red)
- self.contents.draw_text(12, 24, 24, WLH, @green)
- self.contents.draw_text(12, 48, 24, WLH, @blue)
- self.contents.draw_text(12, 72, 24, WLH, @alpha)
- self.contents.gradient_fill_rect(40, 8, 64, 8, @color_R1, @color_R2)
- self.contents.gradient_fill_rect(40, 32, 64, 8, @color_G1, @color_G2)
- self.contents.gradient_fill_rect(40, 56, 64, 8, @color_B1, @color_B2)
- self.contents.gradient_fill_rect(40, 80, 64, 8, c1, c2)
- self.contents.fill_rect(120, 0, 24, 96, Color.new(0, 0, 0, 255))
- self.contents.fill_rect(122, 2, 20, 92, color)
- end
- def update
- super
- if Input.repeat?(Input::L) or Input.repeat?(Input::R)
- self.contents.clear
- kkk = 8 if Input.repeat?(Input::R)
- kkk = -8 if Input.repeat?(Input::L)
- case @index
- when 0
- @red += kkk
- @red = [[@red, 0].max, 255].min
- @arrow_R_sprite.x = self.x + 48 + (64*@red/255)
- when 1
- @green += kkk
- @green = [[@green, 0].max, 255].min
- @arrow_G_sprite.x = self.x + 48 + (64*@green/255)
- when 2
- @blue += kkk
- @blue = [[@blue, 0].max, 255].min
- @arrow_B_sprite.x = self.x + 48 + (64*@blue/255)
- when 3
- @alpha += kkk
- @alpha = [[@alpha, 0].max, 255].min
- @arrow_A_sprite.x = self.x + 48 + (64*@alpha/255)
- end
- refresh
- end
- end
- def dispose
- @arrow_R_sprite.dispose
- @arrow_G_sprite.dispose
- @arrow_B_sprite.dispose
- @arrow_A_sprite.dispose
- super
- end
- def color
- return Color.new(@red, @green, @blue, @alpha)
- end
- def color=(c)
- @red = (c.red - c.red%8).to_i
- @green = (c.green - c.green%8).to_i
- @blue = (c.blue - c.blue%8).to_i
- @alpha = (c.alpha - c.alpha%8).to_i
- end
- def item_rect(index)
- rect = Rect.new(32, 0, 80, 24)
- rect.y = index / @column_max * WLH
- return rect
- end
- end
- class Scene_Character < Scene_Base
- def start
- @color_window = Window_ChooseColor.new(0, 0)
- @color_window.active = true
- @color_window.index = 0
- @color_window.color = $color
- end
- def update
- @color_window.update
- if Input.trigger?(Input::B)
- $scene = Scene_Map.new
- end
- end
- def terminate
- $color = @color_window.color
- @color_window.dispose
- end
- end
复制代码 |
|