找回密码
 点一下
查看: 2320|回复: 14

纯粹发泄贴~~

  [复制链接]
发表于 2007-1-15 22:01:54 | 显示全部楼层 |阅读模式
嗯嗯~~
已经N次用了GetSpellTargetLoc()鸟~~
唯一需要用的点函数
可恶的Blz居然没有提供GetSpellTargetX/Y函数,相当令人不爽~~
发表于 2007-1-15 22:09:24 | 显示全部楼层
貌似就素多了几步内存释放滴操作...
回复

使用道具 举报

发表于 2007-1-15 22:14:59 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2007-1-16 14:45:57 | 显示全部楼层
因为论坛有BUG~~
回复

使用道具 举报

发表于 2007-1-16 14:49:31 | 显示全部楼层
Red Wolf是在做那个直线(不跟踪目标的)火球术吗?我想要。
回复

使用道具 举报

发表于 2007-1-16 19:04:43 | 显示全部楼层
老狼真可怜。。。那么多外债啊~
回复

使用道具 举报

发表于 2007-1-16 19:58:20 | 显示全部楼层
地精基本重置器
可将自已所有负分清零
难道这个道具就是起这个作用的?
回复

使用道具 举报

发表于 2007-1-16 20:23:41 | 显示全部楼层
知道怎么弄,但是不告诉你~~拉拉
回复

使用道具 举报

发表于 2007-1-16 20:42:29 | 显示全部楼层
LS is contemptible...
其实偶也知道...
回复

使用道具 举报

 楼主| 发表于 2007-1-18 08:24:33 | 显示全部楼层
引用第4楼hackwaly2007-01-16 14:49发表的:
Red Wolf是在做那个直线(不跟踪目标的)火球术吗?我想要。

嗯俄~~
这个是以前写的冰弹技能
遇到障碍物或敌方单位造成小范围伤害+减速和一定几率冰封

function IceBoltEnumDamage takes nothing returns boolean
    local unit targ = GetFilterUnit()
    local unit u
    if IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(udg_TempUnit)) and not IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) then
        set u = CreateUnit(Player(15),'E003',GetUnitX(targ),GetUnitY(targ),0)
        call UnitApplyTimedLife(u,'BHwe',0.3)
        call UnitAddAbility(u,'A05G')
        call SetUnitAbilityLevel(u,'A05G',udg_TempInt-'A05A'+1)
        call UnitAddAbility(u,'A05E')
        call SetUnitAbilityLevel(u,'A05E',udg_TempInt2)
        call UnitRemoveAbility(u,'A05G')
        call IssueTargetOrderById(u,851983,targ)//attack
        call SpellDamage(udg_TempUnit,targ,udg_TempReal)
        if GetRandomInt(0,99)<udg_TempInt3 then
            set u = CreateUnit(Player(15),'e002',GetUnitX(targ),GetUnitY(targ),0)
            call UnitApplyTimedLife(u,'BHwe',0.3)
            call UnitAddAbility(u,'A05H')
            call IssueTargetOrderById(u,851983,targ)//attack
        endif
    endif
    set targ=null
    set u=null
    return false
endfunction

function IceBoltDamage takes unit u returns nothing
    local integer tm = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Timer")
    local integer trg = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Trigger")
    set udg_TempUnit = i2u(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"Caster"))
    call DestroyEffect(i2ef(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"BoltEffect")))
    call UnitApplyTimedLife(u,'BHwe',1.5)
    if GetUnitAbilityLevel(udg_TempUnit,'A05B') >0 then
        set udg_TempInt = 'A05B'
        set udg_TempInt2 = GetUnitAbilityLevel(udg_TempUnit,'A05B')
        set udg_TempInt3 = udg_TempInt2*5+5
        set udg_TempReal = udg_TempInt2*100+300
    else
        set udg_TempInt = 'A05A'
        set udg_TempInt2 = GetUnitAbilityLevel(udg_TempUnit,'A05A')
        set udg_TempInt3 = 0
        set udg_TempReal = udg_TempInt2*100
    endif
    call GroupEnumUnitsInRange(udg_TempGroup,GetUnitX(u),GetUnitY(u),150.0,Condition(function IceBoltEnumDamage))
    call DestroyTimer(i2tm(tm))
    call TriggerRemoveCondition(i2tg(trg),i2tc(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(u)),"TriggerCondition")))
    call DestroyTrigger(i2tg(trg))
    call FlushStoredMission(udg_GC,"IceBolt"+I2S(h2i(u)))
    call FlushStoredMission(udg_GC,"IceBolt"+I2S(tm))
    call FlushStoredMission(udg_GC,"IceBolt"+I2S(trg))
endfunction

function IceBolt_DestCheck takes nothing returns nothing
    set udg_TempBool = true
endfunction

function IceBoltMove takes nothing returns nothing
    local unit u = i2u(GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(GetExpiredTimer())),"IceBolt"))
    local real f = GetUnitFacing(u)
    local real x = GetUnitX(u)+20*Cos(f*bj_PI/180.0)
    local real y = GetUnitY(u)+20*Sin(f*bj_PI/180.0)
    call SetUnitX(u,x)
    call SetUnitY(u,y)
    if IsTerrainPathable(x,y,PATHING_TYPE_WALKABILITY) then
        call IceBoltDamage(u)
    else
        set udg_TempBool = false
        call SetRect(udg_TempRect,x-50,y-50,x+50,y+50)
        call EnumDestructablesInRect(udg_TempRect,null,function IceBolt_DestCheck)
        if udg_TempBool then
            call IceBoltDamage(u)
        endif
    endif
    set u = null
endfunction

function IceBolt_WithIn takes nothing returns boolean
    local integer iu = GetStoredInteger(udg_GC,"IceBolt"+I2S(h2i(GetTriggeringTrigger())),"IceBolt")
    if GetTriggerEventId()==ConvertGameEvent(4) then
        call IceBoltDamage(i2u(iu))
    elseif IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(i2u(iu))) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then
        call IceBoltDamage(i2u(iu))
    endif
    return false
endfunction

function Skill_IceBolt takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local location p = GetSpellTargetLoc()
    local timer tm = CreateTimer()
    local trigger trg = CreateTrigger()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real f = bj_RADTODEG * Atan2(GetLocationY(p)-y, GetLocationX(p)-x)
    local unit u2 = CreateUnit(GetOwningPlayer(u),'e000',x,y,f)
    local effect eff = AddSpecialEffectTarget("Abilities\\\\Spells\\\\Other\\\\FrostBolt\\\\FrostBoltMissile.mdl",u2,"origin")
    call TimerStart(tm,0.02,true,function IceBoltMove)
    call TriggerRegisterUnitInRange(trg,u2,50,null)
    call TriggerRegisterTimerEvent(trg,1.5,false)
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Trigger",h2i(trg))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"TriggerCondition",h2i(TriggerAddCondition(trg,Condition(function IceBolt_WithIn))))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Timer",h2i(tm))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"BoltEffect",h2i(eff))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(u2)),"Caster",h2i(u))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(trg)),"IceBolt",h2i(u2))
    call StoreInteger(udg_GC,"IceBolt"+I2S(h2i(tm)),"IceBolt",h2i(u2))
    call RemoveLocation(p)
    set u=null
    set u2=null
    set p=null
    set tm=null
    set trg=null
    set eff=null
endfunction
回复

使用道具 举报

发表于 2007-1-18 09:48:59 | 显示全部楼层
能简述一下设计思路么?....一句句看代码很辛苦
回复

使用道具 举报

发表于 2007-1-18 11:14:35 | 显示全部楼层
果然用的是将ForGroup写入Filter的手法~膜拜最追求效率的老狼~
回复

使用道具 举报

发表于 2007-1-18 11:20:12 | 显示全部楼层
强悍啊
回复

使用道具 举报

 楼主| 发表于 2007-1-19 08:15:14 | 显示全部楼层
恩的恩的
秒位移的同时判断所在点是否可通行+有无可破坏物+一个Within Unit的触发,这是需要忽略我方单位时的一般做法

其实还有一种简单做法:创建一个尸体单位,绑定箭矢效果作秒位移,只要判断它的位置和预期坐标之差是否大于某个很小的值,在做地面单位的无差别碰撞很好用,对空中单位则仍需要一个Within Unit的触发
回复

使用道具 举报

发表于 2007-1-19 15:59:04 | 显示全部楼层
不明白所谓的位置和预期坐标之间距离的判断是用来做什么的。。。。。。。。。。。。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-28 21:04 , Processed in 0.034308 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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