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

* Random Spells & Systems

Compressed Tavern v1.4

Views: 8760
Replies: 4
Posted by radamantus
June 27, 2013, 02:55:54 PM

Death Carrier

Views: 7815
Replies: 0
Posted by moyack
June 19, 2013, 09:01:21 AM

Bags System

Views: 660
Replies: 0
Posted by ashujon
August 21, 2011, 07:41:28 AM

Chidori v1.2

Guest · 10561

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
Image/screenshot:
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.     return DAMAGE_TYPE_LIGHTNING
  231. endfunction
  232. //***************************************************************************
  233. //*
  234. //*  Determines how long the caster will need to 'concentrate'
  235. //*
  236. //***************************************************************************
  237. function C_ConcentrateDuration takes real level returns real
  238.     return 2.50 - (level * 0.50)
  239. endfunction
  240. //***************************************************************************
  241. //*
  242. //*  Determines the strike damage
  243. //*
  244. //***************************************************************************
  245. function C_StrikeDamage takes real level returns real
  246.     return level * 100.00 + 100.00
  247. endfunction
  248. //***************************************************************************
  249. //*
  250. //*  Determines the total damage dealt to the target
  251. //*
  252. //***************************************************************************
  253. function C_DyingTotalDamage takes real level returns real
  254.     return level * 50.00 + 150.00
  255. endfunction
  256. //***************************************************************************
  257. //***************************************************************************
  258. //**
  259. //**  END OF CONFIGURATION
  260. //**
  261. //***************************************************************************
  262. //***************************************************************************
  263.  
  264. function C_Periodic takes nothing returns nothing
  265.     local real x
  266.     local real y
  267.     local real x2
  268.     local real y2
  269.     local real angle
  270.     local real dist
  271.     local integer index = 1
  272.     loop
  273.         exitwhen index > udg_C_MaxIndex
  274.         if (udg_C_Stage[index] == 1) then
  275.             if (not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD) and udg_C_RealTimer[index] > 0) then
  276.                 set udg_C_RealTimer2[index] = udg_C_RealTimer2[index] - C_Interval()
  277.                 if (udg_C_RealTimer2[index] <= 0) then
  278.                     call DestroyEffect(AddSpecialEffectTarget(C_DyingSFXModel(), udg_C_Target[index], C_DyingSFXAttachment()))
  279.                     set udg_C_RealTimer2[index] = 1
  280.                 endif
  281.                 call UnitDamageTarget(udg_C_Caster[index], udg_C_Target[index], udg_C_DamagePerSecond[udg_C_Level[index]], true, false, C_AttackType(), C_DamageType(), null)
  282.                 set udg_C_RealTimer[index] = udg_C_RealTimer[index] - C_Interval()
  283.             else
  284.                 set udg_C_Stage[index] = 4
  285.             endif
  286.         elseif (udg_C_Stage[index] == 2) then
  287.             if (not IsUnitType(udg_C_Caster[index], UNIT_TYPE_DEAD) and not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  288.                 if (GetUnitCurrentOrder(udg_C_Caster[index]) == C_OrderId()) then
  289.                     set x = GetUnitX(udg_C_Caster[index])
  290.                     set y = GetUnitY(udg_C_Caster[index])
  291.                     set x2 = GetUnitX(udg_C_Target[index]) - x
  292.                     set y2 = GetUnitY(udg_C_Target[index]) - y
  293.                     set dist = x2 * x2 + y2 * y2
  294.                     if (dist > udg_C_Saver[1]) then
  295.                         if (udg_C_Swinged[index] == false) then
  296.                             if (dist <= udg_C_Saver[2]) then
  297.                                 call SetUnitAnimationByIndex(udg_C_Caster[index], C_SwingAnimationIndex())
  298.                                 call SetUnitTimeScalePercent(udg_C_Caster[index], C_SwingAnimationSpeed())
  299.                                 set udg_C_Swinged[index] = true
  300.                             else
  301.                                 call SetUnitAnimationByIndex(udg_C_Caster[index], C_RunAnimationIndex())
  302.                             endif
  303.                         endif
  304.                         set angle = Atan2(y2, x2)
  305.                         set x = x + udg_C_Speed[index] * Cos(angle)
  306.                         set y = y + udg_C_Speed[index] * Sin(angle)
  307.                         set udg_CP_Point = Location(x, y)
  308.                         call TriggerExecute(gg_trg_Check_Walkability)
  309.                         if (udg_CP_PointIsWalkable == true) then
  310.                             call SetUnitX(udg_C_Caster[index], x)
  311.                             call SetUnitY(udg_C_Caster[index], y)
  312.                             call SetUnitFacing(udg_C_Caster[index], angle * bj_RADTODEG)
  313.                             if (udg_C_Speed[index] < C_MaxSpeed()) then
  314.                                 set udg_C_Speed[index] = udg_C_Speed[index] + C_SpeedAcceleration()
  315.                             else
  316.                                 set udg_C_Speed[index] = C_MaxSpeed()
  317.                             endif
  318.                         else
  319.                             call DestroyEffect(udg_C_Model[index])
  320.                             call IssueImmediateOrder(udg_C_Caster[index], "stop")
  321.                             set udg_C_Stage[index] = 4
  322.                         endif
  323.                     else
  324.                         call DestroyEffect(AddSpecialEffectTarget(C_StrikeSFXModel(), udg_C_Target[index], C_StrikeSFXAttachment()))
  325.                         call UnitDamageTarget(udg_C_Caster[index], udg_C_Target[index], C_StrikeDamage(udg_C_Level[index]), true, false, C_AttackType(), C_DamageType(), null)
  326.                         call DestroyEffect(udg_C_Model[index])
  327.                         call SetUnitTimeScalePercent(udg_C_Caster[index], 100)
  328.                         call IssueImmediateOrder(udg_C_Caster[index], "stop")
  329.                         if (not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  330.                             set udg_C_RealTimer[index] = C_DyingDuration()
  331.                             set udg_C_RealTimer2[index] = 0
  332.                             set udg_C_Stage[index] = 1
  333.                         else
  334.                             set udg_C_Stage[index] = 4
  335.                         endif
  336.                     endif
  337.                 else
  338.                     call DestroyEffect(udg_C_Model[index])
  339.                     set udg_C_Stage[index] = 4
  340.                 endif
  341.             else
  342.                 call DestroyEffect(udg_C_Model[index])
  343.                 call IssueImmediateOrder(udg_C_Caster[index], "stop")
  344.                 set udg_C_Stage[index] = 4
  345.             endif
  346.         elseif (udg_C_Stage[index] == 3) then
  347.             if (not IsUnitType(udg_C_Caster[index], UNIT_TYPE_DEAD) and not IsUnitType(udg_C_Target[index], UNIT_TYPE_DEAD)) then
  348.                 set x = GetUnitX(udg_C_Caster[index])
  349.                 set y = GetUnitY(udg_C_Caster[index])
  350.                 if (GetUnitCurrentOrder(udg_C_Caster[index]) == C_OrderId() and x == udg_C_CasterX[index] and y == udg_C_CasterY[index]) then
  351.                     if (udg_C_RealTimer[index] > 0) then
  352.                         set udg_C_RealTimer2[index] = udg_C_RealTimer2[index] - C_Interval()
  353.                         if (udg_C_RealTimer2[index] <= 0) then
  354.                             call DestroyEffect(AddSpecialEffectTarget(C_LoopingSFXModel(), udg_C_Caster[index], C_LoopingSFXAttachment()))
  355.                             set udg_C_RealTimer2[index] = C_LoopingSFXInterval()
  356.                         endif
  357.                         set udg_C_RealTimer[index] = udg_C_RealTimer[index] - C_Interval()
  358.                     else
  359.                         set udg_C_Speed[index] = C_InitialSpeed()
  360.                         set udg_C_Swinged[index] = false
  361.                         set udg_C_Stage[index] = 2
  362.                     endif
  363.                 else
  364.                     call DestroyEffect(udg_C_Model[index])
  365.                     set udg_C_Stage[index] = 4
  366.                 endif
  367.             else
  368.                 call DestroyEffect(udg_C_Model[index])
  369.                 call IssueImmediateOrder(udg_C_Caster[index], "stop")
  370.                 set udg_C_Stage[index] = 4
  371.             endif
  372.         elseif (udg_C_Stage[index] == 4) then
  373.             set udg_C_Caster[index] = udg_C_Caster[udg_C_MaxIndex]
  374.             set udg_C_CasterX[index] = udg_C_CasterX[udg_C_MaxIndex]
  375.             set udg_C_CasterY[index] = udg_C_CasterY[udg_C_MaxIndex]
  376.             set udg_C_Level[index] = udg_C_Level[udg_C_MaxIndex]
  377.             set udg_C_Model[index] = udg_C_Model[udg_C_MaxIndex]
  378.             set udg_C_RealTimer[index] = udg_C_RealTimer[udg_C_MaxIndex]
  379.             set udg_C_RealTimer2[index] = udg_C_RealTimer2[udg_C_MaxIndex]
  380.             set udg_C_Speed[index] = udg_C_Speed[udg_C_MaxIndex]
  381.             set udg_C_Stage[index] = udg_C_Stage[udg_C_MaxIndex]
  382.             set udg_C_Swinged[index] = udg_C_Swinged[udg_C_MaxIndex]
  383.             set udg_C_Target[index] = udg_C_Target[udg_C_MaxIndex]
  384.             set index = index - 1
  385.             set udg_C_MaxIndex = udg_C_MaxIndex - 1
  386.             if (udg_C_MaxIndex == 0) then
  387.                 call PauseTimer(udg_C_Timer)
  388.             endif
  389.         endif
  390.         set index = index + 1
  391.     endloop
  392. endfunction
  393.  
  394. function C_Cast takes nothing returns boolean
  395.     local integer index
  396.     if (GetSpellAbilityId() == C_AbilityId()) then
  397.         set udg_C_Caster[0] = GetTriggerUnit()
  398.         if (udg_C_MaxIndex == 0) then
  399.             call TimerStart(udg_C_Timer, C_Interval(), true, function C_Periodic)
  400.         else
  401.             set index = 1
  402.             loop
  403.                 exitwhen index > udg_C_MaxIndex
  404.                 if (udg_C_Caster[index] == udg_C_Caster[0] and udg_C_Stage[index] != 1) then
  405.                     call DestroyEffect(udg_C_Model[index])
  406.                     set udg_C_Stage[index] = 4
  407.                 endif
  408.                 set index = index + 1
  409.             endloop
  410.         endif
  411.         set udg_C_MaxIndex = udg_C_MaxIndex + 1
  412.         set udg_C_Caster[udg_C_MaxIndex] = udg_C_Caster[0]
  413.         set udg_C_Target[udg_C_MaxIndex] = GetSpellTargetUnit()
  414.         set udg_C_Level[udg_C_MaxIndex] = GetUnitAbilityLevel(udg_C_Caster[udg_C_MaxIndex], C_AbilityId())
  415.         set udg_C_CasterX[udg_C_MaxIndex] = GetUnitX(udg_C_Caster[udg_C_MaxIndex])
  416.         set udg_C_CasterY[udg_C_MaxIndex] = GetUnitY(udg_C_Caster[udg_C_MaxIndex])
  417.         set udg_C_Model[udg_C_MaxIndex] = AddSpecialEffectTarget(C_HandSFXModel(), udg_C_Caster[udg_C_MaxIndex], C_HandSFXAttachment())
  418.         set udg_C_RealTimer[udg_C_MaxIndex] = C_ConcentrateDuration(udg_C_Level[udg_C_MaxIndex])
  419.         set udg_C_RealTimer2[udg_C_MaxIndex] = 0
  420.         call SetUnitAnimationByIndex(udg_C_Caster[udg_C_MaxIndex], C_ConcentrateAnimationIndex())
  421.         set udg_C_Stage[udg_C_MaxIndex] = 3
  422.     endif
  423.     return false
  424. endfunction
  425.  
  426. //===========================================================================
  427. function InitTrig_Chidori takes nothing returns nothing
  428.     set gg_trg_Chidori = CreateTrigger()
  429.     if (udg_C_Timer == null) then
  430.         set udg_C_Timer = CreateTimer()
  431.     endif
  432.     call TriggerRegisterAnyUnitEventBJ(gg_trg_Chidori, EVENT_PLAYER_UNIT_SPELL_EFFECT)
  433.     call TriggerAddCondition(gg_trg_Chidori, Filter(function C_Cast))
  434.     set udg_C_Saver[1] = C_MinDistance() * C_MinDistance()
  435.     set udg_C_Saver[2] = C_SwingDistance() * C_SwingDistance()
  436.     set udg_C_DamagePerSecond[1] = C_DyingTotalDamage(1) * C_Interval()
  437.     set udg_C_DamagePerSecond[2] = C_DyingTotalDamage(2) * C_Interval()
  438.     set udg_C_DamagePerSecond[3] = C_DyingTotalDamage(3) * C_Interval()
  439. 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


 

Power of Corruption - A Warcraft III altered melee map   Chaos Realm - The world of Game modders and wc3 addicts     WC3JASS.com - The JASS Vault   Jetcraft - A Starcraft II mod