找回密码
 点一下
查看: 1173|回复: 12

让人崩溃的演示(来自老狼--关于缓存的)

[复制链接]
发表于 2010-7-20 11:58:27 | 显示全部楼层 |阅读模式
  global s
    // User-defined
    location                udg_TempLoc                = null
    group                   udg_TC_Group               = null
    integer                 udg_TC_LoopInt             = 0
    group                   udg_LocalGroup             = null
    integer                 udg_LocalInt               = 0
    gamecache               udg_GC                     = null
    // Generated
    trigger                 gg_trg_gamacacheInit       = null
    trigger                 gg_trg_Trg1                = null
    trigger                 gg_trg_Trg2                = null
    trigger                 gg_trg_gamecache           = null
endglobals
function h2i takes handle h returns integer
return h
return 0
endfunction
function i2u takes integer i returns unit
return i
return null
endfunction
function s2i takes string s returns integer
return s
return 0
endfunction
function i2s takes integer i returns string
return i
return null
endfunction
function Trig_gamacacheInit_Actions takes nothing returns nothing
    call InitGameCacheBJ( "MapName.w3v" )
    set udg_GC = GetLastCreatedGameCacheBJ()
endfunction
function InitTrig_gamacacheInit takes nothing returns nothing
    set gg_trg_gamacacheInit = CreateTrigger(  )
    call TriggerAddAction( gg_trg_gamacacheInit, function Trig_gamacacheInit_Actions )
endfunction

function Trig_gamecache_TimerFunc takes nothing returns nothing
    local integer iu = GetStoredInteger(udg_GC, I2S(h2i(GetExpiredTimer())), "DamagedUnit")
    call UnitDamageTarget(i2u(GetStoredInteger(udg_GC, I2S(h2i(GetExpiredTimer())), "Caster")), i2u(iu), 10.0, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING, WEAPON_TYPE_WHOKNOWS)
    if GetUnitAbilityLevel(i2u(iu), 'BHtc') <= 0 then
        call FlushStoredMission(udg_GC, I2S(h2i(GetExpiredTimer())))
        call FlushStoredInteger(udg_GC, I2S(iu), "ThunderClapTimer")
        call DestroyTimer(GetExpiredTimer())
    endif
endfunction
function Trig_gamecache_FilterFunc takes nothing returns boolean
    if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0 and not HaveStoredInteger(udg_GC, I2S(h2i(GetFilterUnit())), "ThunderClapTimer") then
        set bj_lastStartedTimer = CreateTimer()
        call StoreInteger(udg_GC, I2S(h2i(GetFilterUnit())), "ThunderClapTimer", h2i(bj_lastStartedTimer))
        call StoreInteger(udg_GC, I2S(h2i(bj_lastStartedTimer)), "DamagedUnit", h2i(GetFilterUnit()))
        call StoreInteger(udg_GC, I2S(h2i(bj_lastStartedTimer)), "Caster", h2i(GetTriggerUnit()))
        call TimerStart(bj_lastStartedTimer,1.0,true, function Trig_gamecache_TimerFunc)
    endif
    return false
endfunction
function Trig_gamecache_Conditions takes nothing returns boolean
    if GetSpellAbilityId() == 'AHtc' then
        call GroupEnumUnitsInRange(udg_TC_Group, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()),400, Condition(function Trig_gamecache_FilterFunc))
    endif
    return false
endfunction
function InitTrig_gamecache takes nothing returns nothing
    set gg_trg_gamecache = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_gamecache, EVENT_PLAYER_UNIT_SPELL_FINISH)
    call TriggerAddCondition(gg_trg_gamecache, Condition(function Trig_gamecache_Conditions))
endfunction
函数GroupEnumUnitsInRange是干什么的?选取一定范围内的单位做动作??udg_TC_Group没见到他赋值呢?函数HaveStoredInteger的作用是??‘BHtc’没见到这个技能啊!
FlushStoredMission是删除一个类别么??
FlushStoredInteger是删除一个类别下的文件里的整数??
演示来源
http://bbs.islga.org/read-htm-tid-3791.html
这是演示地图



testMap.w3x

26 KB, 下载次数: 4

发表于 2010-7-20 12:01:03 | 显示全部楼层
字体改小些吧。。。。
回复

使用道具 举报

 楼主| 发表于 2010-7-20 13:58:51 | 显示全部楼层
难道没有人愿意看么???
回复

使用道具 举报

发表于 2010-7-20 14:03:03 | 显示全部楼层
引用第2楼蚊子于2010-07-20 13:58发表的  :
难道没有人愿意看么???

会Jass的很少,另外没明白LZ要问什么,就是问语法?

我给你查查
回复

使用道具 举报

发表于 2010-7-20 14:25:18 | 显示全部楼层
1
native GroupEnumUnitsInRange takes group whichGroup, real x, real y, real radius, boolexpr filter returns nothing

This will find all units in the circle specified by x, y, radius.
If the filter is not null, it is evaluated for each unit, where GetFilterUnit() refers to the unit being evaluated.
The unit is added to whichGroup if the filter evaluated to true.
If the filter is null, all units within the circle are added to the group.

Units with the 'Aloc' ability (Locust), are not selected by this function.
A unit's collision size must be covered entirely by the circle in order to be detected. Units with collision size 0 are never detected.

本函数先找到圆心xy和半径制定的园内的所有单位
如果过滤的布尔判断表达式这一项不为空,就用该表达式过滤,使布尔表达式=true都会被选取
该项为空,就把园里德所有单位加入

蝗虫技能不被选取,单位选择圈必须完全被包含,碰撞大小=0的单位不被选取


2
FlushStoredMission是删除一个类别么   对
FlushStoredInteger是删除一个类别 下的某整数(参数:缓存,类别,名)
回复

使用道具 举报

发表于 2010-7-20 15:57:52 | 显示全部楼层
GroupEnumUnitsInRange的作用同LS,它本身就已经给udg_TC_Group赋值了,自然不需要再set。

HaveStoredInteger用于检查某缓存项是否已储存整数数据,返回布尔值。

‘BHtc’一看是B开头的就知道是BUFF了,你怎么找到这个技能???

native FlushStoredMission takes gamecache cache, string missionKey returns nothing
删除并清空某个缓存分类

native FlushStoredInteger takes gamecache cache, string missionKey, string key returns nothing
清空某个缓存项所储存的指定整数,但并不会删除缓存项
回复

使用道具 举报

 楼主| 发表于 2010-7-20 16:17:52 | 显示全部楼层
看这个代码if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0代码上不是说匹配单位的技能'BHtc')等级>0么??
回复

使用道具 举报

发表于 2010-7-20 16:24:26 | 显示全部楼层
技能 和 BUFF  在某些程度上是一样的。

比如:要检查单位是否拥有一个0级技能(待学习),你就不能用if GetUnitAbilityLevel(GetFilterUnit(), 'XXXX') > 0,而需要用检查魔法效果的函数。
回复

使用道具 举报

 楼主| 发表于 2010-7-20 16:40:52 | 显示全部楼层
终于看明白了,代码if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0应该是用来判断被攻击单位是否拥有雷霆一击这个技能效果,应该是这样的,不过不知道用T怎么弄出来
回复

使用道具 举报

 楼主| 发表于 2010-7-20 16:53:29 | 显示全部楼层
我把编辑器里的持续状态--普通和持续状态---英雄修改了一下,发现了问题,持续状态--普通好像是说打在单位上出现的BUFF的持续时间,而持续状态---英雄好像是说打在英雄上面出现的BUFF持续的时间(我试过了,确实如此——就这个技能而言,其他技能不知道),假如把持续状态--普通改为0,那么打在单位身上没有魔法效果了,应该,也就不会造成伤害了,因为只有满足if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0才会造成伤害啊,所以说代码if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0不是说单位身上拥有BUFF吧,那么这段代码应该怎么理解呢??
回复

使用道具 举报

发表于 2010-7-20 17:03:17 | 显示全部楼层
这一段的效果是对雷霆一击范围内受到伤害的单位再每秒进行伤害,if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0是判断单位身上是否还有buff,没有的话就停止每秒的伤害。

ps:持续时间改成0不是永久有buff么.....
回复

使用道具 举报

发表于 2010-7-20 17:14:28 | 显示全部楼层
引用第9楼蚊子于2010-07-20 16:53发表的  :
我把编辑器里的持续状态--普通和持续状态---英雄修改了一下,发现了问题,持续状态--普通好像是说打在单位上出现的BUFF的持续时间,而持续状态---英雄好像是说打在英雄上面出现的BUFF持续的时间(我试过了,确实如此——就这个技能而言,其他技能不知道),假如把持续状态--普通改为0,那么打在单位身上没有魔法效果了,应该,也就不会造成伤害了,因为只有满足if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0才会造成伤害啊,所以说代码if GetUnitAbilityLevel(GetFilterUnit(), 'BHtc') > 0不是说单位身上拥有BUFF吧,那么这段代码应该怎么理解呢??
该演示中如果“持续效果”改为0,本来就不会有伤害。(当然,技能本身的伤害还是有的。)
回复

使用道具 举报

 楼主| 发表于 2010-7-20 17:26:34 | 显示全部楼层
又试了一次,结果真的跟希瓦和louter所说,谢谢了
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-29 00:14 , Processed in 0.162146 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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