找回密码
 点一下
查看: 4510|回复: 3

大伙给看看这个反MH的Jass错在哪里

[复制链接]
发表于 2008-8-28 17:43:32 | 显示全部楼层 |阅读模式
globals
group MMG=null
player theHost=null
real array TimePas_V
timer array Timer_V
timer array view_V
unit Cheatout=null
rect DetZoom=null
unit MHDetector_V=null
trigger Detetive_V=null
player array udg_MHplayer
force CheatParty=null
lightning ZeustheViews=null
constant real VX=-8069.
constant real VY=6137.
real array PlayerDelay
fogmodifier ZoomCov
timer AlltheTime=null
trigger PickTheLight=null
timer MiniProtectTime=null
constant real ViewTime=.005
boolean IsInGame_Check=false
trigger gg_trg_democ=CreateTrigger()
trigger gg_trg_shuoming=CreateTrigger()
endglobals

function IsPlayerAvailable takes player p returns boolean
return GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p)==MAP_CONTROL_USER
endfunction

function msg takes player p,string s returns nothing
call DisplayTimedTextToPlayer(p,0,0,10,s)
endfunction

//x,y是一个对玩家而言不可见的一个点的坐标,我们要利用这个坐标来创建一个闪电。
function DetLighning takes nothing returns nothing
local real MFWGx=GetRandomReal(GetRectMinX(DetZoom),GetRectMaxX(DetZoom))
local real MFWGy=GetRandomReal(GetRectMinY(DetZoom),GetRectMaxY(DetZoom))
if IsVisibleToPlayer(MFWGx,MFWGy,GetLocalPlayer())==false then
set ZeustheViews=AddLightning("CLPB",true,MFWGx,MFWGy,MFWGx,MFWGy) //创建闪电
if ZeustheViews!=null then //本地玩家闪电H2I值非0,就是说明上面的不可见点变得可见,说明开外挂
call DestroyLightning(ZeustheViews) //删除上面创建的闪电
set ZeustheViews=null
call SelectUnit(Cheatout,true) //让这个玩家选择前面创建的单位,来标记他
endif
endif
endfunction

function HollyLight takes nothing returns nothing
if GetFilterUnit()==Cheatout and IsPlayerInForce(GetTriggerPlayer(),CheatParty)==false and IsUnitVisible(Cheatout,GetTriggerPlayer())==false then //单位对于玩家可见等于否
call ForceAddPlayer(CheatParty,GetTriggerPlayer())
endif
endfunction

function MiniMapCov takes nothing returns nothing
if IsUnitVisible(GetFilterUnit(),GetLocalPlayer())then
call UnitSetUsesAltIcon(GetFilterUnit(),false)
else
call UnitSetUsesAltIcon(GetFilterUnit(),true)
endif
endfunction

function EnumMiniUnits takes nothing returns nothing
call GroupEnumUnitsInRect(MMG,bj_mapInitialPlayableArea,Filter(function MiniMapCov)) //在单位组中增加指定区域, 符合过滤条件的单位(可用地图区域)
endfunction

function ViewLoop takes nothing returns nothing
local integer i=0
loop
exitwhen GetExpiredTimer()==view_Vor i>12
set i=i+1
endloop
call SetFogStateRadius(Player(i),FOG_OF_WAR_VISIBLE,VX,VY,300,false)
endfunction

function DeadLine takes nothing returns nothing
call msg(GetLocalPlayer(),"oh,die")
call PauseTimer(GetExpiredTimer())
endfunction

function FirstSelect takes player p returns nothing
local integer ip=GetPlayerId(p)
if view_V[ip]==null then
set view_V[ip]=CreateTimer()
endif
set TimePas_V[ip]=0
call TimerStart(Timer_V[ip],5,false,function DeadLine)
call TimerStart(view_V[ip],ViewTime,true,function ViewLoop)
call SetFogStateRadius(p,FOG_OF_WAR_VISIBLE,VX,VY,300,false)
if GetLocalPlayer()==p then
call SelectUnit(MHDetector_V,true)
endif
endfunction

function DetSeletion takes nothing returns nothing
local integer ip=GetPlayerId(GetTriggerPlayer())
if GetFilterUnit()!=MHDetector_V then
return
endif
set TimePas_V[ip]=TimerGetElapsed(Timer_V[ip])
set PlayerDelay[ip]=TimePas_V[ip]
call PauseTimer(view_V[ip])
if GetLocalPlayer()==GetTriggerPlayer()then
call SelectUnit(MHDetector_V,false)
endif
if IsUnitInvisible(GetTriggerUnit(),GetTriggerPlayer())then
call msg(GetLocalPlayer(),"Fog convert")
set TimePas_V[ip]=0
call PauseTimer(Timer_V[ip])
endif
endfunction

function DetDeselection takes nothing returns nothing
local integer ip=GetPlayerId(GetTriggerPlayer())
if GetFilterUnit()!=MHDetector_V then
return
endif
if TimePas_V[ip]==0 then
return
endif
call PauseTimer(Timer_V[ip])
if TimerGetElapsed(Timer_V[ip])-TimePas_V[ip]>.01 then
call ForceAddPlayer(CheatParty,GetTriggerPlayer())
elseif TimerGetElapsed(Timer_V[ip])-TimePas_V[ip]==0 then
endif
set TimePas_V[ip]=0
endfunction

function InitHdo takes nothing returns nothing
call ExecuteFunc("FindaHost")
call DestroyTimer(GetExpiredTimer())
endfunction

function InitIndo takes nothing returns nothing
call ExecuteFunc("IsInGame")
call TimerStart(GetExpiredTimer(),2,false,function InitHdo)
endfunction

function DetZoomInit takes nothing returns nothing
local integer ip=0
local timer Initt=null
set CheatParty=CreateForce()
set DetZoom=Rect(7200,6912,7360,7072)
set ZoomCov=CreateFogModifierRect(GetLocalPlayer(),ConvertFogState(1),DetZoom,false,true) //转化迷雾状态代码为迷雾状态
call FogModifierStart(ZoomCov)
set AlltheTime=CreateTimer()
set ZeustheViews=null
set Cheatout=CreateUnit(Player(15),'n01N',VX,VY,0)
set PickTheLight=CreateTrigger()
call TimerStart(AlltheTime,3,true,function DetLighning)
loop
exitwhen ip==12
call TriggerRegisterPlayerUnitEvent(PickTheLight,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function HollyLight))
set ip=ip+1
endloop
call SetAltMinimapIcon("MiniMapBlank.blp") //改变小地图的特殊图标
set MMG=CreateGroup()
set MiniProtectTime=CreateTimer()
call TimerStart(MiniProtectTime,1,true,function EnumMiniUnits)
set Detetive_V=CreateTrigger()
set MHDetector_V=CreateUnit(Player(15),'n01N',VX,VY,0)
set ip=0
loop
exitwhen ip==12
if IsPlayerAvailable(Player(ip))then
set Timer_V[ip]=CreateTimer()
set TimePas_V[ip]=0
call TriggerRegisterPlayerUnitEvent(Detetive_V,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function DetSeletion))
call TriggerRegisterPlayerUnitEvent(Detetive_V,Player(ip),EVENT_PLAYER_UNIT_DESELECTED,Filter(function DetDeselection))
endif
set ip=ip+1
endloop
set Initt=CreateTimer()
call TimerStart(Initt,1,false,function InitIndo)
endfunction

function IsInGame takes nothing returns nothing
local real CameraX=GetCameraTargetPositionX()
local real CameraY=GetCameraTargetPositionY()
call EnableUserControl(false)
call PauseGame(true)
call SetCameraPosition(CameraX+1,CameraY+1)
call TriggerSyncReady()
call PauseGame(false)
if GetCameraTargetPositionX()==CameraX+1 then
call SetCameraPosition(CameraX,CameraY)
set IsInGame_Check=true
endif
call EnableUserControl(true)
endfunction

function FindaHost takes nothing returns nothing
local gamecache hf=InitGameCache("theone")
set theHost=Player(0)
call StoreInteger(hf,"a","a",GetPlayerId(GetLocalPlayer()))
call TriggerSyncStart()
call SyncStoredInteger(hf,"a","a")
call TriggerSyncReady()
set theHost=Player(GetStoredInteger(hf,"a","a"))
endfunction

function Trig_shuoming_Actions takes nothing returns nothing
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,"4854")
call TriggerSleepAction(5.)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,"4814")
endfunction

function Trig_democ_Actions takes nothing returns nothing
local integer i=0
call msg(GetLocalPlayer(),"information start")
loop
exitwhen i==12
if IsPlayerAvailable(Player(i))then
call FirstSelect(Player(i))
endif
set i=i+1
endloop
call TriggerSleepAction(2)
set i=0
loop
exitwhen i==12
if IsPlayerAvailable(Player(i))then
call msg(GetLocalPlayer(),GetPlayerName(Player(i))+"timeout"+R2S(PlayerDelay))
if IsPlayerInForce(Player(i),CheatParty)then
set udg_MHplayer[GetPlayerId(Player(i))+1]=Player(i)
call BJDebugMsg("player |cff00FFFF"+I2S(GetPlayerId(Player(i))+1)+"  |cffFFFFFFplayerName |cff00FFFF"+GetPlayerName(Player(i))+" |cffFFFFFFis cheating!")
endif
endif
set i=i+1
endloop
endfunction

function main takes nothing returns nothing
call DetZoomInit()
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(0),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(1),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(2),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(3),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(4),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(5),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(6),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(7),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(8),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(9),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(10),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(11),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(12),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(13),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(14),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(15),"-mh",true)
call TriggerAddAction(gg_trg_democ,function Trig_democ_Actions)
call TriggerRegisterTimerEventPeriodic(gg_trg_shuoming,150.)
call TriggerAddAction(gg_trg_shuoming,function Trig_shuoming_Actions)
endfunction
运行后的结果如图:
1.jpg
正确结果应该是:
   2.jpg
下面附带了借鉴地图的J文件
war3mapBT.rar (48 KB, 下载次数: 93)
希望热心的人能给我解答。
发表于 2008-8-28 17:45:08 | 显示全部楼层
先给LZ转一下:
[codes=jass]
globals
group MMG=null
player theHost=null
real array TimePas_V
timer array Timer_V
timer array view_V
unit Cheatout=null
rect DetZoom=null
unit MHDetector_V=null
trigger Detetive_V=null
player array udg_MHplayer
force CheatParty=null
lightning ZeustheViews=null
constant real VX=-8069.
constant real VY=6137.
real array PlayerDelay
fogmodifier ZoomCov
timer AlltheTime=null
trigger PickTheLight=null
timer MiniProtectTime=null
constant real ViewTime=.005
boolean IsInGame_Check=false
trigger gg_trg_democ=CreateTrigger()
trigger gg_trg_shuoming=CreateTrigger()
endglobals

function IsPlayerAvailable takes player p returns boolean
return GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p)==MAP_CONTROL_USER
endfunction

function msg takes player p,string s returns nothing
call DisplayTimedTextToPlayer(p,0,0,10,s)
endfunction

//x,y是一个对玩家而言不可见的一个点的坐标,我们要利用这个坐标来创建一个闪电。
function DetLighning takes nothing returns nothing
local real MFWGx=GetRandomReal(GetRectMinX(DetZoom),GetRectMaxX(DetZoom))
local real MFWGy=GetRandomReal(GetRectMinY(DetZoom),GetRectMaxY(DetZoom))
if IsVisibleToPlayer(MFWGx,MFWGy,GetLocalPlayer())==false then
set ZeustheViews=AddLightning("CLPB",true,MFWGx,MFWGy,MFWGx,MFWGy) //创建闪电
if ZeustheViews!=null then //本地玩家闪电H2I值非0,就是说明上面的不可见点变得可见,说明开外挂
call DestroyLightning(ZeustheViews) //删除上面创建的闪电
set ZeustheViews=null
call SelectUnit(Cheatout,true) //让这个玩家选择前面创建的单位,来标记他
endif
endif
endfunction

function HollyLight takes nothing returns nothing
if GetFilterUnit()==Cheatout and IsPlayerInForce(GetTriggerPlayer(),CheatParty)==false and IsUnitVisible(Cheatout,GetTriggerPlayer())==false then //单位对于玩家可见等于否
call ForceAddPlayer(CheatParty,GetTriggerPlayer())
endif
endfunction

function MiniMapCov takes nothing returns nothing
if IsUnitVisible(GetFilterUnit(),GetLocalPlayer())then
call UnitSetUsesAltIcon(GetFilterUnit(),false)
else
call UnitSetUsesAltIcon(GetFilterUnit(),true)
endif
endfunction

function EnumMiniUnits takes nothing returns nothing
call GroupEnumUnitsInRect(MMG,bj_mapInitialPlayableArea,Filter(function MiniMapCov)) //在单位组中增加指定区域, 符合过滤条件的单位(可用地图区域)
endfunction

function ViewLoop takes nothing returns nothing
local integer i=0
loop
exitwhen GetExpiredTimer()==view_Vor i>12
set i=i+1
endloop
call SetFogStateRadius(Player(i),FOG_OF_WAR_VISIBLE,VX,VY,300,false)
endfunction

function DeadLine takes nothing returns nothing
call msg(GetLocalPlayer(),"oh,die")
call PauseTimer(GetExpiredTimer())
endfunction

function FirstSelect takes player p returns nothing
local integer ip=GetPlayerId(p)
if view_V[ip]==null then
set view_V[ip]=CreateTimer()
endif
set TimePas_V[ip]=0
call TimerStart(Timer_V[ip],5,false,function DeadLine)
call TimerStart(view_V[ip],ViewTime,true,function ViewLoop)
call SetFogStateRadius(p,FOG_OF_WAR_VISIBLE,VX,VY,300,false)
if GetLocalPlayer()==p then
call SelectUnit(MHDetector_V,true)
endif
endfunction

function DetSeletion takes nothing returns nothing
local integer ip=GetPlayerId(GetTriggerPlayer())
if GetFilterUnit()!=MHDetector_V then
return
endif
set TimePas_V[ip]=TimerGetElapsed(Timer_V[ip])
set PlayerDelay[ip]=TimePas_V[ip]
call PauseTimer(view_V[ip])
if GetLocalPlayer()==GetTriggerPlayer()then
call SelectUnit(MHDetector_V,false)
endif
if IsUnitInvisible(GetTriggerUnit(),GetTriggerPlayer())then
call msg(GetLocalPlayer(),"Fog convert")
set TimePas_V[ip]=0
call PauseTimer(Timer_V[ip])
endif
endfunction

function DetDeselection takes nothing returns nothing
local integer ip=GetPlayerId(GetTriggerPlayer())
if GetFilterUnit()!=MHDetector_V then
return
endif
if TimePas_V[ip]==0 then
return
endif
call PauseTimer(Timer_V[ip])
if TimerGetElapsed(Timer_V[ip])-TimePas_V[ip]>.01 then
call ForceAddPlayer(CheatParty,GetTriggerPlayer())
elseif TimerGetElapsed(Timer_V[ip])-TimePas_V[ip]==0 then
endif
set TimePas_V[ip]=0
endfunction

function InitHdo takes nothing returns nothing
call ExecuteFunc("FindaHost")
call DestroyTimer(GetExpiredTimer())
endfunction

function InitIndo takes nothing returns nothing
call ExecuteFunc("IsInGame")
call TimerStart(GetExpiredTimer(),2,false,function InitHdo)
endfunction

function DetZoomInit takes nothing returns nothing
local integer ip=0
local timer Initt=null
set CheatParty=CreateForce()
set DetZoom=Rect(7200,6912,7360,7072)
set ZoomCov=CreateFogModifierRect(GetLocalPlayer(),ConvertFogState(1),DetZoom,false,true) //转化迷雾状态代码为迷雾状态
call FogModifierStart(ZoomCov)
set AlltheTime=CreateTimer()
set ZeustheViews=null
set Cheatout=CreateUnit(Player(15),'n01N',VX,VY,0)
set PickTheLight=CreateTrigger()
call TimerStart(AlltheTime,3,true,function DetLighning)
loop
exitwhen ip==12
call TriggerRegisterPlayerUnitEvent(PickTheLight,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function HollyLight))
set ip=ip+1
endloop
call SetAltMinimapIcon("MiniMapBlank.blp") //改变小地图的特殊图标
set MMG=CreateGroup()
set MiniProtectTime=CreateTimer()
call TimerStart(MiniProtectTime,1,true,function EnumMiniUnits)
set Detetive_V=CreateTrigger()
set MHDetector_V=CreateUnit(Player(15),'n01N',VX,VY,0)
set ip=0
loop
exitwhen ip==12
if IsPlayerAvailable(Player(ip))then
set Timer_V[ip]=CreateTimer()
set TimePas_V[ip]=0
call TriggerRegisterPlayerUnitEvent(Detetive_V,Player(ip),EVENT_PLAYER_UNIT_SELECTED,Filter(function DetSeletion))
call TriggerRegisterPlayerUnitEvent(Detetive_V,Player(ip),EVENT_PLAYER_UNIT_DESELECTED,Filter(function DetDeselection))
endif
set ip=ip+1
endloop
set Initt=CreateTimer()
call TimerStart(Initt,1,false,function InitIndo)
endfunction

function IsInGame takes nothing returns nothing
local real CameraX=GetCameraTargetPositionX()
local real CameraY=GetCameraTargetPositionY()
call EnableUserControl(false)
call PauseGame(true)
call SetCameraPosition(CameraX+1,CameraY+1)
call TriggerSyncReady()
call PauseGame(false)
if GetCameraTargetPositionX()==CameraX+1 then
call SetCameraPosition(CameraX,CameraY)
set IsInGame_Check=true
endif
call EnableUserControl(true)
endfunction

function FindaHost takes nothing returns nothing
local gamecache hf=InitGameCache("theone")
set theHost=Player(0)
call StoreInteger(hf,"a","a",GetPlayerId(GetLocalPlayer()))
call TriggerSyncStart()
call SyncStoredInteger(hf,"a","a")
call TriggerSyncReady()
set theHost=Player(GetStoredInteger(hf,"a","a"))
endfunction

function Trig_shuoming_Actions takes nothing returns nothing
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,"4854")
call TriggerSleepAction(5.)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,"4814")
endfunction

function Trig_democ_Actions takes nothing returns nothing
local integer i=0
call msg(GetLocalPlayer(),"information start")
loop
exitwhen i==12
if IsPlayerAvailable(Player(i))then
call FirstSelect(Player(i))
endif
set i=i+1
endloop
call TriggerSleepAction(2)
set i=0
loop
exitwhen i==12
if IsPlayerAvailable(Player(i))then
call msg(GetLocalPlayer(),GetPlayerName(Player(i))+"timeout"+R2S(PlayerDelay))
if IsPlayerInForce(Player(i),CheatParty)then
set udg_MHplayer[GetPlayerId(Player(i))+1]=Player(i)
call BJDebugMsg("player |cff00FFFF"+I2S(GetPlayerId(Player(i))+1)+"  |cffFFFFFFplayerName |cff00FFFF"+GetPlayerName(Player(i))+" |cffFFFFFFis cheating!")
endif
endif
set i=i+1
endloop
endfunction

function main takes nothing returns nothing
call DetZoomInit()
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(0),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(1),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(2),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(3),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(4),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(5),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(6),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(7),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(8),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(9),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(10),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(11),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(12),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(13),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(14),"-mh",true)
call TriggerRegisterPlayerChatEvent(gg_trg_democ,Player(15),"-mh",true)
call TriggerAddAction(gg_trg_democ,function Trig_democ_Actions)
call TriggerRegisterTimerEventPeriodic(gg_trg_shuoming,150.)
call TriggerAddAction(gg_trg_shuoming,function Trig_shuoming_Actions)
endfunction[/codes]
回复

使用道具 举报

发表于 2008-9-6 14:52:39 | 显示全部楼层
嗯。。好眼熟的样子
回复

使用道具 举报

发表于 2008-9-6 15:01:53 | 显示全部楼层
如果已经有移植成功的先例的话原因可能只是配置不当,那个检测单位如果加了蝗虫能造成lz的错误情况,检测单位要求能被选上,蝗虫、隐身这些就不能有。

重要的是lz请给个第2个图的源地址,我看看如果放0.02版需要写注释到什么程度。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-24 21:09 , Processed in 0.121801 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表