找回密码
 点一下
查看: 1079|回复: 6

关于jass,这两种函数有什么区别?

[复制链接]
发表于 2008-7-9 11:37:33 | 显示全部楼层 |阅读模式
CreateNUnitAtLoc      CreateUnitAtLoc
两者哪个效率更高?那么另一个的存在有什么价值?
(好象关乎BJ和CJ的渊源,教程里没讲明白)

还有这个  GetLastCreatedEffectBJ
                     bj_lastCreatedEffect
都带BJ,意味着什么- -
发表于 2008-7-9 11:43:11 | 显示全部楼层
[codes=jass]function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)
    loop
        set count = count - 1
        exitwhen count < 0
        call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction[/codes]
[codes=jass]function CreateUnitAtLocSaveLast takes player id, integer unitid, location loc, real face returns unit
    if (unitid == 'ugol') then
        set bj_lastCreatedUnit = CreateBlightedGoldmine(id, GetLocationX(loc), GetLocationY(loc), face)
    else
        set bj_lastCreatedUnit = CreateUnitAtLoc(id, unitid, loc, face)
    endif

    return bj_lastCreatedUnit
endfunction[/codes]

CreateNUnitsAtLoc就是循环调用CreateUnitAtLocSaveLast并用bj_lastCreatedGroup(最后创建的单位组)记录创建的这些单位,而CreateUnitAtLocSaveLast就是调用CreateUnitAtLoc并用bj_lastCreatedUnit(最后创建的单位)记录这个单位

其实最推荐使用的是CreateUnit,直接通过坐标创建单位

带bj的说明是blizzard.j中的全局变量或者函数,这些函数都是调用common.j里函数的
回复

使用道具 举报

 楼主| 发表于 2008-7-9 11:46:35 | 显示全部楼层
谢谢啊~~还有个小白问题,关系到这个新手对JASS作用的理解
我把T转换成了JASS格式,是不是意味着程序效率将提高?
也就是说由T直接转换来的JASS和一般编写所用的区别在哪?
回复

使用道具 举报

发表于 2008-7-9 11:51:52 | 显示全部楼层
T直接转成jass和T没有区别………………
一般编写的会避免使用bj函数而使用cj函数,从而提高效率
回复

使用道具 举报

 楼主| 发表于 2008-7-9 12:03:11 | 显示全部楼层
原来如此,那么CJ函数在结构上与BJ相比有什么特点
我怎样才能知道它是BJ还是CJ?
回复

使用道具 举报

发表于 2008-7-9 12:05:40 | 显示全部楼层
额,有BJ的都是bj函数
其他的靠感觉吧………………

可以用一些工具,如jasscraft等,里面可以查函数的代码
回复

使用道具 举报

 楼主| 发表于 2008-7-9 12:10:58 | 显示全部楼层
谢谢你教了我这么多~~
我终于开始起步了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-7-20 22:23 , Processed in 0.037682 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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