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

请问这段J有问题吗

[复制链接]
发表于 2009-4-26 13:21:53 | 显示全部楼层 |阅读模式
[jass]
function Yeyu takes nothing returns gamecache
    if udg_GameCache == null then
        call FlushGameCache( udg_GameCache )
        set udg_GameCache = InitGameCache( "Yeyu.w3v")
    endif
    return udg_GameCache
endfunction

function H2I takes handle h returns integer
    return h
    return 0
endfunction

function I2T takes integer i returns trigger
    return i
    return null
endfunction

function I2TC takes integer i returns triggercondition
    return i
    return null
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(Yeyu(),I2S(H2I(subject)),name)
    else
        call StoreInteger(Yeyu(), I2S(H2I(subject)), name, value)
    endif
endfunction

function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(Yeyu(), I2S(H2I(subject)), name)
endfunction

function FlushHandleInt takes handle subject, string name returns nothing
    call FlushStoredInteger(Yeyu(),I2S(H2I(subject)),name)
endfunction

function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(Yeyu(), I2S(H2I(subject)) )
endfunction

function GoFun takes string s returns nothing
  call ExecuteFunc(s)
endfunction

function DamageFunIf takes nothing returns nothing
local integer i = 1
loop
    exitwhen i > GetHandleInt(gg_trg_Init2,"Trigger")
call GoFun("Trig_" + "SSBC" + I2S(i) + "_Actions")
    set i = i + 1
endloop
endfunction

function DamageFun takes unit u,boolean boo returns nothing
local integer t
local integer tc

if boo then
  set  t  = H2I(CreateTrigger())
  set  tc = H2I(TriggerAddCondition( I2T(t), Condition( function DamageFunIf ) ))
  call TriggerRegisterUnitEvent( I2T(t), u, EVENT_UNIT_DAMAGED )
  call SetHandleInt(u,"Trigger",t)
  call SetHandleInt(u,"TriggerC",tc)

else
  set t = GetHandleInt(u,"Trigger")
  set tc = GetHandleInt(u,"TriggerC")
  call TriggerRemoveCondition(I2T(t),I2TC(tc))

call FlushHandleInt(u,"Trigger")
call FlushHandleInt(u,"TriggerC")
call DestroyTrigger(I2T(t))
endif      
endfunction

function SSBCCC takes nothing returns nothing
if GetPlayerController(GetOwningPlayer(GetTriggerUnit())) != MAP_CONTROL_USER then
call DamageFun(GetTriggerUnit(),false)
endif
endfunction

function SSBCCCC takes nothing returns nothing
call DamageFun(GetTriggerUnit(),true)
endfunction

function SSBCCCCC takes nothing returns nothing
call DamageFun(GetEnumUnit(),true)
endfunction

function SSBCC takes integer i returns nothing
local integer t
local integer tc


  call SetHandleInt(gg_trg_Init2,"Trigger",i)
  set  t  = H2I(CreateTrigger())
  set  tc = H2I(TriggerAddCondition( I2T(t), Condition( function SSBCCC ) ))
  call TriggerRegisterAnyUnitEventBJ( I2T(t), EVENT_PLAYER_UNIT_DEATH )

  set  t  = H2I(CreateTrigger())
  set  tc = H2I(TriggerAddCondition( I2T(t), Condition( function SSBCCCC ) ))
  call TriggerRegisterEnterRectSimple( I2T(t), GetPlayableMapRect() )

    call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function SSBCCCCC )
    call DestroyGroup( bj_lastCreatedGroup )

  
endfunction


function InitTrig_Init takes nothing returns nothing
endfunction

-------------------------------------------
移植过来的伤害事件代码
偶尔会失效的样子
不知道是不是这玩意儿害我系统不稳定
发表于 2009-4-26 14:55:17 | 显示全部楼层
用war3craft检验
回复

使用道具 举报

发表于 2009-4-27 13:28:24 | 显示全部楼层
[jass]function DamageFunIf takes nothing returns nothing
    local integer i = 1
    loop
        exitwhen i > GetHandleInt(gg_trg_Init2,"Trigger")
        call GoFun("Trig_" + "SSBC" + I2S(i) + "_Actions")
        set i = i + 1
    endloop
endfunction[/jass]
明显这个函数里("Trig_" + "SSBC" + I2S(i) + "_Actions")没有出现在你给出的代码里..
回复

使用道具 举报

发表于 2009-4-27 17:35:17 | 显示全部楼层
call SetHandleInt(gg_trg_Init2,"Trigger",i)

给全局变量绑定缓存貌似没什么用,多次调用还是会被覆盖,还不如用全局变量好了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 06:12 , Processed in 0.029912 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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