- 北有云溪
-
很抱歉啊.忙活了大半天,只能做到这样了.测试了一会,大概没什么问题
以下是技能代码.
先新建一个游戏缓存类型的变量叫"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
先试试,改天给你详细注释上去.你给个电子邮箱到我,我发邮件给你代码详解
- meira
-
LS .. 还用return bug
这根本 就是一个抛物线公式嘛
任意单位发动技能效果
释放的技能 =XX
set unit[0] = 触发单位
set unit[1] = 技能释放目标
set location[1] = (unit[1]) 单位的位置
命令unit[1] 立刻移动 到 location[1] 点
播放 unit[0]的 XX动作
开启 触发 a2
a2
每 0.01 秒
set location[1] = (unit[1]) 单位的位置
local integer i = i + 1
改变设置unit[1]的高度为30*(i*(i-C))变换速率 0.00
立刻移动unit[2]到 从location[1] 开始距离 10 XX角度
清楚 location[1]
it
i = 20
then
set location[1] = (unit[1]) 单位的位置
选取location[1]为点的 X范围的所有单位 条件 匹配单位 = unit[1]的同盟 false
动作
命令unit[1]对选取单位造成XX点伤害
清楚 location[1]点
关闭当前触发
偶小学 6年级毕业 那个高级公式用不起