|
AOS类地图,在Scenario Properties->Player Properties中把两边的电脑玩家Player(0)和Player(11)去掉了,打算做成DotA那样进地图不显示电脑玩家,但是怎样才能不被电脑攻击?我已经写了3个方面的代码:用SetPlayerTeam把玩家和电脑玩家设为一个team,并且用ForceAddPlayer把他们加到同一个force里面,并且调用下面的自定义函数重新设置了盟友关系,为什么一进游戏电脑还是打我捏
function SetAlly takes player p1, player p2, boolean flag returns nothing
local integer i
if p1==p2 then
return
endif
set i = 0
loop
exitwhen i > 9
call SetPlayerAlliance(p1,p2,ConvertAllianceType(i),false)
call SetPlayerAlliance(p2,p1,ConvertAllianceType(i),false)
set i = i + 1
endloop
if flag==true then
set i = 0
loop
exitwhen i > 5
call SetPlayerAlliance(p1,p2,ConvertAllianceType(i),true)
call SetPlayerAlliance(p2,p1,ConvertAllianceType(i),true)
set i = i + 1
endloop
endif
endfunction |
|