找回密码
 点一下
查看: 1697|回复: 4

菜鸟系JASS问题:关于polledWait 以及 冲锋动作

[复制链接]
发表于 2008-2-20 10:50:34 | 显示全部楼层 |阅读模式
请问call PolledWait()后面是否只能使用整数?

我在使用如下语句时,测试无效


[codes=jass]
    loop
        exitwhen IntNum > 150
        set IntNum = IntNum+ 1      
        call SetUnitFacingToFaceUnitTimed( GetTriggerUnit(), yourunit, 0 )
        call PolledWait(0.02)
    endloop[/codes]

但是改成[codes=jass]
    loop
        exitwhen IntNum > 3
        set IntNum = IntNum+ 1      
        call SetUnitFacingToFaceUnitTimed( GetTriggerUnit(), yourunit, 0 )
        call PolledWait(1)
    endloop[/codes]就能使用了,何故?



另外,在下面的语句中我试图做一个冲锋动作(创建的傀儡单位以沙土效果为模型),但在实际测试时,有沙土短暂移动的效果,英雄却始终停留在原地,哪位前辈能帮我找出错误所在

[codes=jass]
local unit yourunit
    local unit itsunit
    local location PTbegin
   set yourunit= GetSpellTargetUnit()
   set PTbegin= PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 40.00, GetUnitFacing(GetTriggerUnit()))
   set itsunit = CreateUnitAtLoc( GetTriggerPlayer(), 'e000', PTbegin, AngleBetweenPoints( PTbegin, GetUnitLoc( yourunit )))
    set PTbegin = PolarProjectionBJ(PTbegin, 40.00, GetUnitFacing( itsunit ))
    call SetUnitPositionLoc( GetTriggerUnit(), PTbegin )
    call UnitApplyTimedLifeBJ( 2.00, 'BTLF', itsunit )
    call SetUnitFacingToFaceUnitTimed( GetTriggerUnit(), yourunit, 0 )
    set PTbegin= PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 40.00, GetUnitFacing(GetTriggerUnit()))
    call RemoveLocation( GetUnitLoc(GetTriggerUnit()) )[/codes]
发表于 2008-2-20 11:05:59 | 显示全部楼层

Re:菜鸟系JASS问题:关于polleWait 以及 冲锋动作

因为PolledWait()的判断间隔只能精确到>0.1~~

既然学了jass~~就不要再用这个函数了~~这应该是最不适合拿来计时的函数之一~~你要精确到小数点后2位就只能用timer了~~



至于第二个冲锋的jass~~无论怎么看~~向面前40再加向反方向40~~怎么都是原地吧~~而且40是什么概念?~~一个近战单位的攻击距离都有150~~

至于最后两句更是不明所以~~如果你想删除点的泄漏吧?~~也不是这样做的~~这样反而只会更加重负担而以~~既然初学jass~~就不用太执着于排除泄漏什么的~~先从简单的语法抓起吧~~
回复

使用道具 举报

 楼主| 发表于 2008-2-20 11:41:38 | 显示全部楼层
恩````发现问题了,发错好多```我是要loop的````
exitwhen那里想用200范围内有 yourunit  这个条件,请问用jass该怎么写?
[codes=jass]set yourunit= GetSpellTargetUnit()
   set PTbegin= PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 40.00, GetUnitFacing(GetTriggerUnit()))
   loop
     exitwhen  _____________
     set itsunit = CreateUnitAtLoc( GetTriggerPlayer(), 'e000', PTbegin, AngleBetweenPoints( PTbegin, GetUnitLoc( yourunit )))
     set PTbegin = PolarProjectionBJ(PTbegin, 40.00, GetUnitFacing( itsunit ))
     call SetUnitPositionLoc( GetTriggerUnit(), PTbegin )
     call UnitApplyTimedLifeBJ( 2.00, 'BTLF', itsunit )
     call SetUnitFacingToFaceUnitTimed( GetTriggerUnit(), yourunit, 0 )
   endloop
     call RemoveLocation( PTbegin)[/codes]

另外``已经在努力研究timer了``
回复

使用道具 举报

发表于 2008-2-20 12:25:20 | 显示全部楼层
这个可以用两点距离判断,恩
BJ函数里有一个两点间距的函数的,或者可以自己获取坐标来计算
回复

使用道具 举报

 楼主| 发表于 2008-2-20 17:50:46 | 显示全部楼层
DistanceBetweenPoints啊~

OK了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 11:35 , Processed in 0.150872 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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