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

快速后退,然后快速近身,用于躲过敌人的技能。

[复制链接]
发表于 2010-10-10 23:14:04 | 显示全部楼层 |阅读模式
这个技能一点都不华丽-.-!,但是用来做AI很不错,我也给他弄了伤害。你给AI注册一个某敌方单位开始使用某技能(如雷霆一击),然后就命令AI用这招,躲过雷霆一击,然后迅速近身xxxYDYD
function JingYunBuDamage takes nothing returns nothing//伤害
local trigger trg=GetTriggeringTrigger()
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Critters\\Albatross\\CritterBloodAlbatross.mdl"  , GetTriggerUnit(), "chest" ))
call damage(GetTriggerUnit(),GetTriggerUnit(),400)
set trg=null
endfunction
//-------------------------------------------------------
function JingYunBu1 takes nothing returns nothing//向前直线运动
local timer tm=GetExpiredTimer()
local unit me=LUtm(tm,"me")
local real angle=LRtm(tm,"angle")
local real speed=30
local integer t=LItm(tm,"t")
call SetUnitX(me,GetUnitX(me)+speed*Cos(angle))
call SetUnitY(me,GetUnitY(me)+speed*Sin(angle))
set t=t+1
call SItm(tm,"t",t)
if t>18 then
  call DestroyTrigger(LTGtm(tm,"trg"))
  call FlushChildHashtable(udg_HT,GetHandleId(tm))
  call DestroyTimer(tm)
endif
set me=null
set tm=null
endfunction
//----------------------------------------------------------
function JingYunBu takes nothing returns nothing //等待0.2秒后开启向前的计时器
local timer tm=GetExpiredTimer()
  call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl",GetUnitX(LUtm(tm,"me")),GetUnitY(LUtm(tm,"me"))))
call TimerStart(tm,0.01,true,function JingYunBu1)
set tm=null
endfunction
function JingYunBu0 takes nothing returns nothing//向后快速退
local timer tm=GetExpiredTimer()
local real angle=LRtm(tm,"angle")+bj_PI
local unit me=LUtm(tm,"me")
local integer t0=LItm(tm,"t0")
call SetUnitX(me,GetUnitX(me)+30*Cos(angle))
call SetUnitY(me,GetUnitY(me)+30*Sin(angle))
set t0=t0+1
call SItm(tm,"t0",t0)
if t0>20 then
   call SetUnitAnimation(me,"attack")
   call TimerStart(tm,0.2,true,function JingYunBu)
endif
set tm=null
set me=null
endfunction
//-----------------------------------------------------------------
function Trig_jing_yun_bu_Conditions takes nothing returns boolean//技能入口
    local timer tm
    local real angle
    local trigger trg
    if ( not ( GetSpellAbilityId() == 'A00E' ) ) then
        return false
    endif
    set tm=CreateTimer()
    set trg=CreateTrigger()
    set angle=bj_PI*GetUnitFacing(GetTriggerUnit())/180+bj_PI
    call SUtm(tm,"me",GetTriggerUnit())
    call SRtm(tm,"angle",angle-bj_PI)
    call STGtm(tm,"trg",trg)
    call TriggerRegisterUnitInRangeSimple(trg,300,GetTriggerUnit())
    call TriggerAddCondition(trg,function JingYunBuDamage)
    call TimerStart(tm,0.01,true,function JingYunBu0)
    return true
endfunction

function Trig_jing_yun_bu_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_jing_yun_bu takes nothing returns nothing
    set gg_trg_jing_yun_bu = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_jing_yun_bu, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_jing_yun_bu, Condition( function Trig_jing_yun_bu_Conditions ) )
    call TriggerAddAction( gg_trg_jing_yun_bu, function Trig_jing_yun_bu_Actions )
endfunction
发表于 2010-10-11 02:14:24 | 显示全部楼层
路人表示看不懂
回复

使用道具 举报

发表于 2010-10-11 11:24:41 | 显示全部楼层
JASS很强大,不过我不懂
回复

使用道具 举报

发表于 2010-10-11 12:15:29 | 显示全部楼层
楼主也是刚学J。建议楼主把自己学习过程弄一个教程造福大众。
回复

使用道具 举报

发表于 2010-10-11 12:20:04 | 显示全部楼层
明明就有现成的教程
只要有时间 没有看不懂学不会的借口
培训班教程
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-1 14:38 , Processed in 0.030732 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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