找回密码
 点一下
查看: 1335|回复: 9

如何做一个投射物可以放出去又收回来造成二段伤害呢?

[复制链接]
发表于 2015-2-1 20:47:36 | 显示全部楼层 |阅读模式
整体来说就像英雄联盟里的战争女神一样的技能,我猜想可不可以在发动技能效果时放出马甲,命令马甲向前使用冲锋技能,然后等待一段时间后再使用冲锋技能回到触发单位?
发表于 2015-2-2 21:28:32 | 显示全部楼层
你可以放一个震荡波出去,然后算好位置再一个震荡波回来

点评

你这个只能是固定距离。楼主要做只能做冲锋模拟  详情 回复 发表于 2015-2-6 20:10
那么具体该怎么做呢?我还是初学者  详情 回复 发表于 2015-2-3 22:27
回复

使用道具 举报

 楼主| 发表于 2015-2-3 22:27:47 | 显示全部楼层
Kaduo 发表于 2015-2-2 21:28
你可以放一个震荡波出去,然后算好位置再一个震荡波回来

那么具体该怎么做呢?我还是初学者
回复

使用道具 举报

发表于 2015-2-4 18:49:19 | 显示全部楼层
释放冲击波到一定距离后 安置一个马甲~~让马甲再向你的方向释放冲击波,但为了技能完美,你算好冲击波回来的时间后设置英雄暂停1秒或....。要不然你释放后就能走动,冲击波就没有回旋接收的效果了~~~!冲击波可以改为投刃车刀刃的样子。
回复

使用道具 举报

发表于 2015-2-5 22:10:47 | 显示全部楼层
个人建议LZ先去学下如何用触发模拟冲锋,LZ所说的这个无非就是来回冲锋
回复

使用道具 举报

发表于 2015-2-6 20:10:09 | 显示全部楼层
Kaduo 发表于 2015-2-2 21:28
你可以放一个震荡波出去,然后算好位置再一个震荡波回来

你这个只能是固定距离。楼主要做只能做冲锋模拟
回复

使用道具 举报

发表于 2015-2-6 20:38:14 | 显示全部楼层
本帖最后由 RoyalFlare 于 2015-2-6 20:42 编辑

1.20e GameCache+ReturnBug环境使用
1.24e的话就更换为HashTable来存储数据就好了


  1. globals
  2.     gamecache udg_Titans_Cache=null
  3. endglobals

  4. function H2I takes handle H returns integer
  5.     return H
  6.     return 0
  7. endfunction
  8. function I2U takes integer I returns unit
  9.     return I
  10.     return null
  11. endfunction
  12. function H2S takes handle H returns string
  13.     return I2S(H2I(H))
  14.     return null
  15. endfunction
  16. function FlushEx takes string MissionKey returns nothing
  17.     call FlushStoredMission(udg_Titans_Cache,MissionKey)
  18. endfunction
  19. function SaveInteger takes string MissionKey,string Key,integer Value returns nothing
  20.     call StoreInteger(udg_Titans_Cache,MissionKey,Key,Value)
  21. endfunction
  22. function SaveReal takes string MissionKey,string Key,real Value returns nothing
  23.     call StoreReal(udg_Titans_Cache,MissionKey,Key,Value)
  24. endfunction
  25. function SaveBoolean takes string MissionKey,string Key,boolean Value returns nothing
  26.     call StoreBoolean(udg_Titans_Cache,MissionKey,Key,Value)
  27. endfunction
  28. function GetInteger takes string MissionKey,string Key returns integer
  29.     return GetStoredInteger(udg_Titans_Cache,MissionKey,Key)
  30. endfunction
  31. function GetReal takes string MissionKey,string Key returns real
  32.     return GetStoredReal(udg_Titans_Cache,MissionKey,Key)
  33. endfunction
  34. function GetBoolean takes string MissionKey,string Key returns boolean
  35.     return GetStoredBoolean(udg_Titans_Cache,MissionKey,Key)
  36. endfunction

  37. function WhirlCutDamageEstimate takes nothing returns boolean
  38.     local unit Unia=I2U(GetInteger("WhirlCut","Hero"))
  39.     local unit Unib=I2U(GetInteger("WhirlCutDamageUnit","Unit"+H2S(GetFilterUnit())))
  40.     local real Damage=GetReal("WhirlCut","Damage")
  41.     local player Plaa=GetOwningPlayer(Unia)
  42.     local boolean Booa=IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false
  43.     local boolean Boob=IsUnitType(GetFilterUnit(),UNIT_TYPE_ANCIENT)==false
  44.     local boolean Booc=IsUnitType(GetFilterUnit(),UNIT_TYPE_SAPPER)==false
  45.     local boolean Bood=GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
  46.     local boolean Booe=IsUnitHidden(GetFilterUnit())==false
  47.     local boolean Boof=GetUnitAbilityLevel(GetFilterUnit(),'Avul')==0
  48.     local boolean Boog=IsUnitType(GetFilterUnit(),UNIT_TYPE_ETHEREAL)==false
  49.     local boolean Booh=IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL)==false
  50.     local boolean Booi=IsUnitAlly(GetFilterUnit(),Plaa)==false
  51.     local boolean Booj=GetFilterUnit()!=Unib
  52.     if Booa and Boob and Booc and Bood and Booe and Boof and Boog and Booh and Booi and Booj then
  53.         call UnitDamageTarget(Unia,GetFilterUnit(),Damage,true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_METAL_MEDIUM_SLICE)
  54.         call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",GetFilterUnit(),"chest"))
  55.         call SaveInteger("WhirlCutDamageUnit","Unit"+H2S(GetFilterUnit()),H2I(GetFilterUnit()))
  56.     endif
  57.     set Plaa=null
  58.     set Unia=null
  59.     set Unib=null
  60.     return false
  61. endfunction

  62. function WhirlCutRun takes nothing returns nothing
  63.     local real Distance
  64.     local real Face
  65.     local real Speed
  66.     local real Track=GetReal("WhirlCut","Track")
  67.     local unit Unia=I2U(GetInteger("WhirlCut","Unit"))
  68.     local unit Unib=I2U(GetInteger("WhirlCut","Hero"))
  69.     local boolean Return=GetBoolean("WhirlCut","Return")
  70.     local real Ax
  71.     local real Ay
  72.     local real Bx
  73.     local real By
  74.     local group Groa
  75.     local boolexpr Booa
  76.     if Return then
  77.         set Ax=GetUnitX(Unib)
  78.         set Ay=GetUnitY(Unib)
  79.         set Bx=GetUnitX(Unia)
  80.         set By=GetUnitY(Unia)
  81.         set Distance=SquareRoot(((Bx-Ax)*(Bx-Ax))+((By-Ay)*(By-Ay)))
  82.         set Face=(180/3.14159)*Atan2(Ay-By,Ax-Bx)
  83.         if Distance>=30 then
  84.             set Speed=Track/30
  85.             set Track=Track+Speed
  86.             call SetUnitX(Unia,GetUnitX(Unia)+Speed*Cos(Face*3.14159/180))
  87.             call SetUnitY(Unia,GetUnitY(Unia)+Speed*Sin(Face*3.14159/180))
  88.             set Groa=CreateGroup()
  89.             set Booa=Condition(function WhirlCutDamageEstimate)
  90.             call GroupEnumUnitsInRange(Groa,GetUnitX(Unia),GetUnitY(Unia),80,Booa)
  91.             call DestroyGroup(Groa)
  92.             call DestroyBoolExpr(Booa)
  93.             set Groa=null
  94.             set Booa=null
  95.             if Speed<15 then
  96.                 call SaveReal("WhirlCut","Track",Track)
  97.             endif
  98.         else
  99.             call RemoveUnit(Unia)
  100.             call FlushEx("WhirlCut")
  101.             call FlushEx("WhirlCutDamageUnit")
  102.             call PauseTimer(GetExpiredTimer())
  103.             call DestroyTimer(GetExpiredTimer())
  104.         endif
  105.     else
  106.         set Distance=GetReal("WhirlCut","Distance")
  107.         set Face=GetReal("WhirlCut","Face")
  108.         if Track<=Distance-30 then
  109.             set Speed=(Distance-Track)/30
  110.             set Track=Track+Speed
  111.             call SetUnitX(Unia,GetUnitX(Unia)+Speed*Cos(Face*3.14159/180))
  112.             call SetUnitY(Unia,GetUnitY(Unia)+Speed*Sin(Face*3.14159/180))
  113.             set Groa=CreateGroup()
  114.             set Booa=Condition(function WhirlCutDamageEstimate)
  115.             call GroupEnumUnitsInRange(Groa,GetUnitX(Unia),GetUnitY(Unia),80,Booa)
  116.             call DestroyGroup(Groa)
  117.             call DestroyBoolExpr(Booa)
  118.             set Groa=null
  119.             set Booa=null
  120.             call SaveReal("WhirlCut","Track",Track)
  121.         else
  122.             call SaveBoolean("WhirlCut","Return",true)
  123.             call SaveReal("WhirlCut","Track",((Distance-Track)/30)+90)
  124.             call FlushEx("WhirlCutDamageUnit")
  125.         endif
  126.     endif
  127.     set Unia=null
  128.     set Unib=null
  129. endfunction

  130. function WhirlCut takes unit Unia,real x,real y returns nothing
  131.     local real Ax=GetUnitX(Unia)
  132.     local real Ay=GetUnitY(Unia)
  133.     local real Bx=x
  134.     local real By=y
  135.     local real Face=(180/3.14159)*Atan2(By-Ay,Bx-Ax)
  136.     local real Distance=SquareRoot(((Bx-Ax)*(Bx-Ax))+((By-Ay)*(By-Ay)))
  137.     local real Damage=(GetUnitAbilityLevel(Unia,'A08I')*30)+50
  138.     local timer Tima=CreateTimer()
  139.     if Distance<(GetUnitAbilityLevel(Unia,'A08I')*100)+400 then
  140.         set Distance=(GetUnitAbilityLevel(Unia,'A08I')*100)+400
  141.     endif
  142.     call SaveReal("WhirlCut","Distance",Distance)
  143.     call SaveReal("WhirlCut","Track",0)
  144.     call SaveReal("WhirlCut","Face",Face)
  145.     call SaveReal("WhirlCut","Damage",Damage)
  146.     call SaveInteger("WhirlCut","Unit",H2I(CreateUnit(GetOwningPlayer(Unia),'u00W',Ax,Ay,Face)))
  147.     call SaveInteger("WhirlCut","Hero",H2I(Unia))
  148.     call SaveBoolean("WhirlCut","Return",false)
  149.     call TimerStart(Tima,0.01,true,function WhirlCutRun)
  150. endfunction

  151. function InitTrig_WhirlCut takes nothing returns nothing
  152. endfunction
复制代码


调用方法如下:

  1. function SpellShadowHunterEstimate takes nothing returns boolean
  2.     local location Loca
  3.     if GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT then
  4.         if GetSpellAbilityId()=='A08I' then
  5.             set Loca=GetSpellTargetLoc()
  6.             call WhirlCut(GetTriggerUnit(),GetLocationX(Loca),GetLocationY(Loca))
  7.             call RemoveLocation(Loca)
  8.             set Loca=null
  9.     else
  10.     endif
  11.     return false
  12. endfunction

  13. function SpellShadowHunter takes unit Unia returns nothing
  14.     local trigger Tria=CreateTrigger()
  15.     call TriggerRegisterUnitEvent(Tria,Unia,EVENT_UNIT_SPELL_EFFECT)
  16.     call TriggerAddCondition(Tria,Condition(function SpellShadowHunterEstimate))
  17.     set Tria=null
  18. endfunction

  19. function InitTrig_SpellShadowHunter takes nothing returns nothing
  20. endfunction
复制代码
回复

使用道具 举报

发表于 2015-2-7 12:41:06 | 显示全部楼层
蜘蛛攻击
回复

使用道具 举报

发表于 2015-2-7 12:41:10 | 显示全部楼层
蜘蛛攻击
回复

使用道具 举报

 楼主| 发表于 2015-2-9 18:24:50 | 显示全部楼层
这几天有事,刚回来看回复就看到一大堆的J,我T还是半吊子呢,让我看J......虽然大致看得懂J但也只是看得懂而已。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-20 06:22 , Processed in 0.246346 second(s), 27 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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