找回密码
 点一下
查看: 1450|回复: 8

一个J的小问题

[复制链接]
发表于 2010-9-28 09:53:24 | 显示全部楼层 |阅读模式
这段代码是实现单位跳跃的,奇怪的是,语法没检查出错,但好像没有执行,问题貌似在HASHTABLE上,有没有高人指点一下


function ParabolaToMoveUnitActions takes nothing returns nothing
    local integer parentKey = GetHandleId(GetExpiredTimer())
    local integer i = LoadInteger(udg_HT,parentKey,6)
    local real angle = LoadReal( udg_HT,parentKey,1)
    local real m = LoadReal( udg_HT,parentKey,4 ) / 50
    local real a = LoadReal( udg_HT,parentKey,3 ) / 2
    local real b = LoadReal( udg_HT,parentKey,2 )
    local real A = b/(a*a)
    local real x
    local real y
    local unit u = LoadUnitHandle(udg_HT,parentKey,5)
    local real tempx
    local real tempy
    call BJDebugMsg( "TRIGSTR_003" )
    set i = i + 1
    set x = m*i
    set y = -A*(x-a)*(x-a)+b
    set tempx = GetUnitX(u) + m * Cos(angle*bj_DEGTORAD)
    set tempy = GetUnitY(u) + m * Sin(angle*bj_DEGTORAD)
    call SetUnitX( u, tempx )
    call SetUnitY( u, tempy )
    call SetUnitFacing( u, angle )
    call SetUnitFlyHeight( u, y, 0.00 )
    call RemoveSavedInteger(udg_HT,parentKey,5)
    call SaveInteger( udg_HT,parentKey,5,i )
    call BJDebugMsg( "TRIGSTR_003" )
    if x>=(2*a) then
        call SetUnitFlyHeight( u, GetUnitDefaultFlyHeight(u), 0.00 )
        call FlushChildHashtable( udg_HT,parentKey)
        call DestroyTimer( GetExpiredTimer() )
    endif
endfunction

function ParabolaToMoveUnit takes unit u,real high,real distance,real speed,real angel returns nothing
    local timer t = null
    local integer parentKey
    if (GetUnitState(u,UNIT_STATE_LIFE) > 0.00) and (distance > 0.00) and (speed > 0.00) then
        set t = CreateTimer()
        set parentKey = GetHandleId(t)
        call UnitAddAbility( u,'Arav' )
        call SaveReal( udg_HT,parentKey,1,angel )
        call SaveReal( udg_HT,parentKey,2 ,high )
        call SaveReal( udg_HT,parentKey,3 ,distance )
        call SaveReal( udg_HT,parentKey,4,speed )
        call SaveUnitHandle(udg_HT,parentKey,5,u )
        call SaveInteger(udg_HT,parentKey,6,0)
        call BJDebugMsg( "TRIGSTR_003" )
        call TimerStart( t, 0.02, true, function ParabolaToMoveUnitActions )
    else
        call BJDebugMsg( "TRIGSTR_003" )
        call DestroyTimer(t)
   endif
set t = null
endfunction
发表于 2010-9-28 11:42:18 | 显示全部楼层
初始化hashtable了么
回复

使用道具 举报

 楼主| 发表于 2010-9-28 12:04:12 | 显示全部楼层
此话怎讲?
globals
hashtable HT = null
endglobals
????
我用的是udg

也要初始化 ?
回复

使用道具 举报

发表于 2010-9-28 12:38:18 | 显示全部楼层
那么能发地图么?
回复

使用道具 举报

 楼主| 发表于 2010-9-28 12:46:55 | 显示全部楼层
看起来不是HASTABLE的问题。
因为数据确实被记录了。

ceshizu.w3x

19 KB, 下载次数: 9

此乃图也

回复

使用道具 举报

发表于 2010-9-28 15:01:39 | 显示全部楼层
local integer i = LoadInteger(udg_HT,parentKey,6)
读取6记录call SaveInteger( udg_HT,parentKey,5,i )
无限循环......
移动全部从写了
先放震荡波 在 战争践踏...

xx.w3x

19 KB, 下载次数: 3

回复

使用道具 举报

发表于 2010-9-28 15:02:58 | 显示全部楼层
hashtable HT =IinitHashtable()
回复

使用道具 举报

 楼主| 发表于 2010-9-28 15:17:13 | 显示全部楼层
存5读6了,嘿,真是让人看笑话了。。。。。
谢谢各位
回复

使用道具 举报

发表于 2010-9-28 15:20:08 | 显示全部楼层
嘿嘿~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-3 16:24 , Processed in 0.098235 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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