Draganizer
Member
- Reaction score
- 1
Hello im looking at this jass spell and i was wondering... How do you change the damage of this spell? I dont know jass so i would like to know how to change the damage. Someone please help and thx in advance!
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! zinc
library DyMotionMain
{
constant integer FPS = 30;
public constant integer dm_DUMMY_ID = 039;Wizx039;;
public constant integer dm_UNTOUCHABLE = 039;Aloc039;;
public constant integer dm_FLYING = 039;Amrf039;;
public constant integer dm_TREE_DETECTION = 039;Aeat039;;
public constant real dm_UPDATE_INTERVAL = 1.0 / FPS;
public constant real dm_Pi = 3.1415926535897932384626433832795;
public constant real dm_2Pi = 2 * dm_Pi;
public constant real dm_PiOVER2 = dm_Pi / 2;
public constant real dm_3OVER2Pi = 3 / 2 * dm_Pi;
public function GetDistance( real x1, real y1, real x2, real y2 ) -> real
{ real dx = x2 - x1, dy = y2 - y1; return Pow( dx * dx + dy * dy, 0.5 ); }
}
//! endzinc
JASS:
/TESH.scrollpos=103
//TESH.alwaysfold=0
//! zinc
library DyMotionMotion requires DyMotionMain, DyMotionProjectile
{
//_______________________________________________
//***********************************************
// *****Globals*****
//-----------------------------------------------
constant real dm_DEFAULT_MAX_SPEED = 1800.;
constant real dm_DEFAULT_LIFE_TIME = 6.;
//-----------------------------------------------
// *****Globals End*****
//_______________________________________________
//***********************************************
interface MotionEvents
{ method onMotion( ) = null; }
public struct dmMotion extends MotionEvents
{
real LifeTime = dm_DEFAULT_LIFE_TIME;
static method create( real x, real y, real angle ) -> dmMotion
{
dmMotion m = dmMotion.allocate( );
dmMotion.Indexing( m );
m.msl = dmProjectile.create( x, y );
m.Angle = angle;
return m;
}
static method createWithUnit( unit u, real angle ) -> dmMotion
{
dmMotion m = dmMotion.allocate( );
dmMotion.Indexing( m );
m.msl = dmProjectile.createWithUnit( u );
m.Angle = angle;
return m;
}
/*_____________________________________________
***********************************************
*****Operators*****
---------------------------------------------*/
method operator Angle ( ) -> real
{ return Atan2( spd * sin, spd * cos ); }
method operator Angle= ( real value )
{ cos = Cos( value ); sin = Sin( value ); msl.XYangle = value; }
method operator Speed ( ) -> real
{ return spd / dm_UPDATE_INTERVAL; }
method operator Speed= ( real value )
{ spd = value * dm_UPDATE_INTERVAL; }
method operator Acceleration ( ) -> real
{ return acc / dm_UPDATE_INTERVAL; }
method operator Acceleration= ( real value )
{ acc = value * dm_UPDATE_INTERVAL; }
method operator AngleSpeed ( ) -> real
{ return angspd / dm_UPDATE_INTERVAL; }
method operator AngleSpeed= ( real value )
{ angspd = value * dm_UPDATE_INTERVAL; }
method operator MaxSpeed ( ) -> real
{ return maxspd / dm_UPDATE_INTERVAL; }
method operator MaxSpeed= ( real value )
{ maxspd = value * dm_UPDATE_INTERVAL; }
method operator MinSpeed ( ) -> real
{ return minspd / dm_UPDATE_INTERVAL; }
method operator MinSpeed= ( real value )
{ minspd = value * dm_UPDATE_INTERVAL; }
/*---------------------------------------------
*****Operators End*****
_______________________________________________
**********************************************/
method SetHomingPosition( real x, real y )
{ hmX = x; hmY = y; homing = true; }
method SetHomingUnit( unit t )
{ hmUnit = t; homing = true; }
method StopHoming( )
{ hmUnit = null; homing = false; }
/*_____________________________________________
***********************************************
*****Internal Stuff*****
---------------------------------------------*/
private real maxspd = dm_DEFAULT_MAX_SPEED * dm_UPDATE_INTERVAL;
private real minspd = 0.;
private real spd = 0.; //speed
private real acc = 0.; //acceleration
private real angspd = 0.; //angle speed
private real cos = 0., sin = 0.;
private boolean homing = false; //homing flag
private unit hmUnit = null; //homing unit
private real hmX, hmY; //homing coordinates
private delegate dmProjectile msl;
private integer id;
private static timer Timer;
private static integer N = 0;
private static dmMotion M[];
private static code update;
static group tempGroup = CreateGroup( );
private static method Update( )
{
dmMotion m;
integer i;
real a;
for ( 0 <= i < dmMotion.N )
{
m = dmMotion.M<i>;
if ( m.homing )
{
if ( m.hmUnit != null )
{ m.hmX = GetUnitX( m.hmUnit ); m.hmY = GetUnitY( m.hmUnit ); }
a = Atan2( m.hmY - m.Y, m.hmX - m.X );
m.cos = Cos( a ); m.sin = Sin( a );
}
if ( m.angspd != 0.0 )
m.Angle = m.Angle + m.angspd;
m.X = m.X + m.spd * m.cos;
m.Y = m.Y + m.spd * m.sin;
if ( m.spd < m.maxspd && m.spd >= m.minspd )
m.spd += m.acc;
if ( m.onMotion.exists ) { m.onMotion( ); }
if ( m.LifeTime > 0. )
m.LifeTime -= dm_UPDATE_INTERVAL;
else
m.destroy( );
}
}
private static method Indexing( dmMotion m )
{
if ( dmMotion.N == 0 ) TimerStart( dmMotion.Timer, dm_UPDATE_INTERVAL, true, dmMotion.update );
m.id = dmMotion.N;
dmMotion.M[dmMotion.N] = m;
dmMotion.N += 1;
}
method onDestroy( )
{
msl.destroy( );
dmMotion.N -= 1;
dmMotion.M[id] = dmMotion.M[dmMotion.N];
dmMotion.M[id].id = id;
if ( dmMotion.N == 0 ) PauseTimer( dmMotion.Timer );
}
private static method onInit( )
{ dmMotion.Timer = CreateTimer( ); dmMotion.update = function dmMotion.Update; }
}
}
//! endzinc</i>
JASS:
//TESH.scrollpos=15
//TESH.alwaysfold=0
//! zinc
library DyMotionProjectile requires DyMotionMain
{
//_______________________________________________
//***********************************************
// *****Globals*****
//-----------------------------------------------
//-----------------------------------------------
// *****Globals End*****
//_______________________________________________
//***********************************************
public struct dmProjectile
{
unit object;
effect fx = null;
private boolean IsDummy = true;
static method create( real x, real y ) -> dmProjectile
{
dmProjectile msl = dmProjectile.allocate( );
msl.object = Recycle.NewDummy( );
msl.X = x;
msl.Y = y;
return msl;
}
static method createWithUnit( unit u ) -> dmProjectile
{
dmProjectile msl = dmProjectile.allocate( );
msl.object = u;
msl.IsDummy = false;
return msl;
}
method operator FXPath= ( string value )
{
if ( fx != null ) DestroyEffect( fx ); fx = null;
if ( value == "" ) fx = null;
else fx = AddSpecialEffectTarget( value, object, "origin" );
}
method operator Owner ( ) -> player
{ return GetOwningPlayer( object ); }
method operator Owner= ( player value )
{ SetUnitOwner( object, value, true ); }
method operator Size= ( real value )
{ SetUnitScale( object, value, value, value ); }
method operator X ( ) -> real
{ return GetUnitX( object ); }
method operator X= ( real value )
{ SetUnitX( object, value ); }
method operator Y ( ) -> real
{ return GetUnitY( object ); }
method operator Y= ( real value )
{ SetUnitY( object, value ); }
method operator Z ( ) -> real
{ return GetUnitFlyHeight( object ); }
method operator Z= ( real value )
{
SetUnitFlyHeight( object, value, 0.0 );
/*location tz = Location( X, Y );
if ( GetLocationZ( tz ) - value >= 0 ) SetUnitFlyHeight( object, GetLocationZ( tz ) - value, 0.0 );
else SetUnitFlyHeight( object, GetLocationZ( tz ), 0.0 );
RemoveLocation( tz );*/
}
method operator XYangle ( ) -> real
{ return GetUnitFacing( object ) * bj_DEGTORAD; }
method operator XYangle= ( real value )
{ SetUnitFacing( object, value * bj_RADTODEG ); }
method onDestroy( )
{
DestroyEffect( fx );
if ( IsDummy )
Recycle.KillDummy( object );
}
}
struct Recycle
{
private static group DeadDummies;
private static unit u;
static method NewDummy( ) -> unit
{
u = FirstOfGroup( DeadDummies );
if ( u == null )
{
u = CreateUnit( Player( 15 ), dm_DUMMY_ID, 0.0, 0.0, 0.0 );
UnitAddAbility( u, dm_UNTOUCHABLE );
UnitAddAbility( u, dm_FLYING );
UnitRemoveAbility( u, dm_FLYING );
PauseUnit( u, true );
}
else
GroupRemoveUnit( DeadDummies, u );
return u;
}
static method KillDummy( unit d )
{ GroupAddUnit( DeadDummies, d ); }
private static method onInit( )
{
integer i;
DeadDummies = CreateGroup( );
for ( 1 <= i <= 200 )
{
u = CreateUnit( Player( 15 ), dm_DUMMY_ID, 0.0, 0.0, 0.0 );
UnitAddAbility( u, dm_UNTOUCHABLE );
UnitAddAbility( u, dm_FLYING );
UnitRemoveAbility( u, dm_FLYING );
PauseUnit( u, true );
GroupAddUnit( DeadDummies, u );
}
}
}
}
//! endzinc
JASS:
//TESH.scrollpos=7
//TESH.alwaysfold=0
//! zinc
library DyMotionCollision requires DyMotionMain, DyMotionProjectile
{
//_______________________________________________
//***********************************************
// *****Globals*****
//-----------------------------------------------
constant real dm_DEFAULT_COLLISION_RADIUS = 90.;
//-----------------------------------------------
// *****Globals End*****
//_______________________________________________
//***********************************************
public struct dmCollision
{
player Owner = Player( 15 );
real Radius = dm_DEFAULT_COLLISION_RADIUS; //the collision radius
boolean Alive = true;
boolean HeroesOnly = false;
method operator EnemiesOnly= ( boolean value )
{ enemiesOnly = value; alliesOnly = false; }
method operator AlliesOnly= ( boolean value )
{ alliesOnly = value; enemiesOnly = false; }
private boolean enemiesOnly = true;
private boolean alliesOnly = false;
method CheckCollisions( real X, real Y ) -> boolean
{
p = Owner;
c = this;
GroupEnumUnitsInRange( g, X, Y, Radius, function( ) -> boolean
{
unit f = GetFilterUnit( );
return IsUnitEnemy( f, p ) == c.enemiesOnly && IsUnitAlly( f, p ) == c.alliesOnly && ( GetWidgetLife( f ) > 0.405 ) == c.Alive;
} );
b = false;
if ( FirstOfGroup( g ) != null )
b = true;
GroupClear( g );
p = null;
c = 0;
/*f1.destroy( );
f2.destroy( );
f3.destroy( );*/
return b;
}
private static group g = CreateGroup( );
private static group g2 = CreateGroup( );
private static unit u;
private static player p;
private static dmCollision c;
private static boolean b;
}
}
//! endzinc
JASS:
//TESH.scrollpos=116
//TESH.alwaysfold=0
//! zinc
library Beam requires DyMotionMain, DyMotionMotion, DyMotionCollision
{
constant integer SPELL_ID = 039;A000039;;
constant string MISSILE_FX = "Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl";
constant string EXPLOSION_FX1 = "DirtExplosion.mdl";
constant string EXPLOSION_FX2 = "EMPBomb.mdl";
constant string EXPLOSION_FX3 = "Fireworksblue.mdl";
constant string EXPLOSION_FX4 = "FreezingRing.mdl";
constant string EXPLOSION_FX5 = "PlasmaGrenade.mdl";
constant string EXPLOSION_FX6 = "Shiva039;sWrath.mdl";
constant string TRAIL_FX = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl";
constant real MISSILE_SPEED = 1100.; //speed per second
constant real MISSILE_DEVIATION = 22.5; //deviation of the secondary missiles
constant real MISSILE_MAX_DISTANCE = 1800.;
constant real EXPLOSION_RADIUS = 400.;
constant integer EYECANDY_PROJECTILE_NUMBER = 8;
constant real EYECANDY_PROJECTILE_SPEED = 800.;
constant real EYECANDY_PROJECTILE_ANGLE_SPEED = dm_2Pi * 2.;
constant string EYECANDY_PROJECTILE_FX = "Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl";
function ExplosionDamage( integer lvl ) -> real
{ return 80. + 100. * lvl; }
function Actions( )
{
unit c = GetTriggerUnit( );
player p = GetOwningPlayer( c );
integer lvl = GetUnitAbilityLevel( c, SPELL_ID );
integer i;
real cx = GetUnitX( c ), cy = GetUnitY( c );
real a = Atan2( GetSpellTargetY( ) - cy, GetSpellTargetX( ) - cx );
real a2 = 360. / EYECANDY_PROJECTILE_NUMBER * bj_DEGTORAD;
real a3 = 0.;
Beam bm;
dmMotion m;
for ( 1 <= i <= EYECANDY_PROJECTILE_NUMBER )
{
a3 = a2 * i;
m = dmMotion.create( cx, cy, a3 );
m.FXPath = EYECANDY_PROJECTILE_FX;
m.Speed = EYECANDY_PROJECTILE_SPEED;
m.AngleSpeed = EYECANDY_PROJECTILE_ANGLE_SPEED;
m.Size = .3;
m.LifeTime = 1.2;
}
DestroyEffect( AddSpecialEffect( EXPLOSION_FX6, cx, cy ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX6, cx, cy ) );
bm = Beam.create( cx, cy, a );
bm.FXPath = MISSILE_FX;
bm.Speed = MISSILE_SPEED;
bm.Z = 60.;
bm.Size = 1.8;
bm.Caster = c;
bm.Damage = ExplosionDamage( lvl );
bm.collider.Owner = p;
bm = Beam.create( cx, cy, a );
bm.FXPath = MISSILE_FX;
bm.Speed = MISSILE_SPEED;
bm.AngleSpeed = MISSILE_DEVIATION * bj_DEGTORAD;
bm.Z = 60.;
bm.Size = 1.4;
bm.Caster = c;
bm.Damage = ExplosionDamage( lvl );
bm.collider.Owner = p;
bm = Beam.create( cx, cy, a );
bm.FXPath = MISSILE_FX;
bm.Speed = MISSILE_SPEED;
bm.AngleSpeed = -MISSILE_DEVIATION * bj_DEGTORAD;
bm.Z = 60.;
bm.Size = 1.4;
bm.Caster = c;
bm.Damage = ExplosionDamage( lvl );
bm.collider.Owner = p;
c = null; p = null;
}
struct Beam extends dmMotion
{
dmCollision collider = dmCollision.create( );
unit Caster = null;
real Damage = 0.;
private real maxdis = 0.;
method onMotion( )
{
DestroyEffect( AddSpecialEffect( TRAIL_FX, X, Y ) );
maxdis += Speed * dm_UPDATE_INTERVAL;
if ( !IsTerrainWalkable( X, Y, 10. ) || collider.CheckCollisions( X, Y ) || maxdis >= MISSILE_MAX_DISTANCE )
destroy( );
}
method onDestroy( )
{
DestroyEffect( AddSpecialEffect( EXPLOSION_FX1, X, Y ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX2, X, Y ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX3, X, Y ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX4, X, Y ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX5, X, Y ) );
DestroyEffect( AddSpecialEffect( EXPLOSION_FX6, X, Y ) );
p = GetOwningPlayer( Caster );
GroupEnumUnitsInRange( tempGroup, X, Y, EXPLOSION_RADIUS, function( ) -> boolean {
u = GetFilterUnit( );
return GetUnitTypeId( u ) != dm_DUMMY_ID && GetWidgetLife( u ) >= 0.405 && IsUnitEnemy( u, p ); } );
u = FirstOfGroup( tempGroup );
while ( u != null )
{
UnitDamageTarget( Caster, u, Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null );
GroupRemoveUnit( tempGroup, u );
u = FirstOfGroup( tempGroup );
}
u = null;
p = null;
}
private static unit u;
private static player p;
}
function onInit( )
{
trigger t = CreateTrigger( );
integer i;
for ( 0 <= i < bj_MAX_PLAYER_SLOTS ) TriggerRegisterPlayerUnitEvent( t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null );
TriggerAddCondition( t, function( ) -> boolean { return GetSpellAbilityId( ) == SPELL_ID; } );
TriggerAddAction( t, function Actions );
PreloadEnd( 0.5 );
Preload( MISSILE_FX );
Preload( EXPLOSION_FX1 );
Preload( EXPLOSION_FX2 );
Preload( EXPLOSION_FX3 );
Preload( EXPLOSION_FX4 );
Preload( EXPLOSION_FX5 );
Preload( EXPLOSION_FX6 );
Preload( TRAIL_FX );
Preload( EYECANDY_PROJECTILE_FX );
t = null;
}
}
//! endzinc