有玩家反映《肥羊们的征途》-save后只会生成1个以玩家姓名命名的TXT文本。每次存档时都会覆盖源存档,如发生存档意外基本上离弃坑不远了。

1、首先我们通过搜索".txt"来定位文本输出。原文如下:

set EXRTT=PreCode(Save)
if(GetLocalPlayer()==p)then
call PreloadGenClear()
call PreloadGenStart()
call Preload("-load "+EXRTT)
call PreloadGenEnd("Expedition RPG"+"\\"+pName+".txt")  //这个就是我们TXT的命名语法
call PreloadEnd(3.0)
endif
call ClearTextMessagesBJ(GetForceOfPlayer(p))
call DisplayTimedTextToForce(GetForceOfPlayer(p),999,CodeColor(Save))
call DisplayTimedTextToForce(GetForceOfPlayer(p),300,"|cfffffc01代码已保存在魔兽根目录\\Expedition RPG\\"+" 的 "+pName+".txt中。|r")

2、pName是什么?我们向上查找,找到了如下定义:

local string pName=GetPlayerName(p)  //相当于获取玩家姓名

3、要获取英雄等级,我们加1条定义:

local integer HLev=GetHeroLevel(hero)

4、接着我们修改输出语法:

call PreloadGenEnd("Expedition RPG"+"\\"+pName+"_Lv"+I2S(HLev)+".txt")

在这里我们要特别注意I2S()的含义:整数转字符串。因为等级是整数,而输出是字符串,所以两者必须转换。(我研究时就是一直卡在这里。)

5、测试结果举例:DarkSheep.txt变为DarkSheep_Lv120.txt

暂无能力加随机整数,添加后经测试,某一玩家输入-save后其他玩家会断开链接。- -!






1、

function Trig_Single_Func003001001001 takes nothing returns boolean
return(GetPlayerSlotState(GetFilterPlayer())==PLAYER_SLOT_STATE_PLAYING)
endfunction
function Trig_Single_Conditions takes nothing returns boolean
if(not(CountPlayersInForceBJ(GetPlayersMatching(Condition(function Trig_Single_Func003001001001)))==(CountPlayersInForceBJ(GetPlayersByMapControl(MAP_CONTROL_COMPUTER))+1)))then
return false
endif
return true
endfunction
function Trig_Single_Actions takes nothing returns nothing
call DisplayTimedTextToForce(GetPlayersAll(),30,"你不能单人进行游戏。\n")
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=12
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call CustomVictoryBJ(ConvertedPlayer(GetForLoopIndexA()),true,true)
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
endfunction
function InitTrig_Single takes nothing returns nothing
set gg_trg_Single=CreateTrigger()
call TriggerRegisterTimerEventSingle(gg_trg_Single,0.01)
call TriggerAddCondition(gg_trg_Single,Condition(function Trig_Single_Conditions))
call TriggerAddAction(gg_trg_Single,function Trig_Single_Actions)
endfunction

2、

trigger gg_trg_Single=null

call InitTrig_Single()