GetTriggerUnit-
DogEntrepreneur
- Reaction score
- 129
Rupture
Made by Blitz.
Idea by Icefrog .
Made by Blitz.
Idea by Icefrog .
[*]vJass
[*]Mui
[*]Leakless
[*]Lagless
Requires
Description:
Deals a mighty blow to the enemy causing any movement to result in bleeding and loss of life.
Level 1 - 150 initial damage and 20% of the distance in damage.
Level 2 - 250 initial damage and 40% of the distance in damage.
Level 3 - 350 initial damage and 60% of the distance in damage.
Screenshot
Code
The code is not that big, 100 lines of code.
- NewGen
- TimerUtils Blue
- TimerUtils v1.23 no 'b'
Description:
Deals a mighty blow to the enemy causing any movement to result in bleeding and loss of life.
Level 1 - 150 initial damage and 20% of the distance in damage.
Level 2 - 250 initial damage and 40% of the distance in damage.
Level 3 - 350 initial damage and 60% of the distance in damage.
Screenshot
Code
The code is not that big, 100 lines of code.
JASS:
//TESH.scrollpos=57
//TESH.alwaysfold=0
scope Rupture initializer Init
globals
private constant integer SPELL_ID = 039;A000039; //Id of the Spell.
private constant integer DUMMY_ID = 039;buff039; //Id of the dummy unit.
private constant integer BUFFER_ID = 039;A001039; //Id of the spell that gives the buff.
private constant string BLOOD_EFFECT = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
//What the blood look-like.
private constant attacktype AT = ATTACK_TYPE_HERO //Attack type of the damage.
private constant damagetype DT = DAMAGE_TYPE_UNIVERSAL //Damage type of the damage.
private constant weapontype WT = WEAPON_TYPE_WHOKNOWS //Weapon type.
private constant integer ADJUST = 30 //Modify the damage dealed when the units move.
private constant real HAPPENNING = 0.02 //Periodic event, if you want.
private constant real PERCENT = 20 //Base percent of bonus per level.
private constant real INITIALDMG_V1 = 100.00 //Base dmg, whatever is the ability level.
private constant real INITIALDMG_V2 = 50.00 //Add this value to base dmg per level.
private constant integer INITIAL_COUNT = 100 //Base, the MULTI_COUNT will be added and multiplied to this.
private constant integer MULTI_COUNT = 150 //Multiplied by level and added to INITIAL_COUNT.
endglobals
//=======================================================================================
//===============DO NOT TOUCH BELOW UNLESS YOU KNOW WHAT YOU DO!!=====================
//=======================================================================================
private struct data
unit caster
unit target
timer tim
integer execs
integer maxcounts
real cx
real cy
real nx
real ny
real percent
endstruct
private function Cond takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
private function Period takes nothing returns nothing
local data d = GetTimerData(GetExpiredTimer())
local real dx
local real dy
local real value
local real dmg
set d.execs = d.execs + 1
set d.nx = GetUnitX(d.target)
set d.ny = GetUnitY(d.target)
set dx = d.cx - d.nx
set dy = d.cy - d.ny
set value = SquareRoot(dx * dx + dy * dy)
if value > 0.00 then
set dmg = value / d.percent
call UnitDamageTarget(d.caster, d.target, dmg, true, false, AT, DT, WT)
call DestroyEffect(AddSpecialEffect(BLOOD_EFFECT, d.nx, d.ny))
endif
set d.cx = GetUnitX(d.target)
set d.cy = GetUnitY(d.target)
if d.execs == d.maxcounts then
call ReleaseTimer(GetExpiredTimer())
endif
endfunction
private function Act takes nothing returns nothing
local data d = data.create()
local real damage = INITIALDMG_V1 * I2R(GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID)) + INITIALDMG_V2
local real x = GetUnitX(GetSpellTargetUnit())
local real y = GetUnitY(GetSpellTargetUnit())
local real count = PERCENT * I2R(GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID))
local unit u
set d.caster = GetTriggerUnit()
set d.target = GetSpellTargetUnit()
set d.execs = 0
set d.maxcounts = INITIAL_COUNT * GetUnitAbilityLevel(d.caster, SPELL_ID) + MULTI_COUNT
set d.cx = x
set d.cy = y
set d.percent = (100.00 - count) / I2R(ADJUST)
call UnitDamageTarget(d.caster, d.target, damage, true, false, AT, DT, WT)
call DestroyEffect(AddSpecialEffect(BLOOD_EFFECT, x, y))
set d.tim = NewTimer()
call TimerStart(d.tim, HAPPENNING, true, function Period)
call SetTimerData(d.tim, d)
set u = CreateUnit(GetOwningPlayer(d.caster), DUMMY_ID, d.cx, d.cy, 0.00)
call UnitAddAbility(u, BUFFER_ID)
call SetUnitAbilityLevel(u, BUFFER_ID, GetUnitAbilityLevel(d.caster, SPELL_ID))
call IssueTargetOrder(u, "purge", d.target)
call UnitApplyTimedLife(u, 039;BTLF039;, 1.00)
set u = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Cond))
call TriggerAddAction(t, function Act)
endfunction
endscope
TestMap
There's unit that contsantly spawn, you have to rupt them, they keep running and they die!!