soulsaga 发表于 2023-8-15 13:20
你怎么问问题的..?
标题连问题都不是
别连问题都省略了
金芒芒 发表于 2023-8-15 13:52
如何通过角色的名字获得角色的id
soulsaga 发表于 2023-8-15 14:02
你得发完整脚本..这样没法判断
发脚本用高级回复右边的双向箭头那添加代码文字发 ...
soulsaga 发表于 2023-8-15 14:02
你得发完整脚本..这样没法判断
发脚本用高级回复右边的双向箭头那添加代码文字发 ...
soulsaga 发表于 2023-8-15 14:02
你得发完整脚本..这样没法判断
发脚本用高级回复右边的双向箭头那添加代码文字发 ...
金芒芒 发表于 2023-8-15 14:24
链接: https://pan.baidu.com/s/1KJn_NAhSX7Nx5LnkL2w1zA?pwd=727z 提取码: 727z 复制这段内容后打开百度 ...
p Figter_data::CHARACTER_NAME.index("甲")#==>2
soulsaga 发表于 2023-8-15 15:05
假设甲的ID是2
甲是CHARACTER_NAME数组里第3个单元
这样写
#============================================================================== # ■ Window_Title_Command #------------------------------------------------------------------------------ # 标题的主菜单。 #============================================================================== #类窗口自定义战斗<基础窗口 class Window_CustomBattle < Window_Base # attr_reader :index #属性读取器:索引 attr_reader :v_index #属性读取器:v_索引 attr_reader :slide_over #属性读取器:#滚动结束 attr_reader :item_max #属性阅读器:项目最大值 attr_reader :second_index #属性阅读器: 第二个索引 #start load option exit #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- #定义初始化(索引=0,团队编号=5,点编号=10,玩家或敌人=0) def initialize(index=0,team_num = 5,spots_num = 10,player_or_enermy = 0) @index = index #@索引=索引 @v_index = 0 #@v_索引=0 #@玩家或敌人 = 玩家或敌人 @player_or_enermy = player_or_enermy #@file_name #选项背景 @button_base = Sprite.new #@按钮_底座=新的精灵 if player_or_enermy == 0 #@按钮_底座位图 = RPG::Cache.title("绿色背景图") @button_base.bitmap = RPG::Cache.title("selected-unites-base") else #@按钮_底座位图 = RPG::Cache.title("红色背景图") @button_base.bitmap = RPG::Cache.title("selected-unites-e-base") end @button_base.x = origin_x @button_base.y = origin_y @finish_button = Sprite.new #@完成按钮=精灵.new #if player_or_enermy == 0 #@完成按钮位图= RPG::Cache.title("完成") @finish_button.bitmap = RPG::Cache.title("bottom-button-1-basic") # else # @finish_button.bitmap = RPG::Cache.title("bottom-button-1-basic-e") # end @finish_button.x = origin_x + 16 @finish_button.y = origin_y + 187 @able = []#@表=[] @max_row = 2 #@最大行=2 @bottom_buttons = [] #@底部按钮=[] @max_item_row_2 = 3 #@最大项目行2=3 @delete_button = Sprite.new #@删除按钮=精灵新 #@删除按钮位图=RPG::Cache.title("删除按钮") @delete_button.bitmap = RPG::Cache.title("bottom-button-2-basic") @delete_button.x = origin_x @delete_button.y = origin_y # @清空按钮=精灵.new @empty_button = Sprite.new # @清空按钮位图= RPG::Cache.title("清空按钮") @empty_button.bitmap = RPG::Cache.title("bottom-button-3-basic") @empty_button.x = origin_x @empty_button.y = origin_y @bottom_buttons.push @finish_button# @底部按钮。按下完成按钮 @bottom_buttons.push @delete_button# @底部按钮。按下删除按钮 @bottom_buttons.push @empty_button # @底部按钮。按下清空按钮 @second_index = @index #@第二个索引=@索引 @cur_back = [] #选项背景 = [] @text_list = [] #@文本列表=[] @groups = [] #@组s=[] @group_text = [] #@组文本=[] @icons = [] #@图标 = [] @selected_units = [] #@选定的单位=[] for i in 0..team_num-1 #对于0中的我..团队编号-1 @selected_units[i]=[] #@选定单位[i]=[] end adj_x = 0 # 调整_x=0 adj_y = 0 # 调整_y=0 #光标 @group_max = 5 # @组最大值=5 @item_max = spots_num # @项目最大值=点数量 #========================================= for i in 0...@item_max # 对于0中的i…@项目最大值 @icons[i] = Sprite.new # @图标[i]=精灵.new @cur_back[i] = Sprite.new #@选项背景[i]= 精灵.new #if player_or_enermy == 0 小兵头像背景 #@选项背景[i].位图 = RPG::Cache.title("黑色小方块") @cur_back[i].bitmap = RPG::Cache.title("unit-base-highlight")#+i.to_s) #else # @cur_back[i].bitmap = RPG::Cache.title("unit-base-highlight")#+i.to_s) #end if i == 100 # 如果 i == 10 adj_y = 43 # 调整_x=0 adj_x = -10 # 调整_y=0 end #@选项背景[i].x = 原始_x+56+43*(i+调整_x) @cur_back[i].x = origin_x + 56+43*(i+adj_x) #@选项背景[i].y = 原始_y+98+调整_y @cur_back[i].y = origin_y + 98 + adj_y #@图标[i].x = 原始_x + 56+43*(i+调整_x) @icons[i].x = origin_x + 156+187*(i+adj_x) #@图标[i].y = 原始_y + 98 + 调整_y @icons[i].y = origin_y + 98 + adj_y end for i in 0...@item_max # 对于0中的i…@项目最大值 @icons[i] = Sprite.new # @图标[i]=精灵.new @cur_back[i] = Sprite.new #@选项背景[i]= 精灵.new #if player_or_enermy == 0 小兵头像背景 #@选项背景[i].位图 = RPG::Cache.title("黑色小方块") @cur_back[i].bitmap = RPG::Cache.title("unit-base-highlight")#+i.to_s) if i == 10 # 如果 i == 10 adj_y = 86 # 调整_x=0 adj_x = -10 # 调整_y=0 end #@选项背景[i].x = 原点_x + 56+43*(i+调整_x) @cur_back[i].x = origin_x + 56+43*(i+adj_x) #@选项背景[i].y = 原点_y + 141 + 调整_y @cur_back[i].y = origin_y + 141 + adj_y #@图标[i].x = 原点_x + 56+43*(i+调整_x) @icons[i].x = origin_x + 56+43*(i+adj_x) #@图标[i].y = 原点_y + 141 + 调整_y @icons[i].y = origin_y + 141 + adj_y end #teams for i in 0..@group_max-1 #对于0中的i..@组最大值-1 @groups[i]= Sprite.new #@组s[i]=精灵.new if @player_or_enermy == 0 #如果 @ 玩家 或 敌军 ==0 #@组s[i]位图 = RPG::Cache.title("小组按键绿底图") @groups[i].bitmap = RPG::Cache.title("team-basic")#+i.to_s) else#否则 #@组s[i]位图 = RPG::Cache.title("小组按键红底图") @groups[i].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s) end ##@组s[i].x = 原点_x + 16 + i*(56+3) @groups[i].x = origin_x + 16 + i*(56+3) #@组s[i].y = 原点_y + 120 @groups[i].y = origin_y + 120 @group_text[i]= Sprite.new #组文本[i]= 新的精灵 # 组文本 [i]位图 = RPG::Cache.title("队伍1---5"+(i+1).to_s) @group_text[i].bitmap = RPG::Cache.title("group"+(i+1).to_s) # 组文本 [i].x = 原点_x + 16 + i*(56+3) @group_text[i].x = origin_x + 16 + i*(56+3) # 组文本 [i].y = 原点_y + 120 @group_text[i].y = origin_y + 120 #@暗色[i] = 真 @able[i] = true end #对于我在团队编号..@组最大值-1 for i in team_num..@group_max-1 disable_item(i) #禁用项目(i) end super(0, 0, 0, 0) #色调 self.opacity = 0 #自己不透明度=0 self.active = true #自己活动=真 end def origin_x # 定义原点x return 271 end def origin_y return 205 end #-------------------------------------------------------------------------- # ● 一些方法的重载 #-------------------------------------------------------------------------- def dispose #定义释放 @button_base.dispose # @按钮底座。释放 @delete_button.dispose # @删除_按钮.dispose @empty_button.dispose # @清空按钮丢弃 @finish_button.dispose # @完成按钮.展开 for i in 0...@item_max # 对于0中的i…@项目最大值 @cur_back[i].dispose # @选页背景[i].dispose @icons[i].dispose # @icons[i].dispose end for i in 0..@group_max-1 # 对于0中的i…@队组最大值 @groups[i].dispose # @队组s[i].释放 @group_text[i].dispose # @group_text[i].dispose end super end def z=(z) super(z) @delete_button.z=z+1 @empty_button.z=z+1 @button_base.z=z @finish_button.z=z+5 for i in 0...@item_max @cur_back[i].z=z+1 @icons[i].z=z+4 end for i in 0..@group_max-1 @groups[i].z=z+1 @group_text[i].z=z+2 end end def x=(x) super(x) adj_x = 0 @button_base.x=x+origin_x @delete_button.x=x+origin_x @empty_button.x=x+origin_x @finish_button.x=x+origin_x+15 for i in 0...@item_max #@cur_back[i].x=x+origin_x if i == 5 #adj_y = 43 adj_x = -5 end @cur_back[i].x = origin_x + 56+43*(i+adj_x) + x @icons[i].x = origin_x + 56+87*(i+adj_x) + x + 5 # end for i in 0..@group_max-1 @groups[i].x=x + 16 + i*(56+3) + origin_x @group_text[i].x=x + 16 + i*(56+3) + origin_x end end # def y=(y) super(y) adj_y = 0 @button_base.y=y @delete_button.y=y @empty_button.y=y @finish_button.y=y+origin_y-15 #+190 for i in 0...@item_max if i == 5 adj_y = 43 #adj_x = -5 end @cur_back[i].y = 98 + adj_y + y @icons[i].y = 98 + adj_y + y + 5 end for i in 0..@group_max-1 @groups[i].y=y + 49 @group_text[i].y=y + 49 end end def visible=(visible) super(visible) @button_base.visible = visible @delete_button.visible = visible @empty_button.visible = visible @finish_button.visible = visible for i in 0...@item_max @cur_back[i].visible = visible @icons[i].visible = visible end for i in 0..@group_max-1 @groups[i].visible = visible @group_text[i].visible = visible end end def contents_opacity=(opacity) super(opacity) @button_base.opacity = opacity @delete_button.opacity = opacity @empty_button.opacity = opacity @finish_button.opacity = opacity for i in 0...@item_max @cur_back[i].opacity = opacity @icons[i].opacity = opacity end for i in 0..@group_max-1 @groups[i].opacity = opacity @group_text[i].opacity = opacity end end def index=(index) @index=index end def disable_item(i) @able[i] = false if @player_or_enermy == 0 @groups[i].bitmap = RPG::Cache.title("team-disable")#+i.to_s) else @groups[i].bitmap = RPG::Cache.title("enermy-disable")#+i.to_s) end @group_text[i].bitmap = RPG::Cache.title("group"+(i+1).to_s+"-d") end def back_normal(index) #p index if @v_index == 0 if index != -1 if @player_or_enermy == 0 @groups[index].bitmap = RPG::Cache.title("team-basic")#+i.to_s) else @groups[index].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s) end @group_text[index].bitmap = RPG::Cache.title("group"+(index+1).to_s) end @second_index = -1 for i in 0..@max_item_row_2-1 @bottom_buttons[i].bitmap = RPG::Cache.title("bottom-button-"+(i+1).to_s+"-basic")#+i.to_s) end else @bottom_buttons[index].bitmap = RPG::Cache.title("bottom-button-"+(index+1).to_s+"-basic")#+i.to_s) end end #-------------------------------------------------------------------------- # ● 更新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect if @v_index == 0 # 光标位置不满 0 的情况下 if @index < 0 for i in 0...@item_max back_normal(i) end return end if @player_or_enermy == 0 @groups[@index].bitmap = RPG::Cache.title("team-highlight")#+i.to_s) else @groups[@index].bitmap = RPG::Cache.title("enermy-highlight")#+i.to_s) end @group_text[@index].bitmap = RPG::Cache.title("group"+(index+1).to_s+"-l") else #level 2 if @second_index < 0 for i in 0..@max_item_row_2-1 back_normal(i) end return end #p @index,@second_index # @second_index%=2 完成 @bottom_buttons[@second_index].bitmap = RPG::Cache.title("bottom-button-"+(@second_index+1).to_s+"-l")#+i.to_s) end end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update if self.active if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @v_index = (@v_index+1)%@max_row #@last_index = @index if @v_index == 0 #back_normal(@second_index) @second_index = -1 for i in 0..@max_item_row_2-1 back_normal(i) end else #back_normal(@index) @second_index = 1 #@index%=@max_item_row_2 if @player_or_enermy == 0 @groups[@index].bitmap = RPG::Cache.title("team-basic")#+i.to_s) else @groups[@index].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s) end end refresh end if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) #back_normal(@index) @v_index = (@v_index-1)%@max_row # @last_index = @index if @v_index == 0 #back_normal(@second_index) @second_index = -1 for i in 0..@max_item_row_2-1 back_normal(i) end else #back_normal(@index) @second_index = 1 #@index%=@max_item_row_2 if @player_or_enermy == 0 #队伍1-5背景 @groups[@index].bitmap = RPG::Cache.title("team-basic")#+i.to_s) else # 敌人队伍1-5背景 @groups[@index].bitmap = RPG::Cache.title("enermy-basic")#+i.to_s) end end refresh end if @v_index == 0 # 方向键左被按下的情况下 if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) back_normal(@index) @index = (@index+1)%@group_max until @able[@index] @index = (@index+1)%@group_max end refresh end # 方向键右被按下的情况下 if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) back_normal(@index) @index = (@index+@item_max-1)%@group_max until @able[@index] @index = (@index+@item_max-1)%@group_max end refresh end else # level 2 # 方向键左被按下的情况下 if Input.repeat?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) back_normal(@second_index) @second_index = (@second_index+1)%@max_item_row_2 #p @second_index refresh end # 方向键右被按下的情况下 if Input.repeat?(Input::LEFT) $game_system.se_play($data_system.cursor_se) back_normal(@second_index) @second_index = (@second_index-1)%@max_item_row_2 refresh end end # @v_index == 0 end update_cursor_rect #if @slide_over end #-------------------------------------------------------------------------- # ● 获取东西 #-------------------------------------------------------------------------- def item_num(index = @index) # 定义项目 (索引=@索引) return @selected_units[@index].size end def set_units(a) @selected_units = a end #-------------------------------------------------------------------------- # ● 更新内容 #-------------------------------------------------------------------------- def refresh for i in 0...@item_max @icons[i].bitmap = nil end #对于i,单位为0..@选定的单位[@索引]。大小-1 for i in 0..@selected_units[@index].size-1 @icons[i].bitmap = RPG::Cache.icon(Figter_data::CHARACTER_NAME[@selected_units[@index][i]]) #p Figter_data::CHARACTER_NAME[twoArray[@index][i]] end end #-------------------------------------------------------------------------- # ● 删除士兵 #-------------------------------------------------------------------------- def delete_last_troop @selected_units[@index].pop refresh end #-------------------------------------------------------------------------- # ● 清空士兵 #-------------------------------------------------------------------------- def empty_troops @selected_units[@index]=[] refresh end end
class Scene_Map def command_custom_battle#定义命令_自定义战斗 # 演奏确定 SE $game_system.se_play($data_system.decision_se) #$游戏系统。se播放($数据系统。未指定文件或目录 choose_map_main#选择主地图 # map_info = $custom_battle_next_map_id#@map_info#地图信息=@地图信息 #如果选择随机地图随机士兵 # if ! @force_back and map_info[0] == -1#如果!@强制返回并地图信息[0]==-1 # make_random_efs_game#生成随机efs_game # return # end #---------------------------------------------------- ↑↓ #如果@强制后退或@强制后退==无 if ! @force_back or @force_back == nil #自定义主战场(0,@地图信息[1],@地图信息[2]) custom_battle_main(0,@map_info[1],@map_info[2]) #团队选定部队=@选定部队 team_selected_troops = @selected_units #如果@强制后退或@强制后退==无 if ! @force_back or @force_back == nil #自定义主战场(1,@地图信息[1],@地图信息[2]) custom_battle_main(1,@map_info[1],@map_info[2]) #敌人选定部队=@选定部队 if $game_switches[18] == true #true是打开,false是关闭 #敌军enermy精选部队 enermy_selected_troops =[[5,21],[18,21,21],[19,21],[21,21,21],[16,21,21,21,21] ] #@selected_units # @group_one.x = 928 # @group_one.y = 544 # @group_two.x = 1248 # @group_two.y = 640 end if $game_switches[19] == true enermy_selected_troops =[ [5,5],[5,5,5],[5,5],[5,5,5],[5,5,5,5,5] ] end #如果@强制后退或@强制后退==无 if ! @force_back or @force_back == nil choose_hero_main#选择英雄主 selected_hero = nil #selected_hero = @selected_hero#选定的英雄=@选定的英雄 #如果@强制后退或@强制后退==无 if ! @force_back or @force_back == nil team_army = Game_Army_Slg.new(0) #enermy军队 enermy_army = Game_Army_Slg.new(1) team_army.create_empty_army enermy_army.create_empty_army #team_army.load_twoD_Array(team_selected_troops,selected_hero) team_army.load_twoD_Array(team_selected_troops,selected_hero) enermy_army.load_twoD_Array(enermy_selected_troops) # 切换地图画面 # team_army.set_groups_name#团队军队。设置团队名称 #$自定义战斗下一个战斗者团队=团队军队 $custom_battle_next_fighter_team = team_army #$自定义战斗下一个战斗者敌军=敌军军队 $custom_battle_next_fighter_enermy = enermy_army #$自定义战斗下一个地图ID=16 $custom_battle_next_map_id = 16#map_info[0] #if $game_switches[19] == true # a = [1, 2, 3, 5, 8] # $custom_battle_next_map_id = a[rand(a.size)] # end $game_party.setup_starting_members#游戏部分设置启动成员 # 设置初期位置的地图##############1356622 $game_map.setup(5) # 主角向初期位置移动 $game_player.moveto(0, 0) # 刷新主角 $game_player.refresh # 执行地图设置的 BGM 与 BGS 的自动切换 $game_map.autoplay # 刷新地图 (执行并行事件) $game_map.update # 切换地图画面 $scene = Scene_Map.new # $scene = Scene_Map.new #efs_title_main else # fourth @force_back = false#@强制后退=错误 Graphics.update #图形更新 efs_title_update#EFS标题更新 end else # third @force_back = false#@强制后退=错误 Graphics.update#图形更新 efs_title_update#EFS标题更新 end else # second @force_back = false#@强制后退=错误 Graphics.update#图形更新 efs_title_update#EFS标题更新 end else #1st @force_back = false#@强制后退=错误 Graphics.update#图形更新 efs_title_update#EFS标题更新 end end end
module Figter_data#::ALL_SOLDIER #所有士兵 ALL_SOLDIER =[5,4,3,13,2,9,11,15,26,23, #帝国 32,35,36,28,30,33,34, #诺尔森人 7,8,19,12,31,38,17, #雇佣兵 27,6,10,14,16,18,21,22,29,39] #野怪 #所有英雄 ALL_HERO = [ 20,24,25,37] end
module Figter_data data_id = 4 #=====基本、模型信息========== CHARACTER_NAME[data_id] = "E_ManAtArm" #头像模型名字 ATK_SE[data_id] = "spearbasic_0" #攻击音效 (击中) ATK_SE_NUM[data_id] = 9 #攻击音效数量 DEF_SE[data_id] = "shield_wood_wood_0" DEF_SE_NUM[data_id] = 9 S_ATK_SE[data_id] = nil #远程攻击音效 (击中) S_ATK_SE_NUM[data_id] = nil #远程攻击音效数量 AMMO_NAME[data_id] = nil #弹药模型名字 AMMO_D_NAME[data_id] = nil #落地后的弹药模型名字 S_SHOOT_SE[data_id] = nil #射击音效 S_SHOOT_SE_NUM[data_id] = nil #射击音效数量 S_PASSBY_SE[data_id] = nil S_PASSBY_SE_NUM[data_id] = nil S_DROP_SE[data_id] = nil S_DROP_SE_NUM[data_id] = nil S_FLY_TYPE[data_id] = nil #=======类别================= THE_NAME[data_id] = "帝国军士" #显示名字 IS_CAL[data_id] = false #是骑兵吗 IS_ARC[data_id] = false #是远程兵吗 HEAVY[data_id] = false #是重装兵吗 LABEL[data_id] = 1 #兵种标签 DESCRIPTION[data_id] = "赫西帝国步兵,中装步兵,配有克制骑兵的长矛,制式盾牌" #==========属性============== HP_MAX[data_id] = 375 #血量上限 AMMOR_HP[data_id] = 30 #护甲值 SHD_HP[data_id] = 25 #盾甲值 BASE_ATK[data_id] = 65 #基本攻击力 BRO_ATK[data_id] = 10 #破甲攻击力 S_BASE_ATK[data_id] = 0 #远程基本攻击力 S_BRO_ATK[data_id] = 0 #远程破甲攻击力 ATK_SKILL[data_id] = 25 #攻击技巧 DEF_SKILL[data_id] = 35 #防御技巧 ANTI_CAV[data_id] = 75 #反骑兵伤害加成 ANTI_INF[data_id] = 0 #反步兵伤害加成 CHARGE_BOUN[data_id]=30 #冲锋加成 MORALE[data_id] = 50 #士气 (100max) CRITICAL_HIT[data_id] = 10 #暴击率 EXPLOSION_SETTINGS[data_id] = nil #伤害是否有爆破特效,若有则设置 #(中心X,中心Y,中心伤害,范围,施放者,队伍不受(0是所有人受)是否留垃圾 ATK_FR[data_id] = 30 #攻击频率 ATK_RANGE[data_id] = 1 #攻击范围 ENGAGE_RANGE[data_id] = 1 #交战范围 ENGAGE_RANGE_MIN[data_id] = 1 MOVEMENT_SPEED[data_id] = 3 #移动速度 ACCURATCY[data_id] = 100 #精确度 LIVE_CHANCE[data_id] = 20 #生还几率 AMMO_MAX[data_id] = 0 #弹药上线 ATK_CODE[data_id] = nil #特殊代码(攻击后执行) #===========战略用============= EXP[data_id] = 2 #击杀获得经验 PRICE[data_id] = 100 #价格 EXP_NEED[data_id] = 10 #升级所需经验 NEXT_LEVEL[data_id] = [9] #下一阶兵种 CAPTAIN_SKILL[data_id] = nil end
人物模型.png (55.33 KB, 下载次数: 29)
金芒芒 发表于 2023-8-15 15:55
我就想team_selected_troops = @selected_units
team_selected_troops = [[],[].[],[],[]]这[]里面的参数 ...
soulsaga 发表于 2023-8-15 16:38
你想什么..不要省略
soulsaga 发表于 2023-8-15 16:38
你想什么..不要省略
金芒芒 发表于 2023-8-15 16:43
team_selected_troops = [[],[].[],[],[]]这[]里面的参数
soulsaga 发表于 2023-8-15 16:51
你...那就=啊..为什么要问
还有...參数是什么?哪里有什么參数?
你似乎误 解了參数的意思 ...
所有士兵.png (553.42 KB, 下载次数: 26)
小队选定.png (606.1 KB, 下载次数: 35)
加载选定士兵上指定的地图.png (342.2 KB, 下载次数: 29)
金芒芒 发表于 2023-8-15 16:54
现在是最主要是 [[],[].[],[],[]]里面是角色的名称不是角色的ID
team_selected_troops = @selected_units[0]#===>甲 p Figter_data::THE_NAME.index(team_selected_troops)#==>2
soulsaga 发表于 2023-8-15 16:59
用名称取ID的写法我不是教了吗?
p Figter_data::THE_NAME.index("甲")#==>2[/pre]
soulsaga 发表于 2023-8-15 16:59
用名称取ID的写法我不是教了吗?
team_selected_troops = @selected_units[0]#===>甲
soulsaga 发表于 2023-8-15 16:59
用名称取ID的写法我不是教了吗?
team_selected_troops = @selected_units[0]#===>甲
team_selected_troops = Figter_data::THE_NAME.index(@selected_units.index("甲"))#===>2
soulsaga 发表于 2023-8-15 16:59
用名称取ID的写法我不是教了吗?
team_selected_troops = @selected_units[0]#===>甲
soulsaga 发表于 2023-8-15 17:18
team_selected_troops = Figter_data::THE_NAME.index(@selected_units.index("甲"))#===>2[/pre]
金芒芒 发表于 2023-8-15 17:23
我想提取里面的内容,不是写进去,甲不一定在队伍里面,我是选号了在提取内容 ...
team_selected_troops = [] for i in 0...@selected_units.size team_selected_troops[i] = Figter_data::THE_NAME.index(team_selected_troops[i]) end a=team_selected_troops.flatten #p a #=> [2,3,4,5,6] x=544 for i in 0...a.size $game_screen.pictures[i+1].show("头像#{a[i] }", 0,x, 550, 100, 100, 255, 0) x-=87 end
soulsaga 发表于 2023-8-15 17:44
team_selected_troops = []
for i in 0...@selected_units.size
team_selected_troops = Figter_data::T ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |