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

jass新手求教.关于闪电类型和闪电效果的排泄..请高手指点一下.

[复制链接]
发表于 2011-3-20 23:35:07 | 显示全部楼层 |阅读模式



在疑难区给别人写的演示...擦汗..但是之前从来没有写过闪电这种变量的....
而且自己的J学的很还很烂
所以发上来请高手看看.
进而有哪些没有排泄?
或者有哪些错误.
还想问问.这么多的local 和 set 是不是很没有效率....多次运行的话.是不是很耗资源...

[jass]
function Trig_sd_____________________uActions takes nothing returns nothing
    local string array sg
    local unit d
    local integer N
    local real ss
    local location d1
    local lightning array sd
    local location array d2
    local location array d3
    local integer zs
    set sg[0] = "CLPB"
    set sg[1] = "CLSB"
    set sg[2] = "DRAB"
    set sg[3] = "DRAM"
    set sg[4] = "AFOD"
    set sg[5] = "FORK"
    set sg[6] = "HWPB"
    set sg[7] = "HWSB"
    set sg[8] = "CHIM"
    set sg[9] = "LEAS"
    set sg[10] = "MBUR"
    set sg[11] = "MFPB"
    set sg[12] = "SPLK"
    set d1 = GetUnitLoc(gg_unit_Hmkg_0000)
    set N = GetRandomInt(0, 12)
    set ss = I2R(GetRandomInt(100, 800))
    set zs = 1
    loop
        exitwhen zs > 36
        set d2[zs] = PolarProjectionBJ(d1, ss, ( 10.00 * I2R(zs) ))
        set d3[zs] = PolarProjectionBJ(d1, ss, ( 10.00 * ( I2R(zs) + 1 ) ))
        call AddLightningLoc( sg[N], d2[zs], d3[zs] )
        set sd[zs] = bj_lastCreatedLightning
        set zs = zs + 1
    endloop
    call TriggerSleepAction(2)
    set zs = 1
    loop
        exitwhen zs > 36
        call DestroyLightning( sd[zs] )
        call RemoveLocation( d2[zs] )
        call RemoveLocation( d3[zs] )
        set sd[zs] =null
        set d2[zs] = null
        set d3 [zs] = null
        set zs = zs + 1
    endloop
    call RemoveLocation( d1)
    set d =null
    set d1 = null
endfunction
//===========================================================================
function InitTrig_sd_____________________u takes nothing returns nothing
    set gg_trg_sd_____________________u = CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_sd_____________________u, Player(0) )
    call TriggerAddAction(gg_trg_sd_____________________u, function Trig_sd_____________________uActions)
endfunction
[/jass]
发表于 2011-3-22 12:00:45 | 显示全部楼层
很多的local和set不会很没有效率....多次运行的话不会很耗资源...
没有泄漏没有错误……
回复

使用道具 举报

发表于 2011-3-23 11:09:16 | 显示全部楼层
看到姐妹贴~我也回个姐妹贴
call AddLightningLoc( sg[N], d2[zs], d3[zs] )
set sd[zs] = bj_lastCreatedLightning

直接改 set sd[zs] =  AddLightningLoc( sg[N], d2[zs], d3[zs] )

set ss = I2R(GetRandomInt(100, 800))
直接用 set ss = GetRandomReal(100.,800.)

还有就是建议用坐标做好
细节决定成败
回复

使用道具 举报

 楼主| 发表于 2011-3-23 13:23:46 | 显示全部楼层
引用第2楼醉酒少女于2011-03-23 11:09发表的 :
看到姐妹贴~我也回个姐妹贴
call AddLightningLoc( sg[N], d2[zs], d3[zs] )
set sd[zs] = bj_lastCreatedLightning

直接改 set sd[zs] =  AddLightningLoc( sg[N], d2[zs], d3[zs] )
.......

感谢前辈.
你说的第一个SET我还明白.
但是第二个. 随机整数.不用I2R吗?好奇.还是说在JASS中不用?
还想问的就是.如何用坐标呢?....能不能给个示例..哪怕一行代码都好....麻烦了.
回复

使用道具 举报

发表于 2011-3-30 09:28:26 | 显示全部楼层
第二个为什么看不懂?
set ss = I2R(GetRandomInt(100, 800))
直接用 set ss = GetRandomReal(100.,800.)

你ss是实数, 你先 随机整数 再转换整数为实数。
那我的做法是直接 随机实数。

用坐标做很简单啊。
比如这句
call AddLightningLoc( sg[N], d2[zs], d3[zs] )
可以换成
native AddLightning                 takes string codeName, boolean checkVisibility, real x1, real y1, real x2, real y2 returns lightning
然后那些点都不要了,全部改用坐标计算。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-28 01:31 , Processed in 0.259441 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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