网易官方对战平台的肥羊修罗场_2.5b已经将原有的save/load保存加载积分解锁英雄模式调整为开局输入-load识别你的地图等级来解锁相应等级的英雄。如下图:
一、准备工作
endglobals
native DzAPI_Map_HasMallItem takes player whichPlayer, string key returns boolean
二、英雄重复购买
function l1lIIII takes nothing returns nothing
call SetPlayerUnitAvailableBJ(GetUnitTypeId(GetSoldUnit()),false,GetEnumPlayer())
endfunction
把上面的false改成true后可以重复购买英雄
三、VIP英雄
function IlllI1I takes nothing returns boolean
if (DzAPI_Map_HasMallItem(GetTriggerPlayer(),"SPECARENA1") == true) then
return true
endif
四、积分系统→等级系统
set l11I1I=CreateTrigger()
call TriggerRegisterPlayerChatEvent(l11I1I,Player(0),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(1),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(2),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(3),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(4),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(5),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(6),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(7),"-load ",false)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(8),"-load ",false)
call TriggerAddCondition(l11I1I,Condition(function l11IlII))
call TriggerAddAction(l11I1I,function l11l1II)
function l11IlII takes nothing returns boolean
if(not(SubStringBJ(GetEventPlayerChatString(),1,6)==GetEventPlayerChatStringMatched()))then
return false
endif
if(not(StringLength(GetEventPlayerChatString())>6))then
return false
endif
return true
endfunction
function l11l1II takes nothing returns nothing
set ll11l1=SubStringBJ(GetEventPlayerChatString(),7,StringLength(GetEventPlayerChatString()))
set ll1Il1=Illl1lI(ll11l1)
if(l11l11I())then
set lIIIl1[GetConvertedPlayerId(GetTriggerPlayer())]=1
set lIl111[GetConvertedPlayerId(GetTriggerPlayer())]=ll1I11[2]
set l1III1[2]=200
set l1III1[3]=450
set l1III1[4]=750
set l1III1[5]=1100
set l1III1[6]=1450
set l1III1[7]=2000
set l1III1[8]=2500
set l1III1[9]=3150
set l1III1[10]=3500
set l1III1[11]=4000
set l1III1[12]=4700
set l1III1[13]=5200
set l1III1[14]=5750
set l1III1[15]=6200
set l1III1[16]=6750
set l1III1[17]=7150
set l1III1[18]=7700
set l1III1[19]=8400
set l1III1[20]=8800
set l1III1[21]=9400
set l1III1[22]=10000
set l1III1[23]=12000
set l1III1[24]=14000
set l1III1[25]=18000
set bj_forLoopAIndex=2
set bj_forLoopAIndexEnd=25
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
if(l11IllI())then
set lIIIl1[GetConvertedPlayerId(GetTriggerPlayer())]=GetForLoopIndexA()
else
endif
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=lIIIl1[GetConvertedPlayerId(GetTriggerPlayer())]
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call SetPlayerTechResearchedSwap(lIIl11[GetForLoopIndexA()],1,GetTriggerPlayer())
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
call DisplayTimedTextToForce(IlI111I(GetTriggerPlayer()),15.00,("你的积分 -"+(I2S((lIIII1[GetConvertedPlayerId(GetTriggerPlayer())]+lIl111[GetConvertedPlayerId(GetTriggerPlayer())]))+(" "+(("等级 - |cffd42424"+(I2S(lIIIl1[GetConvertedPlayerId(GetTriggerPlayer())])+(" |r 下一等级积分 - "+I2S(l1III1[(lIIIl1[GetConvertedPlayerId(GetTriggerPlayer())]+1)])))))))))
else
call DisplayTextToForce(IlI111I(GetTriggerPlayer()),"代码加载错误!")
endif
endfunction
增加变量和DZapi代码
integer udg_dzdtdj=0
endglobals
native DzAPI_Map_GetMapLevel takes player whichPlayer returns integer
保留原有触发事件
call TriggerRegisterPlayerChatEvent(l11I1I,Player(0),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(1),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(2),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(3),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(4),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(5),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(6),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(7),"-load",true)
call TriggerRegisterPlayerChatEvent(l11I1I,Player(8),"-load",true)
call TriggerAddAction(l11I1I,function l11l1II)
删除对代码长度的判断:
function l11IlII takes nothing returns boolean
if(not(SubStringBJ(GetEventPlayerChatString(),1,6)==GetEventPlayerChatStringMatched()))then
return false
endif
if(not(StringLength(GetEventPlayerChatString())>6))then
return false
endif
return true
endfunction
以下是错误的动作写法:
function l11l1II takes nothing returns nothing
set udg_dzdtdj=DzAPI_Map_GetMapLevel(GetTriggerPlayer())
if ( ( udg_dzdtdj == 1 ) ) then
call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 10.00, "|cFFFF3333你的地图等级只有1级,只能选择初始的9个英雄!请尽快提升地图等级吧!|r")
else
if ( ( udg_dzdtdj == 2 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00B', 1)
else
if ( ( udg_dzdtdj == 3 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00D', 1)
else
if ( ( udg_dzdtdj == 4 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00E', 1)
else
if ( ( udg_dzdtdj == 5 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00F', 1)
else
if ( ( udg_dzdtdj == 6 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00G', 1)
else
if ( ( udg_dzdtdj == 7 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00H', 1)
else
if ( ( udg_dzdtdj == 8 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00I', 1)
else
if ( ( udg_dzdtdj == 9 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00J', 1)
else
if ( ( udg_dzdtdj == 10 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00K', 1)
else
if ( ( udg_dzdtdj == 11 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00L', 1)
else
if ( ( udg_dzdtdj == 12 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00M', 1)
else
if ( ( udg_dzdtdj == 13 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00N', 1)
else
if ( ( udg_dzdtdj == 14 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00O', 1)
else
if ( ( udg_dzdtdj == 15 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00P', 1)
else
if ( ( udg_dzdtdj == 16 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00Q', 1)
else
if ( ( udg_dzdtdj == 17 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00R', 1)
else
if ( ( udg_dzdtdj == 18 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00S', 1)
else
if ( ( udg_dzdtdj == 19 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00T', 1)
else
if ( ( udg_dzdtdj == 20 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00U', 1)
else
if ( ( udg_dzdtdj == 21 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00A', 1)
else
if ( ( udg_dzdtdj == 22 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00V', 1)
else
if ( ( udg_dzdtdj == 23 ) ) then
call AddPlayerTechResearched(GetTriggerPlayer(), 'R00W', 1)
else
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
endfunction
上面的动作写法忽略了源代码中的一段循环,这段循环是给玩家设置N个科技。这样玩家才可以选择等级以下的英雄。所以,我们来尝试正确的写法!
先对地图等级做判断,如果地图等级=1,则直接显示游戏文本。否则用变量捕捉地图等级,再使用循环整数A进行循环,当循环整数A小于地图等级时,执行一次玩家科技动作。全部循环结束后,显示游戏提示文本。
function l11l1II takes nothing returns nothing
if ((DzAPI_Map_GetMapLevel(GetTriggerPlayer()) == 1)) then
call DisplayTimedTextToPlayer( GetTriggerPlayer(), 0, 0, 30, "|cffd42424地图等级1级,解锁英雄失败!|r" )
else
set udg_dzdtdj = DzAPI_Map_GetMapLevel(GetTriggerPlayer())
set bj_forLoopAIndex = 2
set bj_forLoopAIndexEnd = udg_dzdtdj
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetPlayerTechResearchedSwap(lIIl11[GetForLoopIndexA()], 1, GetTriggerPlayer() )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DisplayTimedTextToPlayer( GetTriggerPlayer(), 0, 0, 30, "|cffd42424解锁英雄成功!|r" )
endif
endfunction
保存的积分在文件夹里找不到 怎么解决
在魔兽根目录的SpecArena文件夹中。
肥羊修羅2.5 可改成單人也可以有積分獎勵嗎
沒人跟我玩嗚嗚
我博客的版本单人可以存积分呀。