赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 5934 |
最后登录 | 2020-6-8 |
在线时间 | 229 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 235
- 在线时间
- 229 小时
- 注册时间
- 2011-6-2
- 帖子
- 25
|
请问如何解决以下问题,每当我要加入第五十名或以上的NPC成为队员就会出现208行的问题。
$as.as[self.id][skill_id] = $as.maxas[self.id][skill_id]
要如何更改脚本才可以加入更多的NPC。
我的游戏设计只有四名队员,但是可以加入的队员有99名,可是现在游戏出现问题在第五十名队员中。
请求各位人士帮助解决问题,非常感谢各位!!
以下就是原本的脚本。
#------------------------------------------------------------------------------
# ■ 装备技能修炼v1.0(VX)
# by:Ultra
# 1.0(XP)
# /2010.5.29
# 1.0(VX)
# /2010.7.12
# -添加了VX专属条形槽(RGSS2渐变描绘)
# -添加了VX双手武器的判断
# -部分逻辑的改变
#------------------------------------------------------------------------------
# -AP条形槽设定
#----类型
#1:正常 2:渐变型 3:自定义
$VXAS_AP = 3
#----背景的颜色[r,g,b,o]
$VXAS_B = [0,0,0,200]
#----自定义渐变条形槽
$VXAS_K = [255,255,255,0] #边框颜色[r,g,b,o]
$VXAS_RGBO1 = [50,100,200,255] #始渐变色[r,g,b,o]
$VXAS_RGBO2 = [180,200,50,255] #终渐变色[r,g,b,o]
#~ -武器 防具对应的技能:
#~ ----在武器,防具名称最后加上 @技能ID
#~ ----例如:铜剑@20★ 铜剑的对应技能为 20 号
#~ -AP增减方法:
#~ ----全队员增加 $as.gain_ap(5,$as.sk) ★全部队员技能 ap+5
#~ ----详细角色增加 $as.gain_ap(33,{1=>[1,2,3],7=>[2]}) ★1号角色技能1,2,3号 ap+33,7号角色技能2号 ap+33
#~ ----多角色增加
#~ for i in 1..8
#~ $as.gain_ap(10,$as.sk(2,i)) ★1到8号角色技能 ap+10
#~ end
#~ ----减少ap方法同上,gain_ap改为lose_ap即可
#~ -AP最大值设定:
#~ ----脚本24行
#~ -战斗胜利获得的AP:
#~ ----在敌人队伍名称最后加上 @AP值
#~ ----例如:幽灵*2@10 ★ 战斗胜利 全部队员 ap+10
#~ -检查更新AP的方法:
#~ ----$game_actors[id].iniek ★ 正常情况下不会用到。(注明此方法以提供需求用户使用)
#~ -事件的 增减特技:
#~ ----1:如果减少技能时,这个技能正被角色装备中,是无效的(减不掉)
#~ ----2:与 1 相反(即没装备中),是可以遗忘的(ap=0)
#~ ----3:增加时,该技能的ap直接满(直接习得)
#~ -事件的‘更改角色职业’
#~ ----更改职业时被脱下装备时,它的技能也会遗忘(ap值保留,改回职业时 可以继续修炼这个技能)
#~ ----这样设定希望你可以更好的做到‘职业平衡’的效果
#------------------------------------------------------------------------------
class As
attr_accessor :as
attr_accessor :maxas
def initialize
@as = {}
@maxas = {}
for i in 1...$data_actors.size
@as[i] = []
for n in 0...$data_skills.size
@as[i][n] = 0
end
end
for i in 1...$data_actors.size
@maxas[i] = []
for n in 0...$data_skills.size
@maxas[i][n] = 100
end
end
##################MAXAP##################
#基本设定方法
@maxas[1][10] = 10 # 1号角色10号技能最大ap=888
@maxas[1][82] = 999
##################MAXAP##################
end
def sk(n = 0,w = 0)
@data = []
@data_s = {}
case n
when 0
for b in 0...$game_party.members.size
actor = $game_party.members[b]
for i in 0...$game_party.members[b].skills.size
skill = $game_party.members[b].skills[i]
if skill != nil
@data.push(skill.id)
end
end
@data_s[actor.id] = @data
@data = []
end
when 1
actor = $game_party.members[w]
for i in 0...$game_party.members[w].skills.size
skill = $game_party.members[w].skills[i]
if skill != nil
@data.push(skill.id)
end
end
@data_s[actor.id] = @data
@data = []
when 2
actor = $game_actors[w]
for i in 0...$game_actors[w].skills.size
skill = $game_actors[w].skills[i]
if skill != nil
@data.push(skill.id)
end
end
@data_s[actor.id] = @data
@data = []
end
return @data_s
end
def gain_ap(s,id ={})
for b in id.keys
for i in 0...id[b].size
max = @maxas[b][id[b][i]]
if not max == nil
@as[b][id[b][i]] += s
if @as[b][id[b][i]] >= max
@as[b][id[b][i]] = max
end
end
end
end
end
def lose_ap(s,id ={})
for b in id.keys
for i in 0...id[b].size
@as[b][id[b][i]] -= s
if @as[b][id[b][i]] <= 0
@as[b][id[b][i]] = 0
end
end
end
end
#actor_id:角色ID skill_id[id,newid]:技能ID ewhy:0=旧装备 1=新装备 2=空白装备 3=空白物品
def lf_ap(actor_id,ewhy,skill_id=[])
if ewhy == 0
$game_actors[actor_id].learn_skills(skill_id[0])
elsif ewhy == 1
eap = $as.as[actor_id][skill_id[0]] == $as.maxas[actor_id][skill_id[0]] ? true : false
if eap == true
$game_actors[actor_id].learn_skills(skill_id[0])
$game_actors[actor_id].learn_skills(skill_id[1])
else
$game_actors[actor_id].forget_skills(skill_id[0])
$game_actors[actor_id].learn_skills(skill_id[1])
end
elsif ewhy == 2
$game_actors[actor_id].learn_skills(skill_id[1])
elsif ewhy == 3
eap = $as.as[actor_id][skill_id[0]] == $as.maxas[actor_id][skill_id[0]] ? true : false
if eap == true
$game_actors[actor_id].learn_skills(skill_id[0])
else
$game_actors[actor_id].forget_skills(skill_id[0])
end
end
end
end
class Game_Actor
def equippable_as?(item)
if item.is_a?(RPG::Weapon)
v = self.class.weapon_set.include?(item.id)
if !v
aek = $data_weapons[item.id].aek
$as.lf_ap(self.id,3,[aek]) if aek != nil
end
return v
end
if item.is_a?(RPG::Armor)
v = self.class.armor_set.include?(item.id)
if !v
aek = $data_armors[item.id].aek
$as.lf_ap(self.id,3,[aek]) if aek != nil
end
return false if two_swords_style and item.kind == 0
return v
end
return false
end
def class_id=(class_id)
@class_id = class_id
for i in 0..4 # 卸下不可装备的装备物品
change_equip(i, nil) unless equippable_as?(equips[i])
end
end
def iniek
data = equips
data.compact!
for i in 0...data.size
if data[i].aek != nil
$as.lf_ap(self.id,0,[data[i].aek])
end
end
end
def skill_aek
data = equips
data2 = []
data.compact!
for i in 0...data.size
if data[i].aek != nil
data2.push(data[i].aek)
end
end
return data2
end
def learn_skill(skill_id)
unless skill_learn?($data_skills[skill_id])
$as.as[self.id][skill_id] = $as.maxas[self.id][skill_id]
@skills.push(skill_id)
@skills.sort!
end
end
def forget_skill(skill_id)
skill_aek = $game_actors[self.id].skill_aek
if not skill_aek.include?(skill_id)
$as.as[self.id][skill_id] = 0
@skills.delete(skill_id)
end
end
def learn_skills(skill_id)
unless skill_learn?($data_skills[skill_id])
@skills.push(skill_id)
@skills.sort!
end
end
def forget_skills(skill_id)
@skills.delete(skill_id)
end
def change_equip(equip_type, item, test = false)
last_item = equips[equip_type]
unless test
return if $game_party.item_number(item) == 0 if item != nil
$game_party.gain_item(last_item, 1)
$game_party.lose_item(item, 1)
end
item_id = item == nil ? 0 : item.id
case equip_type
when 0 # 武器
@weapon_id = item_id
unless two_hands_legal? # 非双手装备的场合,自动卸下装备
#★VX★
aek = $data_armors[equips[1].id].aek
$as.lf_ap(self.id,3,[aek]) if aek != nil
change_equip(1, nil, test)
#★VX★
end
when 1 # 盾
@armor1_id = item_id
unless two_hands_legal? # 非双手装备的场合,自动卸下装备
#★VX★
aek = $data_weapons[equips[0].id].aek
$as.lf_ap(self.id,3,[aek]) if aek != nil
#★VX★
change_equip(0, nil, test)
end
when 2 # 头部防具
@armor2_id = item_id
when 3 # 身体防具
@armor3_id = item_id
when 4 # 装饰品
@armor4_id = item_id
end
end
end
class Game_Party
def setup_starting_members
@actors = []
for i in $data_system.party_members
@actors.push(i)
$game_actors[i].iniek
end
end
def add_actor(actor_id)
if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
$game_actors[actor_id].iniek
@actors.push(actor_id)
$game_player.refresh
end
end
end
module RPG
class Troop
def name
name = @name.split(/@/)[0]
return name != nil ? name : ""
end
def ap
ap = @name.split(/@/)[1]
return ap != nil ? ap.to_i : 0
end
end
class Armor
def name
name = @name.split(/@/)[0]
return name != nil ? name : ""
end
def aek
aek = @name.split(/@/)[1]
return aek != nil ? aek.to_i : nil
end
end
class Weapon
def name
name = @name.split(/@/)[0]
return name != nil ? name : ""
end
def aek
aek = @name.split(/@/)[1]
return aek != nil ? aek.to_i : nil
end
end
end
class Window_Base < Window
def draw_actor_ap(actor_id,skill_id,x,y,width = 128,value = false)
as = $as.as[actor_id][skill_id]
maxas = $as.maxas[actor_id][skill_id]
r = 10
g = 100
b = 255
r2 = 100
g2 = 200
b2 = 150
o = 255
color_b = Color.new(55,180,255,200)
w = width * as / maxas
y += 14
#背景
self.contents.fill_rect(x, y, width, 4,
Color.new($VXAS_B[0],$VXAS_B[1],$VXAS_B[2],$VXAS_B[3]))
#描绘
if $VXAS_AP == 1
color_b = Color.new(55,180,255,255)
self.contents.fill_rect(x, y, w, 1,Color.new(r+46,g+79,b+12,o))
self.contents.fill_rect(x, y+1, w, 1,Color.new(r+46,g+79,b+10,o))
self.contents.fill_rect(x, y+2, w, 1,Color.new(r+13,g+59,b-41,o))
self.contents.fill_rect(x, y+3, w, 1,Color.new(r+18,g+73,b-43,o))
elsif $VXAS_AP == 2
color_b = Color.new(255,255,255,255)
self.contents.gradient_fill_rect(x, y, w, 1,
Color.new(r+46,g+79,b+12,o),Color.new(r2+46,g2+79,b2+12,o))
self.contents.gradient_fill_rect(x, y+1, w, 1,
Color.new(r+46,g+79,b+10,o),Color.new(r2+46,g2+79,b2+10,o))
self.contents.gradient_fill_rect(x, y+2, w, 1,
Color.new(r+13,g+59,b-41,o),Color.new(r2+13,g2+59,b2-41,o))
self.contents.gradient_fill_rect(x, y+3, w, 1,
Color.new(r+18,g+73,b-43,o),Color.new(r2+18,g2+73,b2-43,o))
elsif $VXAS_AP == 3 && !$VXAS_RGBO1.empty? && !$VXAS_RGBO2.empty?
color_b = Color.new($VXAS_K[0],$VXAS_K[1],$VXAS_K[2],$VXAS_K[3])
r = $VXAS_RGBO1[0]
g = $VXAS_RGBO1[1]
b = $VXAS_RGBO1[2]
o = $VXAS_RGBO1[3]
r2 = $VXAS_RGBO2[0]
g2 = $VXAS_RGBO2[1]
b2 = $VXAS_RGBO2[2]
o2 = $VXAS_RGBO2[3]
self.contents.gradient_fill_rect(x, y, w, 1,
Color.new(r+46,g+79,b+12,o),Color.new(r2+46,g2+79,b2+12,o2))
self.contents.gradient_fill_rect(x, y+1, w, 1,
Color.new(r+46,g+79,b+10,o),Color.new(r2+46,g2+79,b2+10,o2))
self.contents.gradient_fill_rect(x, y+2, w, 1,
Color.new(r+13,g+59,b-41,o),Color.new(r2+13,g2+59,b2-41,o2))
self.contents.gradient_fill_rect(x, y+3, w, 1,
Color.new(r+18,g+73,b-43,o),Color.new(r2+18,g2+73,b2-43,o2))
else
color_b = Color.new(55,180,255,255)
self.contents.fill_rect(x, y, w, 1,Color.new(r+46,g+79,b+12,o))
self.contents.fill_rect(x, y+1, w, 1,Color.new(r+46,g+79,b+10,o))
self.contents.fill_rect(x, y+2, w, 1,Color.new(r+13,g+59,b-41,o))
self.contents.fill_rect(x, y+3, w, 1,Color.new(r+18,g+73,b-43,o))
end
#边框
self.contents.fill_rect(x-1, y-1, width+2, 1, color_b)
self.contents.fill_rect(x-1, y+4, width+2, 1, color_b)
self.contents.fill_rect(x-1, y, 1, 4, color_b)
self.contents.fill_rect(x+width, y, 1, 4, color_b)
self.contents.font.size = 15
name = $data_skills[skill_id].name
self.contents.draw_text(x-20, y-22, 48, 32, "Ap")
self.contents.draw_text(x, y-(11+14), 68, 32, name)
self.contents.font.size = 15
unless value
self.contents.draw_text(x+width, y-15, 20, 32, as.to_s, 2)
self.contents.draw_text(x+width+20, y-15, 12, 32, "/", 1)
self.contents.draw_text(x+width+20+12, y-15, 20, 32, maxas.to_s)
end
self.contents.font.size = Font.default_size
end
end
#-------------------------------------------------------------------------------
class Scene_Title
alias :orig_create_game_objects :create_game_objects
def create_game_objects
orig_create_game_objects
#★★★★★★★★★★★★★★★★★★★
$as = As.new
#★★★★★★★★★★★★★★★★★★★
end
end
class Window_Help
def set_es(text,actor_id,aek)
if text != @text
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, WLH, text)
draw_actor_ap(actor_id,aek,380,4,80)
@text = text
end
end
end
class Window_Equip
def refresh
self.contents.clear
@data = []
for item in @actor.equips do @data.push(item) end
@item_max = @data.size
self.contents.font.color = system_color
if @actor.two_swords_style
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
else
self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
end
self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
draw_item_name(@data[0], 62, WLH * 0)
draw_item_name(@data[1], 62, WLH * 1)
draw_item_name(@data[2], 62, WLH * 2)
draw_item_name(@data[3], 62, WLH * 3)
draw_item_name(@data[4], 62, WLH * 4)
#★★★★★★★★★★★★★★★★★★★
x=190
for i in 0..4
if @data[i] != nil and @data[i].aek != nil
if $as.maxas[@actor.id][@data[i].aek] == nil
return
else
self.contents.font.size = 15
draw_actor_ap(@actor.id,@data[i].aek,x+15,4+WLH*i,80,true)
self.contents.font.size = Font.default_size
end
end
end
#★★★★★★★★★★★★★★★★★★★
end
def update_help
if item != nil && item.aek != nil
@help_window.set_es(item.description,@actor.id,item.aek)
else
@help_window.set_text(item == nil ? "" : item.description)
end
end
end
class Window_Item
def update_help
if item != nil && item.aek != nil && @actor != nil
@help_window.set_es(item.description,@actor.id,item.aek)
else
@help_window.set_text(item == nil ? "" : item.description)
end
end
end
class Scene_Equip
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
#★★★★★★★★★★★★★★★★★★★
item = @item_window.item
i = @equip_window.item
if i.id == item.id
elsif i.id != item.id and i != nil and item != nil
if i.aek != nil and item.aek != nil
$as.lf_ap(@actor.id,1,[i.aek,item.aek])
elsif i.aek != nil
$as.lf_ap(@actor.id,3,[i.aek,nil])
elsif item.aek != nil
$as.lf_ap(@actor.id,2,[nil,item.aek])
end
elsif i == nil
if item.aek != nil
$as.lf_ap(@actor.id,2,[nil,item.aek])
end
elsif item == nil
if i.aek != nil
$as.lf_ap(@actor.id,3,[i.aek,nil])
end
end
#★★★★★★★★★★★★★★★★★★★
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end
class Scene_File
alias :orig_write_save_data :write_save_data
def write_save_data(file)
orig_write_save_data(file)
Marshal.dump($as,file)
end
alias :orig_read_save_data :read_save_data
def read_save_data(file)
orig_read_save_data(file)
$as = Marshal.load(file)
end
end
class Scene_Battle
alias :orig_process_victory :process_victory
def process_victory
orig_process_victory
#★★★★★★★★★★★★★★★★★★★
ap = $game_troop.troop.ap
$as.gain_ap(ap,$as.sk)
#★★★★★★★★★★★★★★★★★★★
end
end |
|