很抱歉啊.忙活了大半天,只能做到这样了.测试了一会,大概没什么问题
以下是技能代码.
先新建一个游戏缓存类型的变量叫"gc_jump"
触发名字叫"jump"
我做完发现我貌似做的是真三里面关羽的跳- -!
不过比他的方便,我这个既可以点地板.又可以点人,点人会追到人砸上去.
function htoi takes handle h returns integer
return h
return 0
endfunction
function itou takes integer i returns unit
return i
return null
endfunction
function gc takes nothing returns gamecache
if gc_jump==null then
call FlushGameCache(InitGameCache("Nef.w3v"))
set gc_jump=InitGameCache("Nef.w3v")
endif
return gc_jump
endfunction
function jump_move_i takes nothing returns nothing
local timer tm = GetExpiredTimer()
local unit trgunit = itou(GetStoredInteger(gc(),I2S(htoi(tm)),"trgunit"))
local real ox = GetStoredReal(gc(),I2S(htoi(tm)),"ox")
local real oy = GetStoredReal(gc(),I2S(htoi(tm)),"oy")
local real tx = GetStoredReal(gc(),I2S(htoi(tm)),"tx")
local real ty = GetStoredReal(gc(),I2S(htoi(tm)),"ty")
local integer step = GetStoredInteger(gc(),I2S(htoi(tm)),"step")
local integer max = GetStoredInteger(gc(),I2S(htoi(tm)),"max")
if step < max then
call SetUnitX(trgunit,ox+((tx-ox)/I2R(max))*I2R(step))
call SetUnitY(trgunit,oy+((ty-oy)/I2R(max))*I2R(step))
if (step < max/2+1) then
call SetUnitFlyHeight(trgunit,(1200.00/I2R(max))*I2R(step),9999.99)
else
call SetUnitFlyHeight(trgunit,(1200.00/I2R(max))*I2R(max-step),9999.99)
endif
set step = step + 1
call StoreInteger(gc(),I2S(htoi(tm)),"step",step)
else
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", tx, ty) )
call UnitDamagePoint( trgunit, 0, 150.00, tx, ty, 100.00*I2R(GetUnitAbilityLevel(trgunit,'A000')), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
// call SetPlayerAbilityAvailable(trgunit,'Amrf',true)
call UnitRemoveAbility( trgunit, 'Amrf' )
call UnitRemoveAbility( trgunit, 'Abun' )
call SetUnitInvulnerable( trgunit, false )
set trgunit = null
call FlushStoredMission(gc(),I2S(htoi(tm)))
call DestroyTimer(tm)
endif
endfunction
function jump_move_ii takes nothing returns nothing
local timer tm = GetExpiredTimer()
local unit trgunit = itou(GetStoredInteger(gc(),I2S(htoi(tm)),"trgunit"))
local unit tarunit = itou(GetStoredInteger(gc(),I2S(htoi(tm)),"tarunit"))
local integer step = GetStoredInteger(gc(),I2S(htoi(tm)),"step")
local integer max = GetStoredInteger(gc(),I2S(htoi(tm)),"max")
local real ox = GetUnitX(trgunit)
local real oy = GetUnitY(trgunit)
local real tx = GetUnitX(tarunit)
local real ty = GetUnitY(tarunit)
if step < max then
call SetUnitX(trgunit,ox+(tx-ox)/(I2R(max-step)))
call SetUnitY(trgunit,oy+(ty-oy)/(I2R(max-step)))
if (step < max/2+1) then
call SetUnitFlyHeight(trgunit,(1200.00/I2R(max))*I2R(step),9999.99)
else
call SetUnitFlyHeight(trgunit,(1200.00/I2R(max))*I2R(max-step),9999.99)
endif
call SetUnitLookAt( trgunit, "bone_head", tarunit, 0, 0, 90 )
set step = step + 1
call StoreInteger(gc(),I2S(htoi(tm)),"step",step)
else
call DestroyEffect( AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", tx, ty) )
call UnitDamagePoint( trgunit, 0, 150.00, tx, ty, 100.00*I2R(GetUnitAbilityLevel(trgunit,'A000')), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
// call SetPlayerAbilityAvailable(trgunit,'Amrf',true)
call UnitRemoveAbility( trgunit, 'Abun' )
call UnitRemoveAbility( trgunit, 'Amrf' )
call SetUnitInvulnerable( trgunit, false )
call ResetUnitLookAt(trgunit)
set trgunit = null
set tarunit = null
call FlushStoredMission(gc(),I2S(htoi(tm)))
call DestroyTimer(tm)
endif
endfunction
function Trig_jump_Actions takes nothing returns nothing
local timer tm
local real ox
local real oy
local real tx
local real ty
local unit trgunit
local unit tarunit
local location tarloc
set trgunit = GetTriggerUnit()
set ox = GetUnitX(trgunit)
set oy = GetUnitY(trgunit)
if GetSpellAbilityId()=='A000' then
set tm = CreateTimer()
if GetUnitAbilityLevel(trgunit,'Amrf')==0 then
call UnitAddAbility(trgunit,'Amrf')
call SetPlayerAbilityAvailable(GetTriggerPlayer(),'Amrf',false)
endif
if GetSpellTargetUnit()==null then
set tarloc = GetSpellTargetLoc()
set tx = GetLocationX(tarloc)
set ty = GetLocationY(tarloc)
call StoreInteger(gc(),I2S(htoi(tm)),"trgunit",htoi(trgunit))
call StoreReal(gc(),I2S(htoi(tm)),"ox",ox)
call StoreReal(gc(),I2S(htoi(tm)),"oy",oy)
call StoreReal(gc(),I2S(htoi(tm)),"tx",tx)
call StoreReal(gc(),I2S(htoi(tm)),"ty",ty)
call StoreInteger(gc(),I2S(htoi(tm)),"max",R2I((SquareRoot(Pow((tx-ox),2.00)+Pow((ty-oy),2.00))/30.00+1.00)*2.00))
call StoreInteger(gc(),I2S(htoi(tm)),"step",0)
call SetUnitInvulnerable( GetTriggerUnit(), true )
if GetUnitAbilityLevel(trgunit,'Abun')==0 then
call UnitAddAbility(trgunit,'Abun')
endif
call TimerStart(tm,0.01,TRUE,function jump_move_i)
else
set tarunit = GetSpellTargetUnit()
set tx = GetUnitX(tarunit)
set ty = GetUnitY(tarunit)
call StoreInteger(gc(),I2S(htoi(tm)),"trgunit",htoi(trgunit))
call StoreInteger(gc(),I2S(htoi(tm)),"tarunit",htoi(tarunit))
call StoreInteger(gc(),I2S(htoi(tm)),"max",R2I((SquareRoot(Pow((tx-ox),2.00)+Pow((ty-oy),2.00))/30.00+1.00)*2.00))
call StoreInteger(gc(),I2S(htoi(tm)),"step",0)
call SetUnitInvulnerable( trgunit, true )
if GetUnitAbilityLevel(trgunit,'Abun')==0 then
call UnitAddAbility(trgunit,'Abun')
endif
call TimerStart(tm,0.01,TRUE,function jump_move_ii)
endif
set tm = null
call RemoveLocation(tarloc)
endif
endfunction
//===========================================================================
function InitTrig_jump takes nothing returns nothing
set gg_trg_jump = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_jump,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( gg_trg_jump, function Trig_jump_Actions )
endfunction
先试试,改天给你详细注释上去.你给个电子邮箱到我,我发邮件给你代码详解
温馨提示:答案为网友推荐,仅供参考