Warcraft 3 documentation
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

Chidori v1.2 No New Posts Warcraft III Spells and Systems

Started by
Guest

0 Members and 1 Guest are viewing this topic.

Rating

Average Score - 4 / 5

« Created: February 02, 2018, 10:09:51 PM by moyack »

Chidori v1.2
on: September 04, 2013, 08:25:19 AM
Categories: Target Object, JASS
Rating: 4
Warcraft III Spell resource
« Created: February 02, 2018, 10:09:43 PM by moyack »

A lightning spell based from the Naruto anime, one of a character technique named Kakashi. Highly configurable!

  • Description
    Kakashi start creating a blade of lightning which can cut anything. Once finish, he move and strike the targeted unit and deals big damage. Kakashi will also drag the target back. Deals 50 bonus damage if the target collide with obstacles.
  • Levels
    Level 1 - Casting for 2 seconds, 100 strike damage, 100 dragging damage.
    Level 2 - Casting for 1.5 seconds, 150 strike damage, 125 dragging damage.
    Level 3 - Casting for 1 seconds, 200 strike damage, 150 dragging damage.
  • Code
Code: jass
  1. //===========================================================================
  2. //=**************************************************************************
  3. //=*
  4. //=*  Chidori by Ofel
  5. //=*  v1.2
  6. //=*
  7. //=*  Credits:
  8. //=*   + PurgeandFire
  9. //=*   + Gwapogi
  10. //=*   + Jad
  11. //=*   + bowser499
  12. //=*
  13. //=*  Requirement:
  14. //=*   + Check Walkability system
  15. //=*
  16. //=**************************************************************************
  17. //===========================================================================
  18.  
  19. //***************************************************************************
  20. //***************************************************************************
  21. //**
  22. //**  CONFIGURATION
  23. //**
  24. //***************************************************************************
  25. //***************************************************************************
  26.  
  27. //***************************************************************************
  28. //*
  29. //*  Determines the ability raw code. Press Ctrl + D to show the raw code in
  30. //*  Object Editor
  31. //*
  32. //***************************************************************************
  33. constant function C_AbilityId takes nothing returns integer
  34.     return 'A000'
  35. endfunction
  36. //***************************************************************************
  37. //*
  38. //*  Determines the base order id of the ability mentioned above. This is
  39. //*  used to check if the caster is still channeling the ability
  40. //*
  41. //***************************************************************************
  42. constant function C_OrderId takes nothing returns integer
  43.     return OrderId("absorb")
  44. endfunction
  45. //***************************************************************************
  46. //*
  47. //*  Determines the animation by index when the caster is 'concentrating'.
  48. //*  If you change the caster model, you may need to test the animation
  49. //*  again until you found the correct one
  50. //*
  51. //***************************************************************************
  52. constant function C_ConcentrateAnimationIndex takes nothing returns integer
  53.     return 11
  54. endfunction
  55. //***************************************************************************
  56. //*
  57. //*  Determines the animation by index when the caster is 'moving'
  58. //*
  59. //***************************************************************************
  60. constant function C_RunAnimationIndex takes nothing returns integer
  61.     return 2
  62. endfunction
  63. //***************************************************************************
  64. //*
  65. //*  Determines the animation by index when the caster is going to swing his
  66. //*  hand when about to strike the target
  67. //*
  68. //***************************************************************************
  69. constant function C_SwingAnimationIndex takes nothing returns integer
  70.     return 13
  71. endfunction
  72. //***************************************************************************
  73. //*
  74. //*  Determines the minimum distance where the caster will start swinging
  75. //*  his hand to strike the target
  76. //*
  77. //***************************************************************************
  78. constant function C_SwingDistance takes nothing returns real
  79.     return 400.00
  80. endfunction
  81. //***************************************************************************
  82. //*
  83. //*  Determines the percent of animation speed when the caster is swinging
  84. //*
  85. //***************************************************************************
  86. constant function C_SwingAnimationSpeed takes nothing returns real
  87.     return 200.00
  88. endfunction
  89. //***************************************************************************
  90. //*
  91. //*  Determines the period time of the spell to 'update' things related to
  92. //*  the spell. Include moving the caster, spawning effects, counting timer,
  93. //*  damaging target, etc
  94. //*
  95. //***************************************************************************
  96. constant function C_Interval takes nothing returns real
  97.     return 0.03125
  98. endfunction
  99. //***************************************************************************
  100. //*
  101. //*  Determines the initial move speed of the caster after finish
  102. //*  'concentrating'
  103. //*
  104. //***************************************************************************
  105. constant function C_InitialSpeed takes nothing returns real
  106.     return 1.00
  107. endfunction
  108. //***************************************************************************
  109. //*
  110. //*  Determines the move speed acceleration of the caster when moving toward
  111. //*  the target
  112. //*
  113. //***************************************************************************
  114. constant function C_SpeedAcceleration takes nothing returns real
  115.     return 2.00
  116. endfunction
  117. //***************************************************************************
  118. //*
  119. //*  Determines the maximum speed of the caster when moving toward target
  120. //*
  121. //***************************************************************************
  122. constant function C_MaxSpeed takes nothing returns real
  123.     return 40.00
  124. endfunction
  125. //***************************************************************************
  126. //*
  127. //*  Determines the minimum distance where the caster is considered as
  128. //*  'has strike' the target
  129. //*
  130. //***************************************************************************
  131. constant function C_MinDistance takes nothing returns real
  132.     return 150.00
  133. endfunction
  134. //***************************************************************************
  135. //*
  136. //*  Determines the how long the target will dying after the strike
  137. //*
  138. //***************************************************************************
  139. constant function C_DyingDuration takes nothing returns real
  140.     return 10.00
  141. endfunction
  142. //***************************************************************************
  143. //*
  144. //*  Determines the effect attached on the caster
  145. //*
  146. //***************************************************************************
  147. constant function C_HandSFXModel takes nothing returns string
  148.     return "war3mapImported\\ZapMissile.mdx"
  149. endfunction
  150. //***************************************************************************
  151. //*
  152. //*  Determines the attachment point for the effect above
  153. //*
  154. //***************************************************************************
  155. constant function C_HandSFXAttachment takes nothing returns string
  156.     return "hand right"
  157. endfunction
  158. //***************************************************************************
  159. //*
  160. //*  Determines the effect attached on the caster. Different than the first
  161. //*  one, this effect spawns periodicly
  162. //*
  163. //***************************************************************************
  164. constant function C_LoopingSFXModel takes nothing returns string
  165.     return "Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl"
  166. endfunction
  167. //***************************************************************************
  168. //*
  169. //*  Determines the attachment point for the effect above
  170. //*
  171. //***************************************************************************
  172. constant function C_LoopingSFXAttachment takes nothing returns string
  173.     return "hand right"
  174. endfunction
  175. //***************************************************************************
  176. //*
  177. //*  Determines the spawn interval of the effect above
  178. //*
  179. //***************************************************************************
  180. constant function C_LoopingSFXInterval takes nothing returns real
  181.     return 0.09
  182. endfunction
  183. //***************************************************************************
  184. //*
  185. //*  Determines the strike effect
  186. //*
  187. //***************************************************************************
  188. constant function C_StrikeSFXModel takes nothing returns string
  189.     return "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
  190. endfunction
  191. //***************************************************************************
  192. //*
  193. //*  Determines the attachment point for the effect above
  194. //*
  195. //***************************************************************************
  196. constant function C_StrikeSFXAttachment takes nothing returns string
  197.     return "origin"
  198. endfunction
  199. //***************************************************************************
  200. //*
  201. //*  Determines the dying effect attached on the target that spawns
  202. //*  periodicly
  203. //*
  204. //***************************************************************************
  205. constant function C_DyingSFXModel takes nothing returns string
  206.     return "Objects\\Spawnmodels\\Other\\HumanBloodCinematicEffect\\HumanBloodCinematicEffect.mdl"
  207. endfunction
  208. //***************************************************************************
  209. //*
  210. //*  Determines the attachment point for the effect above
  211. //*
  212. //***************************************************************************
  213. constant function C_DyingSFXAttachment takes nothing returns string
  214.     return "chest"
  215. endfunction
  216. //***************************************************************************
  217. //*
  218. //*  Determines the attack-type
  219. //*
  220. //***************************************************************************
  221. constant function C_AttackType takes nothing returns attacktype
  222.     return ATTACK_TYPE_PIERCE
  223. endfunction
  224. //***************************************************************************
  225. //*
  226. //*  Determines the damage-type
  227. //*
  228. //***************************************************************************
  229. constant function C_DamageType takes nothing returns damagetype
  230. endfunction
  231. //***************************************************************************
  232. //*
  233. //*  Determines how long the caster will need to 'concentrate'
  234. //*
  235. //***************************************************************************
  236. function C_ConcentrateDuration takes real level returns real
  237.     return 2.50 - (level * 0.50)
  238. endfunction
  239. //***************************************************************************
  240. //*
  241. //*  Determines the strike damage
  242. //*
  243. //***************************************************************************
  244. function C_StrikeDamage takes real level returns real
  245.     return level * 100.00 + 100.00
  246. endfunction
  247. //***************************************************************************
  248. //*
  249. //*  Determines the total damage dealt to the target
  250. //*
  251. //***************************************************************************
  252. function C_DyingTotalDamage takes real level returns real
  253.     return level * 50.00 + 150.00
  254. endfunction
  255. //***************************************************************************
  256. //***************************************************************************
  257. //**
  258. //**  END OF CONFIGURATION
  259. //**
  260. //***************************************************************************
  261. //***************************************************************************
  262.  
  263. function C_Periodic takes nothing returns nothing
  264.     local real x
  265.     local real y
  266.     local real x2
  267.     local real y2
  268.     local real angle
  269.     local real dist
  270.     local integer index = 1
  271.     loop
  272.         exitwhen index > udg_C_MaxIndex
  273.         if (udg_C_Stage[index] == 1) then
  274.             if (not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD) and udg_C_RealTimer[index] > 0) then
  275.                 set udg_C_RealTimer2[index] = udg_C_RealTimer2[index] - C_Interval()
  276.                 if (udg_C_RealTimer2[index] <= 0) then
  277.                     call DestroyEffect(AddSpecialEffectTarget(C_DyingSFXModel(), udg_C_Target[index], C_DyingSFXAttachment()))
  278.                     set udg_C_RealTimer2[index] = 1
  279.                 endif
  280.                 call UnitDamageTarget(udg_C_Caster[index], udg_C_Target[index], udg_C_DamagePerSecond[udg_C_Level[index]], true, false, C_AttackType(), C_DamageType(), null)
  281.                 set udg_C_RealTimer[index] = udg_C_RealTimer[index] - C_Interval()
  282.             else
  283.                 set udg_C_Stage[index] = 4
  284.             endif
  285.         elseif (udg_C_Stage[index] == 2) then
  286.             if (not IsUnitType(udg_C_Caster[index], UNIT_TYPE_DEAD) and not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  287.                 if (GetUnitCurrentOrder(udg_C_Caster[index]) == C_OrderId()) then
  288.                     set x = GetUnitX(udg_C_Caster[index])
  289.                     set y = GetUnitY(udg_C_Caster[index])
  290.                     set x2 = GetUnitX(udg_C_Target[index]) - x
  291.                     set y2 = GetUnitY(udg_C_Target[index]) - y
  292.                     set dist = x2 * x2 + y2 * y2
  293.                     if (dist > udg_C_Saver[1]) then
  294.                         if (udg_C_Swinged[index] == false) then
  295.                             if (dist <= udg_C_Saver[2]) then
  296.                                 call SetUnitAnimationByIndex(udg_C_Caster[index], C_SwingAnimationIndex())
  297.                                 call SetUnitTimeScalePercent(udg_C_Caster[index], C_SwingAnimationSpeed())
  298.                                 set udg_C_Swinged[index] = true
  299.                             else
  300.                                 call SetUnitAnimationByIndex(udg_C_Caster[index], C_RunAnimationIndex())
  301.                             endif
  302.                         endif
  303.                         set angle = Atan2(y2, x2)
  304.                         set x = x + udg_C_Speed[index] * Cos(angle)
  305.                         set y = y + udg_C_Speed[index] * Sin(angle)
  306.                         set udg_CP_Point = Location(x, y)
  307.                         call TriggerExecute(gg_trg_Check_Walkability)
  308.                         if (udg_CP_PointIsWalkable == true) then
  309.                             call SetUnitX(udg_C_Caster[index], x)
  310.                             call SetUnitY(udg_C_Caster[index], y)
  311.                             call SetUnitFacing(udg_C_Caster[index], angle * bj_RADTODEG)
  312.                             if (udg_C_Speed[index] < C_MaxSpeed()) then
  313.                                 set udg_C_Speed[index] = udg_C_Speed[index] + C_SpeedAcceleration()
  314.                             else
  315.                                 set udg_C_Speed[index] = C_MaxSpeed()
  316.                             endif
  317.                         else
  318.                             call DestroyEffect(udg_C_Model[index])
  319.                             call IssueImmediateOrder(udg_C_Caster[index], "stop")
  320.                             set udg_C_Stage[index] = 4
  321.                         endif
  322.                     else
  323.                         call DestroyEffect(AddSpecialEffectTarget(C_StrikeSFXModel(), udg_C_Target[index], C_StrikeSFXAttachment()))
  324.                         call UnitDamageTarget(udg_C_Caster[index], udg_C_Target[index], C_StrikeDamage(udg_C_Level[index]), true, false, C_AttackType(), C_DamageType(), null)
  325.                         call DestroyEffect(udg_C_Model[index])
  326.                         call SetUnitTimeScalePercent(udg_C_Caster[index], 100)
  327.                         call IssueImmediateOrder(udg_C_Caster[index], "stop")
  328.                         if (not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  329.                             set udg_C_RealTimer[index] = C_DyingDuration()
  330.                             set udg_C_RealTimer2[index] = 0
  331.                             set udg_C_Stage[index] = 1
  332.                         else
  333.                             set udg_C_Stage[index] = 4
  334.                         endif
  335.                     endif
  336.                 else
  337.                     call DestroyEffect(udg_C_Model[index])
  338.                     set udg_C_Stage[index] = 4
  339.                 endif
  340.             else
  341.                 call DestroyEffect(udg_C_Model[index])
  342.                 call IssueImmediateOrder(udg_C_Caster[index], "stop")
  343.                 set udg_C_Stage[index] = 4
  344.             endif
  345.         elseif (udg_C_Stage[index] == 3) then
  346.             if (not IsUnitType(udg_C_Caster[index], UNIT_TYPE_DEAD) and not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  347.                 set x = GetUnitX(udg_C_Caster[index])
  348.                 set y = GetUnitY(udg_C_Caster[index])
  349.                 if (GetUnitCurrentOrder(udg_C_Caster[index]) == C_OrderId() and x == udg_C_CasterX[index] and y == udg_C_CasterY[index]) then
  350.                     if (udg_C_RealTimer[index] > 0) then
  351.                         set udg_C_RealTimer2[index] = udg_C_RealTimer2[index] - C_Interval()
  352.                         if (udg_C_RealTimer2[index] <= 0) then
  353.                             call DestroyEffect(AddSpecialEffectTarget(C_LoopingSFXModel(), udg_C_Caster[index], C_LoopingSFXAttachment()))
  354.                             set udg_C_RealTimer2[index] = C_LoopingSFXInterval()
  355.                         endif
  356.                         set udg_C_RealTimer[index] = udg_C_RealTimer[index] - C_Interval()
  357.                     else
  358.                         set udg_C_Speed[index] = C_InitialSpeed()
  359.                         set udg_C_Swinged[index] = false
  360.                         set udg_C_Stage[index] = 2
  361.                     endif
  362.                 else
  363.                     call DestroyEffect(udg_C_Model[index])
  364.                     set udg_C_Stage[index] = 4
  365.                 endif
  366.             else
  367.                 call DestroyEffect(udg_C_Model[index])
  368.                 call IssueImmediateOrder(udg_C_Caster[index], "stop")
  369.                 set udg_C_Stage[index] = 4
  370.             endif
  371.         elseif (udg_C_Stage[index] == 4) then
  372.             set udg_C_Caster[index] = udg_C_Caster[udg_C_MaxIndex]
  373.             set udg_C_CasterX[index] = udg_C_CasterX[udg_C_MaxIndex]
  374.             set udg_C_CasterY[index] = udg_C_CasterY[udg_C_MaxIndex]
  375.             set udg_C_Level[index] = udg_C_Level[udg_C_MaxIndex]
  376.             set udg_C_Model[index] = udg_C_Model[udg_C_MaxIndex]
  377.             set udg_C_RealTimer[index] = udg_C_RealTimer[udg_C_MaxIndex]
  378.             set udg_C_RealTimer2[index] = udg_C_RealTimer2[udg_C_MaxIndex]
  379.             set udg_C_Speed[index] = udg_C_Speed[udg_C_MaxIndex]
  380.             set udg_C_Stage[index] = udg_C_Stage[udg_C_MaxIndex]
  381.             set udg_C_Swinged[index] = udg_C_Swinged[udg_C_MaxIndex]
  382.             set udg_C_Target[index] = udg_C_Target[udg_C_MaxIndex]
  383.             set index = index - 1
  384.             set udg_C_MaxIndex = udg_C_MaxIndex - 1
  385.             if (udg_C_MaxIndex == 0) then
  386.                 call PauseTimer(udg_C_Timer)
  387.             endif
  388.         endif
  389.         set index = index + 1
  390.     endloop
  391. endfunction
  392.  
  393. function C_Cast takes nothing returns boolean
  394.     local integer index
  395.     if (GetSpellAbilityId() == C_AbilityId()) then
  396.         set udg_C_Caster[0] = GetTriggerUnit()
  397.         if (udg_C_MaxIndex == 0) then
  398.             call TimerStart(udg_C_Timer, C_Interval(), true, function C_Periodic)
  399.         else
  400.             set index = 1
  401.             loop
  402.                 exitwhen index > udg_C_MaxIndex
  403.                 if (udg_C_Caster[index] == udg_C_Caster[0] and udg_C_Stage[index] != 1) then
  404.                     call DestroyEffect(udg_C_Model[index])
  405.                     set udg_C_Stage[index] = 4
  406.                 endif
  407.                 set index = index + 1
  408.             endloop
  409.         endif
  410.         set udg_C_MaxIndex = udg_C_MaxIndex + 1
  411.         set udg_C_Caster[udg_C_MaxIndex] = udg_C_Caster[0]
  412.         set udg_C_Target[udg_C_MaxIndex] = GetSpellTargetUnit()
  413.         set udg_C_Level[udg_C_MaxIndex] = GetUnitAbilityLevel(udg_C_Caster[udg_C_MaxIndex], C_AbilityId())
  414.         set udg_C_CasterX[udg_C_MaxIndex] = GetUnitX(udg_C_Caster[udg_C_MaxIndex])
  415.         set udg_C_CasterY[udg_C_MaxIndex] = GetUnitY(udg_C_Caster[udg_C_MaxIndex])
  416.         set udg_C_Model[udg_C_MaxIndex] = AddSpecialEffectTarget(C_HandSFXModel(), udg_C_Caster[udg_C_MaxIndex], C_HandSFXAttachment())
  417.         set udg_C_RealTimer[udg_C_MaxIndex] = C_ConcentrateDuration(udg_C_Level[udg_C_MaxIndex])
  418.         set udg_C_RealTimer2[udg_C_MaxIndex] = 0
  419.         call SetUnitAnimationByIndex(udg_C_Caster[udg_C_MaxIndex], C_ConcentrateAnimationIndex())
  420.         set udg_C_Stage[udg_C_MaxIndex] = 3
  421.     endif
  422.     return false
  423. endfunction
  424.  
  425. //===========================================================================
  426. function InitTrig_Chidori takes nothing returns nothing
  427.     set gg_trg_Chidori = CreateTrigger()
  428.     if (udg_C_Timer == null) then
  429.         set udg_C_Timer = CreateTimer()
  430.     endif
  431.     call TriggerAddCondition(gg_trg_Chidori, Filter(function C_Cast))
  432.     set udg_C_Saver[1] = C_MinDistance() * C_MinDistance()
  433.     set udg_C_Saver[2] = C_SwingDistance() * C_SwingDistance()
  434.     set udg_C_DamagePerSecond[1] = C_DyingTotalDamage(1) * C_Interval()
  435.     set udg_C_DamagePerSecond[2] = C_DyingTotalDamage(2) * C_Interval()
  436.     set udg_C_DamagePerSecond[3] = C_DyingTotalDamage(3) * C_Interval()
  437. endfunction
  • Credits
    - Gwapogi for Kakashi model
« Last Edit: February 02, 2018, 10:09:43 PM by moyack »

Formerly known as Ofel The Editor


Chidori v1.0
Reply #1 on: September 04, 2013, 10:14:13 AM

Hi Ofel!!! and welcome to Blizzmod :)

Could you please add the code into the first post, and don't forget to use [trigger] bbcode. (it's not complete by the moment, but I'm working in it)



Chidori v1.0
Reply #2 on: September 05, 2013, 04:47:10 AM

yeah, ofel
oh btw, you get an idea from DivineLight huh  :P
his Chidori Spell  :P

Edit: it's not lightning blade (raikiri) it's One Thousand Birds (chidori)
just realize it ftw
« Last Edit: September 05, 2013, 05:14:26 AM by Rheiko »



Chidori v1.0
Reply #3 on: September 06, 2013, 04:05:33 AM

Yeah, :D
I think i can use his idea cuz i gave him another spell idea too... :)

Formerly known as Ofel The Editor


Chidori v1.0
Reply #4 on: September 06, 2013, 05:14:01 AM

dude, where's the triggers ??  :-\



Chidori v1.0
Reply #5 on: September 12, 2013, 07:01:24 PM

dude, where's the triggers ??  :-\
Yeahh!!! where are the triggers??


Chidori v1.1
Reply #6 on: September 26, 2013, 01:09:29 AM

Updated!

Formerly known as Ofel The Editor


Chidori v1.1
Reply #7 on: September 26, 2013, 07:34:16 AM

Ok, accomplished with the conditions, then approved :)

Please rate this resource :D


 

* Random Spells & Systems

Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...