D.V.D
Make a wish
- Reaction score
- 73
Gentle Fist
The unit hits a target causing the target to slide and lose health. Once the unit stops, the caster fires a beam at him causing a explosion dealing AoE damage.
Thanks to Kenny! for helping me fix a mistake I made.
Read the description of the variables first. The names of the variables don't explain the values that will screw up the spell.
The unit hits a target causing the target to slide and lose health. Once the unit stops, the caster fires a beam at him causing a explosion dealing AoE damage.
Thanks to Kenny! for helping me fix a mistake I made.
Read the description of the variables first. The names of the variables don't explain the values that will screw up the spell.
JASS:
//------------------------------------------\\
// D.V.D Presents: \\
//------------------------------------------\\
// Description: The caster hits his enemy \\
// pushing him back and then shooting a \\
// beam at the target causing AoE dmg. \\
//------------------------------------------\\
// \\
// Pros: \\
// Easy To Modify \\
// Eye Candy Effects \\
// Easy To Implement \\
// \\
//------------------------------------------\\
// How To Implement: \\
// - Copy this trigger into your map \\
// - Copy the Dummy Units Into Your Map \\
// - Copy the ability into your map \\
//------------------------------------------\\
// Requires: \\
// - JassNewGenPack(Or a vJass Proccessor) \\
// - TimerUtils \\
//------------------------------------------\\
// atype1 - Modifies the attack type of the damage done while sliding
// atype2 - Modifies the attack type of the damage done after the beams dead
// dtype1 - Modifies the damage type of the damage done while sliding
// dtype2 - Modifies the damage type of the damage done after the beams dead
// AbilId - The rawcode for the ability
// Castrange - Cast range is the maximum range of casting this spell set in the object editor. The value of this variable must be the maximum casting range / movespeed and must be divisible. THat means NO DECIMALS.
// DummyId - The rawcode for the hit dummy
// DummyId2 - The rawcode for the laser dummy
// DummyId3 - The rawcode for the explosion dummy
// Laserarray - This determines the array size of the struct laser. The size of this struct must be atleast movespeedfull / movespeed + Castrange
// dummydist - Distance between dummy hit and caster
// laserdamage - Damage done by the explosion
// laserdmgradius - Radius of the damage explosion
// movedamage - Damage done while enemy is sliding
// movedistance - Distance targets moved for sliding
// movedistancefull - The max distance for sliding. Must be divisible by movetime
// movetime - Time before unit moves again to simulate sliding
// EffectId - Id of the slide effect
// EffectId2 - Id of the effect done after the unit is done sliding
// wtype1 - Modifies the weapon type of the damage done while sliding
// wtype2 - Modifies the weapon type of the damage done after the beams dead
//The struct varialbe unit array laser has a array size of 200. The array size must be atleast
//movespeedfull / movespeed or else the laser won't finish and the spell will be bugged.
JASS:
scope GentleFist initializer Init
globals
private constant attacktype atype1 = ATTACK_TYPE_NORMAL
private constant attacktype atype2 = ATTACK_TYPE_MAGIC
private constant damagetype dtype1 = DAMAGE_TYPE_NORMAL
private constant damagetype dtype2 = DAMAGE_TYPE_MAGIC
private constant integer AbilId = 039;AHtb039;
private constant integer Castrange = 10
private constant integer DummyId = 039;h000039;
private constant integer DummyId2 = 039;h001039;
private constant integer DummyId3 = 039;h002039;
private constant integer Laserarray = 200
private constant real dummydist = 50.00
private constant real laserdamage = 500.00
private constant real laserdmgradius = 200.00
private constant real laserdistance = 9.00
private constant real movedamage = 2.00
private constant real movedistance = 9.00
private constant real movedistancefull = 360.00
private constant real movetime = 0.02
private constant string EffectId = "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl"
private constant string EffectId2 = "Abilities\\Spells\\Orc\\EarthQuake\\EarthQuakeTarget.mdl"
private constant weapontype wtype1 = WEAPON_TYPE_WHOKNOWS
private constant weapontype wtype2 = WEAPON_TYPE_WHOKNOWS
endglobals
//-------------------\\
// DO NOT EDIT BELOW \\
//-------------------\\
globals
private unit Explosion
endglobals
private struct data
integer count
real distance
real x
real y
unit caster
unit array laser [Laserarray]
unit target
method onDestroy takes nothing returns nothing
set .caster = null
set .target = null
endmethod
endstruct
private function Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == AbilId )
endfunction
private function Laser takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = GetTimerData(t)
local real angle = GetUnitFacing(d.caster)
local real x = GetUnitX(d.caster) + d.distance * Cos(angle * bj_DEGTORAD)
local real y = GetUnitY(d.caster) + d.distance * Sin(angle * bj_DEGTORAD)
set d.laser[d.count] = CreateUnit( GetOwningPlayer(d.caster), DummyId2, x, y, angle )
call PauseUnit( d.laser[d.count], true )
call SetUnitTimeScale( d.laser[d.count], 0.00 )
set d.count = d.count + 1
set d.distance = d.distance + laserdistance
if ( d.count == movedistancefull / movedistance + Castrange ) then
set d.count = 0
loop
exitwhen d.count > movedistancefull / movedistance + 100.00
call SetUnitTimeScale( d.laser[d.count], 100.00 )
call SetUnitAnimation( d.laser[d.count], "death" )
call KillUnit(d.laser[d.count])
set d.count = d.count + 1
endloop
set Explosion = CreateUnit( GetOwningPlayer(d.caster), DummyId3, x, y, angle )
call UnitApplyTimedLife( Explosion, 039;BTLF039;, 1.00 )
call UnitDamagePoint( d.caster, 0.00, laserdmgradius, x, y, laserdamage, true, false, atype2, dtype2, wtype2 )
call ReleaseTimer(t)
call d.destroy()
endif
endfunction
private function Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local data d = GetTimerData(t)
local real angle = GetUnitFacing(d.caster)
local real x = GetUnitX(d.target) + movedistance * Cos(angle * bj_DEGTORAD)
local real y = GetUnitY(d.target) + movedistance * Sin(angle * bj_DEGTORAD)
call DestroyEffect( AddSpecialEffect( EffectId, x, y ) )
call SetUnitPosition( d.target, x, y )
call UnitDamageTarget( d.caster, d.target, movedamage, true, false, atype1, dtype1, wtype1 )
set d.count = d.count + 1
if ( d.count == movedistancefull / movedistance ) then
call SetUnitAnimation( d.target, "death" )
call DestroyEffect( AddSpecialEffect( EffectId2, x, y ) )
set d.count = 1
set d.distance = 9.00
set d.x = x
set d.y = y
call PauseTimer(t)
call TimerStart( t, 0.02, true, function Laser )
set t = null
endif
endfunction
private function Actions takes nothing returns nothing
local data d = data.create()
local real face = GetUnitFacing(d.caster) + 50.00
local real x
local real y
local timer t = NewTimer()
local unit dummy
set d.count = 0
set d.caster = GetTriggerUnit()
set d.target = GetSpellTargetUnit()
set x = GetUnitX(d.caster) + dummydist * Cos(face * bj_DEGTORAD)
set y = GetUnitY(d.caster) + dummydist * Sin(face * bj_DEGTORAD)
call SetTimerData( t, d )
set dummy = CreateUnit(GetOwningPlayer(d.caster),DummyId,x,y,face)
call PauseUnit(dummy, true)
call UnitApplyTimedLife( dummy, 039;BTLF039;, 0.30 )
call TimerStart( t, movetime, true, function Move )
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 Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope