2902 Posts in 433 Topics - by 2150 Members - Latest Member: wtvr

Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: Death Carrier  (Read 5751 times)

Rating
Average Score
« Created: June 27, 2016, 12:18:57 PM by moyack »

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 981
  • WC3 Models: 6
  • WC3 Tutorials: 11
  • WC3 Tools: 10
  • WC3 Maps: 11
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 5
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
Death Carrier
« on: June 19, 2013, 09:01:21 AM »
Categories: Target Ground, vJASS
Rating: 5
Image/screenshot:
Warcraft III spell resource
« Created: June 26, 2017, 08:37:06 AM by moyack »

Related Topics or Resources



by
Death Carrier
By moyack. 2009.


 
Requires: Check related topics

Description:
 
A deadly mark moves randomly over the enemies in an area of effect, jumping 5 times over them before exploding and dealing damage to the nearest enemies to the explosion.
 
Level 1 - The explosion deals 100 damage.
Level 2 - The explosion deals 170 damage.
Level 3 - The explosion deals 240 damage.
 

How to install:

  • Open the test map.
  • Add TimerUtils to your map if you haven't it installed. (Could it be possible??).
  • Copy the trigger, the ability and the effect used in this spell into you map.
  • Voila!! spell installed.

Code: jass  [Select]
  1. // Death Carrier (hmm probably the name is not the best but meh...)
  2. // By moyack. 2009.
  3. // Made for the spell contest No 13 (for the bad luck maybe??)
  4.  
  5. // Requires TimerUtils.
  6.  
  7.  
  8. library DeathCarrier initializer init requires TimerUtils
  9.  
  10. // Configuration part...
  11. globals
  12. private constant integer SpellID = 'A000'
  13. private constant real dt = 0.5 //
  14. endglobals
  15.  
  16. private constant function Damage takes integer lvl returns real
  17. return 100. + 70. * (lvl - 1)
  18. endfunction
  19.  
  20. private constant function AOE takes integer lvl returns real
  21. return 500. // I left it in this way so it can be configurable to a variable area
  22. endfunction
  23.  
  24. private constant function Jumps takes integer lvl returns integer
  25. return 5 // sets the number of times the maks jumps on units before explode
  26. endfunction
  27. // end configuration part...
  28.  
  29. private function GetEnemies takes nothing returns boolean
  30. return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_groupRandomCurrentPick))
  31. endfunction
  32.  
  33. private struct data
  34. group g
  35. unit c
  36. integer counter = 0
  37.  
  38. private method onDestroy takes nothing returns nothing
  39. call GroupClear(.g)
  40. set .c = null
  41. endmethod
  42.  
  43. private static method PickRandomUnit takes nothing returns nothing
  44. set bj_groupRandomConsidered = bj_groupRandomConsidered + 1
  45. if GetWidgetLife(GetEnumUnit()) > 0.405 and GetRandomInt(1,bj_groupRandomConsidered) == 1 then
  46. set bj_groupRandomCurrentPick = GetEnumUnit()
  47. endif
  48. endmethod
  49.  
  50. private static method DealDamage takes nothing returns nothing
  51. call UnitDamageTarget(GetEnumUnit(), GetEnumUnit(), Damage(GetUnitAbilityLevel(bj_groupRandomCurrentPick, SpellID)), true, true, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
  52. call DestroyEffect(AddSpecialEffectTarget(GetAbilityEffectById(SpellID, EFFECT_TYPE_SPECIAL, 2), GetEnumUnit(), "chest"))
  53. endmethod
  54.  
  55. static method effect takes nothing returns nothing
  56. local data d = data( GetTimerData(GetExpiredTimer()) )
  57. local real x
  58. local real y
  59. set bj_groupRandomConsidered = 0
  60. set bj_groupRandomCurrentPick = null
  61. call ForGroup(d.g, function data.PickRandomUnit)
  62. if bj_groupRandomCurrentPick == null then
  63. call d.destroy()
  64. call ReleaseTimer(GetExpiredTimer())
  65. return
  66. endif
  67. call DestroyEffect(AddSpellEffectTargetById(SpellID, EFFECT_TYPE_SPECIAL, bj_groupRandomCurrentPick, "overhead"))
  68. set d.counter = d.counter + 1
  69. if d.counter > Jumps(GetUnitAbilityLevel(d.c, SpellID)) then
  70. set x = GetUnitX(bj_groupRandomCurrentPick)
  71. set y = GetUnitY(bj_groupRandomCurrentPick)
  72. call GroupClear(d.g)
  73. call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(SpellID, EFFECT_TYPE_SPECIAL, 1), x, y))
  74. set bj_groupRandomCurrentPick = d.c
  75. call GroupEnumUnitsInRange(d.g, x, y, 0.5*AOE(GetUnitAbilityLevel(d.c, SpellID)), Condition(function GetEnemies))
  76. call ForGroup(d.g, function data.DealDamage)
  77. call d.destroy()
  78. call ReleaseTimer(GetExpiredTimer())
  79. else
  80. call UnitDamageTarget(d.c, bj_groupRandomCurrentPick, GetRandomReal(0, Damage(GetUnitAbilityLevel(d.c, SpellID))), true, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
  81. endif
  82. endmethod
  83.  
  84. static method Start takes unit c, location l returns nothing
  85. local data d = data.allocate()
  86. local timer t = NewTimer()
  87. if d.g == null then
  88. set d.g = CreateGroup()
  89. endif
  90. set d.c = c
  91. set bj_groupRandomCurrentPick = c
  92. call GroupEnumUnitsInRangeOfLoc(d.g, l, AOE(GetUnitAbilityLevel(c, SpellID)), Condition(function GetEnemies))
  93. call SetTimerData(t, integer(d))
  94. call TimerStart(t, dt, true, function data.effect)
  95. set l = null
  96. set t = null
  97. endmethod
  98. endstruct
  99.  
  100. private function Conditions takes nothing returns boolean
  101. return GetSpellAbilityId() == SpellID
  102. endfunction
  103.  
  104. private function Actions takes nothing returns nothing
  105. call data.Start(GetTriggerUnit(), GetSpellTargetLoc())
  106. endfunction
  107.  
  108. //===========================================================================
  109. private function init takes nothing returns nothing
  110. local trigger t = CreateTrigger( )
  111. call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
  112. call TriggerAddCondition( t, Condition( function Conditions ) )
  113. call TriggerAddAction( t, function Actions )
  114. set t = null
  115. endfunction
  116.  
  117. endlibrary

 
Changelog:
 
(2/2/2009) Removed the timer from the struct, now it's managed via local variables.
(11/3/2009) Now every jump deals a random damage to the jumping unit.
« Last Edit: June 26, 2017, 08:40:24 AM by moyack »

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

 

Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!