请选择 进入手机版 | 继续访问电脑版

 找回密码
 点一下
查看: 1459|回复: 6

新手求助 求技能移植方法

[复制链接]
发表于 2014-10-24 23:08:27 | 显示全部楼层 |阅读模式
本帖最后由 RoyalFlare 于 2014-10-24 23:31 编辑
  1. globals
  2. trigger sB=null
  3. trigger SB=null
  4. trigger tB=null
  5. trigger TB=null
  6. unit ln=null
  7. unit Ln=null
  8. location array mn
  9. integer Mn=0
  10. texttag pn=null
  11. group Pn=null
  12. sound YO=null
  13. endglobals
  14. [list=1]
  15. [*]
  16. [*]function TY takes nothing returns boolean
  17. [*]    return(GetSpellAbilityId()=='A045')
  18. [*]endfunction
  19. [*]function uY takes nothing returns nothing
  20. [*]    set ln=GetTriggerUnit()
  21. [*]    set Ln=GetSpellTargetUnit()
  22. [*]    set mn[1]=GetUnitLoc(ln)
  23. [*]    set mn[2]=GetUnitLoc(Ln)
  24. [*]    set Mn=0
  25. [*]    call PauseUnit(ln,true)
  26. [*]    call PauseUnit(Ln,true)
  27. [*]    call SetUnitInvulnerable(ln,true)
  28. [*]    call SetUnitInvulnerable(Ln,true)
  29. [*]    call PlaySoundBJ(YO)
  30. [*]    call SetUnitAnimation(ln,"Spell Two")
  31. [*]    call CreateTextTagLocBJ("Starburst Stream !",mn[1],0,20.,100.,.0,.0,0)
  32. [*]    set pn=bj_lastCreatedTextTag
  33. [*]    call TriggerSleepAction(3.)
  34. [*]    call DestroyTextTag(pn)
  35. [*]    call DestroyTextTag(pn)
  36. [*]    call SetUnitPositionLoc(ln,Kd(mn[2],(150.+GetUnitFacing(ln)),GetUnitFacing(ln)))
  37. [*]    call RemoveLocation(mn[1])
  38. [*]    call RemoveLocation(mn[2])
  39. [*]    call EnableTrigger(SB)
  40. [*]    call TriggerSleepAction(5.5)
  41. [*]    call SetUnitTimeScalePercent(ln,250.)
  42. [*]    set Mn=1
  43. [*]    call TriggerSleepAction(1.)
  44. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h04V',GetOwningPlayer(ln),mn[1],mn[2])
  45. [*]    call UnitApplyTimedLifeBJ(3.,'BTLF',bj_lastCreatedUnit)
  46. [*]    call TriggerSleepAction(4.85)
  47. [*]    call SetUnitTimeScalePercent(ln,400.)
  48. [*]    call EnableTrigger(tB)
  49. [*]    call DisableTrigger(SB)
  50. [*]    call TriggerSleepAction(2.4)
  51. [*]    call DisableTrigger(tB)
  52. [*]    set mn[1]=GetUnitLoc(ln)
  53. [*]    set mn[2]=GetUnitLoc(Ln)
  54. [*]    call SetUnitTimeScalePercent(ln,50.)
  55. [*]    call SetUnitAnimation(ln,"Spell Three")
  56. [*]    call TriggerSleepAction(.6)
  57. [*]    call SetUnitInvulnerable(ln,false)
  58. [*]    call SetUnitInvulnerable(Ln,false)
  59. [*]    call TriggerSleepAction(.5)
  60. [*]    call CameraSetEQNoiseForPlayer(GetOwningPlayer(ln),10.)
  61. [*]    call CameraSetEQNoiseForPlayer(GetOwningPlayer(Ln),10.)
  62. [*]    call UnitDamageTargetBJ(ln,Ln,(6000.*I2R(GetUnitAbilityLevelSwapped('A045',ln))),ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
  63. [*]    call SetUnitTimeScalePercent(ln,100.)
  64. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h04Y',GetOwningPlayer(ln),mn[1],mn[2])
  65. [*]    call SetUnitTimeScalePercent(bj_lastCreatedUnit,300.)
  66. [*]    call UnitApplyTimedLifeBJ(1.5,'BTLF',bj_lastCreatedUnit)
  67. [*]    call EnableTrigger(TB)
  68. [*]    call TriggerSleepAction(2.)
  69. [*]    call DisableTrigger(TB)
  70. [*]    call CameraClearNoiseForPlayer(GetOwningPlayer(ln))
  71. [*]    call CameraClearNoiseForPlayer(GetOwningPlayer(Ln))
  72. [*]    call PauseUnit(ln,false)
  73. [*]    call PauseUnit(Ln,false)
  74. [*]    call RemoveLocation(mn[1])
  75. [*]    call RemoveLocation(mn[2])
  76. [*]endfunction
  77. [*]function wY takes nothing returns boolean
  78. [*]    return(GetRandomInt(1,$A)>=5)
  79. [*]endfunction
  80. [*]function WY takes nothing returns boolean
  81. [*]    return(Mn==1)
  82. [*]endfunction
  83. [*]function yY takes nothing returns nothing
  84. [*]    set mn[1]=GetUnitLoc(ln)
  85. [*]    set mn[2]=GetUnitLoc(Ln)
  86. [*]    set mn[3]=Kd(mn[2],AngleBetweenPoints(mn[1],mn[2]),GetUnitFacing(ln))
  87. [*]    set mn[4]=Kd(mn[2],27.,AngleBetweenPoints(mn[1],mn[2]))
  88. [*]    call SetUnitPositionLoc(ln,mn[3])
  89. [*]    call SetUnitPositionLoc(Ln,mn[4])
  90. [*]    call SetUnitFacingToFaceUnitTimed(ln,Ln,0)
  91. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h04V',GetOwningPlayer(ln),mn[1],mn[2])
  92. [*]    call UnitApplyTimedLifeBJ(2.,'BTLF',bj_lastCreatedUnit)
  93. [*]    call AddSpecialEffectLocBJ(mn[2],"IceNova.mdx")
  94. [*]    call DestroyEffect(bj_lastCreatedEffect)
  95. [*]    call SetUnitAnimation(Ln,"Death")
  96. [*]    if(wY())then
  97. [*]        call SetUnitAnimation(ln,"Attack Alternate - 4")
  98. [*]    else
  99. [*]        call SetUnitAnimation(ln,"Attack Alternate - 5")
  100. [*]    endif
  101. [*]    if(WY())then
  102. [*]        call CreateNUnitsAtLocFacingLocBJ(1,'h037',GetOwningPlayer(ln),mn[1],mn[2])
  103. [*]        call UnitApplyTimedLifeBJ(3.,'BTLF',bj_lastCreatedUnit)
  104. [*]        call SetUnitScalePercent(bj_lastCreatedUnit,'d','d','d')
  105. [*]    endif
  106. [*]    call RemoveLocation(mn[1])
  107. [*]    call RemoveLocation(mn[2])
  108. [*]    call RemoveLocation(mn[3])
  109. [*]    call RemoveLocation(mn[4])
  110. [*]endfunction
  111. [*]function zY takes nothing returns boolean
  112. [*]    return(GetRandomInt(1,$A)>=5)
  113. [*]endfunction
  114. [*]function ZY takes nothing returns boolean
  115. [*]    return(Mn==1)
  116. [*]endfunction
  117. [*]function vz takes nothing returns nothing
  118. [*]    set mn[1]=GetUnitLoc(ln)
  119. [*]    set mn[2]=GetUnitLoc(Ln)
  120. [*]    set mn[3]=Kd(mn[2],AngleBetweenPoints(mn[1],mn[2]),GetUnitFacing(ln))
  121. [*]    set mn[4]=Kd(mn[2],5.,AngleBetweenPoints(mn[1],mn[2]))
  122. [*]    call SetUnitPositionLoc(ln,mn[3])
  123. [*]    call SetUnitPositionLoc(Ln,mn[4])
  124. [*]    call SetUnitFacingToFaceUnitTimed(ln,Ln,0)
  125. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h04X',GetOwningPlayer(ln),mn[1],mn[2])
  126. [*]    call UnitApplyTimedLifeBJ(.5,'BTLF',bj_lastCreatedUnit)
  127. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h04V',GetOwningPlayer(ln),mn[1],mn[2])
  128. [*]    call UnitApplyTimedLifeBJ(2.,'BTLF',bj_lastCreatedUnit)
  129. [*]    call AddSpecialEffectLocBJ(mn[2],"IceNova.mdx")
  130. [*]    call DestroyEffect(bj_lastCreatedEffect)
  131. [*]    call SetUnitAnimation(Ln,"Death")
  132. [*]    if(zY())then
  133. [*]        call SetUnitAnimation(ln,"Attack Alternate - 4")
  134. [*]    else
  135. [*]        call SetUnitAnimation(ln,"Attack Alternate - 5")
  136. [*]    endif
  137. [*]    if(ZY())then
  138. [*]        call CreateNUnitsAtLocFacingLocBJ(1,'h037',GetOwningPlayer(ln),mn[1],mn[2])
  139. [*]        call UnitApplyTimedLifeBJ(3.,'BTLF',bj_lastCreatedUnit)
  140. [*]        call SetUnitScalePercent(bj_lastCreatedUnit,'d','d','d')
  141. [*]    endif
  142. [*]    call RemoveLocation(mn[1])
  143. [*]    call RemoveLocation(mn[2])
  144. [*]    call RemoveLocation(mn[3])
  145. [*]    call RemoveLocation(mn[4])
  146. [*]endfunction
  147. [*]function xz takes nothing returns nothing
  148. [*]    set mn[1]=GetUnitLoc(ln)
  149. [*]    set mn[2]=GetUnitLoc(Ln)
  150. [*]    set mn[3]=Kd(mn[2],23.,AngleBetweenPoints(mn[1],mn[2]))
  151. [*]    call SetUnitPositionLoc(Ln,mn[3])
  152. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h02Z',GetOwningPlayer(ln),mn[2],mn[3])
  153. [*]    call UnitApplyTimedLifeBJ(3.,'BTLF',bj_lastCreatedUnit)
  154. [*]    call CreateNUnitsAtLocFacingLocBJ(1,'h037',GetOwningPlayer(ln),mn[2],mn[3])
  155. [*]    call SetUnitScalePercent(bj_lastCreatedUnit,120.,120.,120.)
  156. [*]    call UnitApplyTimedLifeBJ(3.,'BTLF',bj_lastCreatedUnit)
  157. [*]    call AddSpecialEffectLocBJ(mn[2],"Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl")
  158. [*]    call DestroyEffect(bj_lastCreatedEffect)
  159. [*]    call RemoveLocation(mn[1])
  160. [*]    call RemoveLocation(mn[2])
  161. [*]    call RemoveLocation(mn[3])
  162. [*]endfunction
  163. [*]
  164. [/list]
  165. [list]
  166. [*]function main takes nothing returns nothing
  167. [*]set YO=CreateSound("war3mapImported\\Star bust Stream.mp3",false,false,false,$A,$A,"")
  168. [*]call SetSoundDuration(YO,$4BF8)
  169. [*]call SetSoundChannel(YO,0)
  170. [*]call SetSoundVolume(YO,$7F)
  171. [*]call SetSoundPitch(YO,1.)
  172. [*]endfunction
  173. [*]function InitCustomTeams takes nothing returns nothing
  174. [*]    set sB=CreateTrigger()
  175. [*]    call TriggerRegisterAnyUnitEventBJ(sB,EVENT_PLAYER_UNIT_SPELL_EFFECT)
  176. [*]    call TriggerAddCondition(sB,Condition(function TY))
  177. [*]    call TriggerAddAction(sB,function uY)
  178. [*]    set SB=CreateTrigger()
  179. [*]    call DisableTrigger(SB)
  180. [*]    call TriggerRegisterTimerEventPeriodic(SB,.3)
  181. [*]    call TriggerAddAction(SB,function yY)
  182. [*]    set tB=CreateTrigger()
  183. [*]    call DisableTrigger(tB)
  184. [*]    call TriggerRegisterTimerEventPeriodic(tB,.1)
  185. [*]    call TriggerAddAction(tB,function vz)
  186. [*]    set TB=CreateTrigger()
  187. [*]    call DisableTrigger(TB)
  188. [*]    call TriggerRegisterTimerEventPeriodic(TB,.04)
  189. [*]    call TriggerAddAction(TB,function xz)
  190. [*]endfunction
  191. [/list]
复制代码

助还原成正常Jass的格式 感激不尽 想学习这个技能
被地图优化器处理后的Jass代码看不懂 我移植的时候不知道如何处理global部分的变量声明 我知道应该写在function main takes nothing returns nothing的下面,但是在WE中main部分是隐藏的 在自定义代码区敲代码进去保存的时候JassHelper报错,真心求教
PS:现在的地图里做星爆气流斩都喜欢使用等待时间动作 这样的技能不支持多人释放的呢,使用Timer+数组变量记录是否会好1点?

第1次发求助帖 好♂紧♂张啊 我才不是Baka呢
 楼主| 发表于 2014-10-24 23:12:34 | 显示全部楼层

  1. globals
  2. constant integer Spellz2__SPELLID='A010'
  3. constant string Spellz2__EFFECT="war3mapImported\\slam.mdx"
  4. constant string Spellz2__EFFECT2="war3mapImported\\lightningNova.mdx"
  5. constant string Spellz2__EFFECT3="war3mapImported\\dead spirit by deckai2.mdx"
  6. constant string Spellz2__EFFECT4="war3mapImported\\effect_ReiatsuOverFlowbyDeckai.mdx"
  7. constant string Spellz2__EFFECT5="war3mapImported\\ArcaneExplosion.mdx"
  8. constant string Spellz2__EFFECT6="war3mapImported\\blueCharge3.mdx"
  9. constant integer si__Spellz2__data=50
  10. integer si__Spellz2__data_F=0
  11. integer si__Spellz2__data_I=0
  12. integer array si__Spellz2__data_V
  13. unit array s__Spellz2__data_c
  14. unit array s__Spellz2__data_t
  15. integer array s__Spellz2__data_count
  16. effect array s__Spellz2__data_e
  17. real array s__Spellz2__data_time
  18. real array s__Spellz2__data_dist
  19. endglobals
复制代码

  1. function s__Spellz2__data__allocate takes nothing returns integer
  2.     local integer this=si__Spellz2__data_F
  3.     if(this!=0)then
  4.         set si__Spellz2__data_F=si__Spellz2__data_V[this]
  5.     else
  6.         set si__Spellz2__data_I=si__Spellz2__data_I+1
  7.         set this=si__Spellz2__data_I
  8.     endif
  9.     if(this>8190)then
  10.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Unable to allocate id for an object of type: Spellz2__data")
  11.         return 0
  12.     endif
  13.     set s__Spellz2__data_count[this]=0
  14.     set s__Spellz2__data_time[this]=0.6
  15.     set si__Spellz2__data_V[this]=-1
  16.     return this
  17. endfunction
  18. function s__Spellz2__data_deallocate takes integer this returns nothing
  19.     if this==null then
  20.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Attempt to destroy a null struct of type: Spellz2__data")
  21.         return
  22.     elseif(si__Spellz2__data_V[this]!=-1)then
  23.         call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,1000.,"Double free of type: Spellz2__data")
  24.         return
  25.     endif
  26.     set si__Spellz2__data_V[this]=si__Spellz2__data_F
  27.     set si__Spellz2__data_F=this
  28. endfunction
  29. function Spellz2__Periodic takes nothing returns nothing
  30.     local timer z=GetExpiredTimer()
  31.     local unit c=LoadUnitHandle(HS,GetHandleId(z),0)
  32.     local unit t=LoadUnitHandle(HS,GetHandleId(z),1)
  33.     call SetUnitAnimation(t,"death")
  34.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(t),GetUnitY(t)))
  35.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT2,GetUnitX(t),GetUnitY(t)))
  36.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(t),GetUnitY(t)))
  37.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT5,GetUnitX(t),GetUnitY(t)))
  38.     call DestroyTimer(z)
  39.     call FlushChildHashtable(HS,GetHandleId(z))
  40.     set c=null
  41.     set t=null
  42. endfunction
  43. function Spellz2__PlayAnimation takes unit caster,unit target,integer value,real time returns nothing
  44.     local timer z=CreateTimer()
  45.     call SetUnitAnimationByIndex(caster,value)
  46.     call SoundStart("war3mapImported\\SlashKirito.mp3",GetUnitX(caster),GetUnitY(caster))
  47.     call SaveUnitHandle(HS,GetHandleId(z),0,caster)
  48.     call SaveUnitHandle(HS,GetHandleId(z),1,target)
  49.     call TimerStart(z,time,false,function Spellz2__Periodic)
  50.     set z=null
  51. endfunction
  52. function s__Spellz2__data_damage takes integer this returns real
  53.     return I2R((GetUnitAbilityLevel(s__Spellz2__data_c[this],Spellz2__SPELLID)*700)+GetHeroStr(s__Spellz2__data_c[this],true)*3)
  54. endfunction
  55. function s__Spellz2__data_destroy takes integer this returns nothing
  56.     call PauseUnit(s__Spellz2__data_c[this],false)
  57.     call PauseUnit(s__Spellz2__data_t[this],false)
  58.     call SetUnitInvulnerable(s__Spellz2__data_c[this],false)
  59.     call SetUnitInvulnerable(s__Spellz2__data_t[this],false)
  60.     call UnitDamageTarget(s__Spellz2__data_c[this],s__Spellz2__data_t[this],s__Spellz2__data_damage(this),true,true,null,DAMAGE_TYPE_DIVINE,null)
  61.     call SetUnitPathing(s__Spellz2__data_c[this],true)
  62.     call SetUnitTimeScale(s__Spellz2__data_c[this],1)
  63.     call DestroyEffect(s__Spellz2__data_e[this])
  64.     call s__Spellz2__data_deallocate(this)
  65. endfunction
  66. function s__Spellz2__data_periodic4 takes nothing returns nothing
  67.     local timer z=GetExpiredTimer()
  68.     local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  69.     local real a=Angle(GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]))
  70.     local real xx=(((GetUnitX(s__Spellz2__data_c[this]))*1.0)+((s__Spellz2__data_dist[this])*1.0)*Cos(((a)*1.0)*bj_DEGTORAD))
  71.     local real yy=(((GetUnitY(s__Spellz2__data_c[this]))*1.0)+((s__Spellz2__data_dist[this])*1.0)*Sin(((a)*1.0)*bj_DEGTORAD))
  72.     call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),a,1,'h010',0.5,255,255,255,55)
  73.     call SetUnitTimeScale(bj_lastCreatedUnit,3)
  74.     call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),a,3,'h0A1',0.5,255,255,255,255)
  75.     call SetUnitTimeScale(bj_lastCreatedUnit,3)
  76.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  77.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  78.     call SetUnitPosition(s__Spellz2__data_c[this],xx,yy)
  79.     if Distance(GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]))<=140 then
  80.         call ShakeGroupCamera(1,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),1000,12)
  81.         call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),270,1,'h00X',0.5,255,255,255,255)
  82.         call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  83.         call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT2,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  84.         call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  85.         call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT4,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  86.         call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),270,10,'h03S',2.5,255,255,255,255)
  87.         call SetUnitTimeScale(bj_lastCreatedUnit,3)
  88.         call ReleaseTimer(z)
  89.         call s__Spellz2__data_destroy(this)
  90.     endif
  91. endfunction
  92. function s__Spellz2__data_periodic3 takes nothing returns nothing
  93.     local timer z=GetExpiredTimer()
  94.     local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  95.     set s__Spellz2__data_dist[this]=Distance(GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]))/5
  96.     call SetUnitTimeScale(s__Spellz2__data_c[this],1)
  97.     call TimerStart(z,0.02,true,function s__Spellz2__data_periodic4)
  98. endfunction
  99. function s__Spellz2__data_periodic takes nothing returns nothing
  100.     local timer z=GetExpiredTimer()
  101.     local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  102.     local real a=Angle(GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]))
  103.     local real xx=(((GetUnitX(s__Spellz2__data_t[this]))*1.0)+((20)*1.0)*Cos(((a)*1.0)*bj_DEGTORAD))
  104.     local real yy=(((GetUnitY(s__Spellz2__data_t[this]))*1.0)+((20)*1.0)*Sin(((a)*1.0)*bj_DEGTORAD))
  105.     local real x
  106.     local real y
  107.     local integer int
  108.     call SetUnitFacing(s__Spellz2__data_c[this],a)
  109.     set s__Spellz2__data_time[this]=s__Spellz2__data_time[this]-0.02
  110.     if s__Spellz2__data_time[this]<=0 then
  111.         if s__Spellz2__data_count[this]==0 then
  112.             call SoundStart("war3mapImported\\KiritoWhak2.mp3",GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]))
  113.         endif
  114.         if s__Spellz2__data_count[this]==9 then
  115.             call SoundStart("war3mapImported\\KiritoWhak1.mp3",GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]))
  116.         endif
  117.         if s__Spellz2__data_count[this]==3 then
  118.             call SoundStart("war3mapImported\\KiritoFast1.mp3",GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]))
  119.         endif
  120.         if s__Spellz2__data_count[this]==14 then
  121.             call SoundStart("war3mapImported\\KiritoFast2.mp3",GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]))
  122.         endif
  123.         if s__Spellz2__data_count[this]>=4 and s__Spellz2__data_count[this]<=15 then
  124.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),1.75,'h03T',1,255,255,255,255)
  125.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),2,'h0AC',1,255,255,255,255)
  126.             call SetUnitTimeScale(bj_lastCreatedUnit,0.5)
  127.             call SetUnitFlyHeight(bj_lastCreatedUnit,100,0)
  128.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),2.5,'h03T',1,255,255,255,45)
  129.             call SetUnitFlyHeight(bj_lastCreatedUnit,100,0)
  130.             if s__Spellz2__data_count[this]==10 then
  131.                 call SetUnitTimeScale(s__Spellz2__data_c[this],1.5)
  132.             endif
  133.             set s__Spellz2__data_time[this]=0.65
  134.         elseif s__Spellz2__data_count[this]<4 then
  135.             set s__Spellz2__data_time[this]=0.5
  136.         elseif s__Spellz2__data_count[this]>12 then
  137.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),2,'h03T',1,255,255,255,255)
  138.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),2,'h0AC',1,255,255,255,255)
  139.             call SetUnitTimeScale(bj_lastCreatedUnit,1.5)
  140.             call SetUnitFlyHeight(bj_lastCreatedUnit,100,0)
  141.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),a,1.5,'h00V',1,255,255,255,255)
  142.             call SetUnitTimeScale(bj_lastCreatedUnit,1.5)
  143.             call SetUnitFlyHeight(bj_lastCreatedUnit,0,0)
  144.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),3,'h03T',1,255,255,255,45)
  145.             call SetUnitFlyHeight(bj_lastCreatedUnit,100,0)
  146.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),GetRandomReal(0,360),2,'h03U',1,255,255,255,155)
  147.             call SetUnitTimeScale(bj_lastCreatedUnit,2)
  148.             if s__Spellz2__data_count[this]==27 then
  149.                 call SetUnitTimeScale(s__Spellz2__data_c[this],2)
  150.             endif
  151.             set s__Spellz2__data_time[this]=0.35
  152.         endif
  153.         set int=GetRandomInt(12,17)
  154.         if int==12 then
  155.             set int=11
  156.         endif
  157.         if s__Spellz2__data_count[this]<29 then
  158.             call SetUnitPosition(s__Spellz2__data_t[this],xx,yy)
  159.             set x=(((GetUnitX(s__Spellz2__data_t[this]))*1.0)+((120)*1.0)*Cos(((a+180)*1.0)*bj_DEGTORAD))
  160.             set y=(((GetUnitY(s__Spellz2__data_t[this]))*1.0)+((120)*1.0)*Sin(((a+180)*1.0)*bj_DEGTORAD))
  161.             call SetUnitPosition(s__Spellz2__data_c[this],x,y)
  162.             call Spellz2__PlayAnimation(s__Spellz2__data_c[this],s__Spellz2__data_t[this],int,s__Spellz2__data_time[this])
  163.         elseif s__Spellz2__data_count[this]==29 then
  164.             set s__Spellz2__data_e[this]=AddSpecialEffectTarget(Spellz2__EFFECT6,s__Spellz2__data_c[this],"weapon")
  165.             set s__Spellz2__data_time[this]=0.7
  166.             call SetUnitTimeScale(s__Spellz2__data_c[this],1)
  167.             call SetUnitAnimation(s__Spellz2__data_c[this],"attack")
  168.         endif
  169.         if s__Spellz2__data_count[this]>=30 then
  170.             call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  171.             call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT2,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  172.             call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  173.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]),270,0.25,'h03V',0.5,255,255,255,255)
  174.             call SlideUnitAngle(s__Spellz2__data_t[this],0,0.0,a,"")
  175.             call SetUnitTimeScale(s__Spellz2__data_c[this],0.2)
  176.             call SetUnitAnimation(s__Spellz2__data_c[this],"attack")
  177.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),270,4,'h0A1',2.2,255,255,255,155)
  178.             call SetUnitTimeScale(bj_lastCreatedUnit,3)
  179.             call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),180,4,'h00Y',2.2,255,255,255,155)
  180.             call SetUnitTimeScale(bj_lastCreatedUnit,3)
  181.             call TimerStart(z,2.5,false,function s__Spellz2__data_periodic3)
  182.         endif
  183.         set s__Spellz2__data_count[this]=s__Spellz2__data_count[this]+1
  184.     endif
  185.     set z=null
  186. endfunction
  187. function s__Spellz2__data_periodic2 takes nothing returns nothing
  188.     local timer z=GetExpiredTimer()
  189.     local integer this=(LoadInteger(TimerUtils___ht,0,GetHandleId((z))))
  190.     local real a=Angle(GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this]))
  191.     local real x=(((GetUnitX(s__Spellz2__data_t[this]))*1.0)+((120)*1.0)*Cos(((a+180)*1.0)*bj_DEGTORAD))
  192.     local real y=(((GetUnitY(s__Spellz2__data_t[this]))*1.0)+((120)*1.0)*Sin(((a+180)*1.0)*bj_DEGTORAD))
  193.     call SetUnitPosition(s__Spellz2__data_c[this],x,y)
  194.     call SetUnitFacing(s__Spellz2__data_c[this],a)
  195.     call Spellz2__PlayAnimation(s__Spellz2__data_c[this],s__Spellz2__data_t[this],GetRandomInt(13,16),0.6)
  196.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  197.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT2,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  198.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(s__Spellz2__data_t[this]),GetUnitY(s__Spellz2__data_t[this])))
  199.     call TimerStart(z,0.02,true,function s__Spellz2__data_periodic)
  200.     set z=null
  201. endfunction
  202. function s__Spellz2__data_create takes unit caster,unit target returns integer
  203.     local integer this=s__Spellz2__data__allocate()
  204.     local timer z=CreateTimer()
  205.     set s__Spellz2__data_c[this]=caster
  206.     set s__Spellz2__data_t[this]=target
  207.     call PauseUnit(s__Spellz2__data_c[this],true)
  208.     call PauseUnit(s__Spellz2__data_t[this],true)
  209.     call SetUnitInvulnerable(s__Spellz2__data_c[this],true)
  210.     call SetUnitInvulnerable(s__Spellz2__data_t[this],true)
  211.     call SetUnitPathing(s__Spellz2__data_c[this],false)
  212.     call SetUnitAnimation(s__Spellz2__data_c[this],"Spell Two")
  213.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  214.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT3,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  215.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT2,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  216.     call DestroyEffect(AddSpecialEffect(Spellz2__EFFECT5,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this])))
  217.     call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),270,4,'h0A1',4.2,255,255,255,155)
  218.     call SetUnitTimeScale(bj_lastCreatedUnit,2)
  219.     call EffectUnitColor(s__Spellz2__data_c[this],GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),180,4,'h03W',4.2,255,255,255,155)
  220.     call SetUnitTimeScale(bj_lastCreatedUnit,2)
  221.     call SoundStart("war3mapImported\\Eclipe.mp3",GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]))
  222.     call ShakeGroupCamera(21.0,GetUnitX(s__Spellz2__data_c[this]),GetUnitY(s__Spellz2__data_c[this]),800,25)
  223.     call SaveInteger(TimerUtils___ht,0,GetHandleId((z)),(this))
  224.     call TimerStart(z,4.65,true,function s__Spellz2__data_periodic2)
  225.     set z=null
  226.     return this
  227. endfunction
  228. function Spellz2__Conditions takes nothing returns boolean
  229.     return GetSpellAbilityId()==Spellz2__SPELLID
  230. endfunction
  231. function Spellz2__Actions takes nothing returns nothing
  232.     local unit c=GetTriggerUnit()
  233.     local unit t=GetSpellTargetUnit()
  234.     call s__Spellz2__data_create(c,t)
  235.     set c=null
  236.     set t=null
  237. endfunction
  238. function Spellz2__init takes nothing returns nothing
  239.     local trigger t=CreateTrigger()
  240.     local integer index=0
  241.     loop
  242.         call TriggerRegisterPlayerUnitEvent(t,Player(index),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
  243.         set index=index+1
  244.         exitwhen index==bj_MAX_PLAYER_SLOTS
  245.     endloop
  246.     call TriggerAddCondition(t,Condition(function Spellz2__Conditions))
  247.     call TriggerAddAction(t,function Spellz2__Actions)
  248.     set t=null
  249. endfunction
复制代码

努力工作中 我也真是醉了 求助1个技能需要在U9 飞飞世界 GA论坛都发帖才找到1个思路
@chyj4747 话说使用VJ的私有域来注册全局变量和注册触发器事件的方法具体要怎麽个使用法? VJ处于一知半解的状态
到底是用Library还是Scope来做呢(>_<)
回复

使用道具 举报

发表于 2014-10-24 23:16:34 | 显示全部楼层
WE里新建个触发,把InitCustomTeams里面的东西覆盖到这个触发的初始化函数里,然后把WE自动分配的动作函数部分删除掉,最后把main上面的东西全部复制到这个初始化函数的上面
回复

使用道具 举报

 楼主| 发表于 2014-10-24 23:34:00 | 显示全部楼层
那麽2楼部分的代码data_allocate 是数据变量分配方式的1种,具体是什麽玩意?
回复

使用道具 举报

发表于 2014-10-26 23:16:52 | 显示全部楼层
本帖最后由 chyj4747 于 2014-10-26 23:17 编辑
RoyalFlare 发表于 2014-10-24 23:34
那麽2楼部分的代码data_allocate 是数据变量分配方式的1种,具体是什麽玩意?


初始化数组类型的全局变量
VJ我已经不太记得了,话说我回帖的时候还没有沙发的说。。

私有域不能直接注册全局变量和事件么?我印象中library和scope只是在嵌套方面有点区别,里面的函数没有区别的啊,也可能我记错了。。
回复

使用道具 举报

 楼主| 发表于 2014-10-26 23:23:59 | 显示全部楼层
scope aa initializer init
private function init takes nothing returns nothing
你把另外一个main函数里
注册触发的内容放这里
创建初始化单位物品什么的调用就不加
endfunction
endscope
然后把这个域放置在代码末端
半夜重看了次帖子 发现刚才写错了
原帖地址:http://home.feifeishijie.com/for ... read&tid=376607
回复

使用道具 举报

 楼主| 发表于 2014-10-26 23:24:39 | 显示全部楼层
本帖最后由 RoyalFlare 于 2014-10-26 23:27 编辑

欢迎楼主来飞飞世界玩 感觉飞飞现在的新人水平太差了=_,=(貌似和这个没有关系吧)
我自己做的2个技能 欢迎点评 话说要支持多人还是得用数组变量区别开来呢
http://home.feifeishijie.com/thread-376744-1-1.html
http://home.feifeishijie.com/thread-376881-1-1.html
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-16 19:44 , Processed in 0.306272 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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