Добавлен rsfghd,
опубликован
простой спелл, летит фигня, дамажит, оглушает, отбрасывает, ничего сложного, очередное говнище
код
library SpellAnimLib requires StunSystemLib
globals
private constant group TempGroup = CreateGroup( )
private constant real TimerPeriodic = 0.03125
private constant location LFZ = Location( 0.00, 0.00 )
private item TempItem = null
endglobals
private function GetLocZ takes real x, real y returns real
call MoveLocation( LFZ, x, y )
return GetLocationZ( LFZ )
endfunction
private struct SpellS
unit caster
unit dummy
unit dummy1
player owningPlayer
real startx
real starty
real startz
real midx
real midy
real midz
real endx
real endy
real endz
real time
real timeMax
boolean b
endstruct
private struct MoveS
unit target
real angle
real anglex
real angley
real speed
real speedStart
real time
real timeMax
endstruct
private function Return takes nothing returns nothing
local timer t = GetExpiredTimer( )
local integer i = GetHandleId( t )
call PauseUnit( LoadUnitHandle( H, i, 0 ), false )
call DestroyEffect( LoadEffectHandle( H, i, 1 ) )
call DestroyEffect( LoadEffectHandle( H, i, 2 ) )
call FlushChildHashtable( H, i )
call DestroyTimer( t )
set t = null
endfunction
private function SetAnim takes nothing returns nothing
local timer t = GetExpiredTimer( )
local unit u = LoadUnitHandle( H, GetHandleId( t ), 0 )
call PauseUnit( u, true )
call SetUnitAnimation( u, "spell" )
call QueueUnitAnimation( u, "stand" )
call TimerStart( t, 1.00, false, function Return )
set t = null
set u = null
endfunction
private function StunMove takes nothing returns nothing
local MoveS A = LoadInteger( H, GetHandleId( GetExpiredTimer( ) ), 0 )
local real x = GetUnitX( A.target ) + A.speed * A.anglex
local real y = GetUnitY( A.target ) + A.speed * A.angley
local real x1
local real y1
//(тек. сила-(нач. сила/макс. время движения*период таймера))
call SetItemPosition( TempItem, x, y )
call SetItemVisible( TempItem, false )
set x1 = GetItemX( TempItem )
set y1 = GetItemY( TempItem )
set A.speed = A.speed - A.speedStart / A.timeMax * 0.01
set A.time = A.time + 0.01
if A.time > A.timeMax or ( x1 - 1.00 > x or x1 + 1.00 < x ) or ( y1 - 1.00 > y or y1 + 1.00 < y ) then
call PauseTimer( GetExpiredTimer( ) )
call FlushChildHashtable( H, GetHandleId( GetExpiredTimer( ) ) )
call DestroyTimer( GetExpiredTimer( ) )
set A.target = null
call A.destroy( )
else
call SetUnitX( A.target, x )
call SetUnitY( A.target, y )
endif
endfunction
private function move takes nothing returns nothing
local SpellS A = LoadInteger( H, GetHandleId( GetExpiredTimer( ) ), 0 )
local MoveS A1
local real x = A.startx + ( ( 2.00 * ( A.midx - A.startx ) ) + ( A.startx - 2.00 * A.midx + A.endx ) * A.time ) * A.time
local real y = A.starty + ( ( 2.00 * ( A.midy - A.starty ) ) + ( A.starty - 2.00 * A.midy + A.endy ) * A.time ) * A.time
local real z = A.startz + ( ( 2.00 * ( A.midz - A.startz ) ) + ( A.startz - 2.00 * A.midz + A.endz ) * A.time ) * A.time
local unit u
local timer t
set z = z - GetLocZ( x, y )
call SetUnitX( A.dummy, x )
call SetUnitY( A.dummy, y )
call SetUnitFlyHeight( A.dummy, z, 0.00 )
call SetUnitX( A.dummy1, x )
call SetUnitY( A.dummy1, y )
call SetUnitFlyHeight( A.dummy1, z, 0.00 )
set A.time = A.time + TimerPeriodic / A.timeMax
if A.b and A.time >= 0.70 then
set A.b = false
set bj_lastCreatedUnit = CreateUnit( A.owningPlayer, 'u008', A.endx, A.endy, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( bj_lastCreatedUnit, false )
call UnitAddAbility( bj_lastCreatedUnit, 'Arav' )
call SetUnitX( bj_lastCreatedUnit, A.endx )
call SetUnitY( bj_lastCreatedUnit, A.endy )
call SetUnitFlyHeight( bj_lastCreatedUnit, A.endz - GetLocZ( A.endx, A.endy ), 0.00 )
call KillUnit( bj_lastCreatedUnit )
endif
if A.time > 1.00 + TimerPeriodic then
call PauseTimer( GetExpiredTimer( ) )
call FlushChildHashtable( H, GetHandleId( GetExpiredTimer( ) ) )
call DestroyTimer( GetExpiredTimer( ) )
call GroupEnumUnitsInRange( TempGroup, A.endx, A.endy, 225.00, null )
loop
set u = FirstOfGroup( TempGroup )
exitwhen u == null
call GroupRemoveUnit( TempGroup, u )
if UnitAlive( u ) and IsUnitEnemy( u, A.owningPlayer ) then
call UnitDamageTarget( A.caster, u, 100.00, false, false, null, null, null )
call StunUnit( u, 0.50 )
set x = GetUnitX( u )
set y = GetUnitY( u )
set t = CreateTimer( )
set A1 = MoveS.create( )
set A1.target = u
set A1.angle = Atan2( y - A.endy, x - A.endx )
set A1.anglex = Cos( A1.angle )
set A1.angley = Sin( A1.angle )
set A1.speed = 2.00 * ( 1.00 - SquareRoot( ( x - A.endx ) * ( x - A.endx ) + ( y - A.endy ) * ( y - A.endy ) ) / 225.00 ) + 1.00
set A1.speedStart = A1.speed
set A1.time = 0.00
set A1.timeMax = 0.50
call SaveInteger( H, GetHandleId( t ), 0, A1 )
call TimerStart( t, 0.01, true, function StunMove )
set t = null
endif
endloop
set bj_lastCreatedUnit = CreateUnit( A.owningPlayer, 'u004', A.endx, A.endy, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( bj_lastCreatedUnit, false )
call UnitAddAbility( bj_lastCreatedUnit, 'Arav' )
call SetUnitX( bj_lastCreatedUnit, A.endx )
call SetUnitY( bj_lastCreatedUnit, A.endy )
call SetUnitFlyHeight( bj_lastCreatedUnit, A.endz - GetLocZ( A.endx, A.endy ), 0.00 )
call KillUnit( bj_lastCreatedUnit )
set bj_lastCreatedUnit = CreateUnit( A.owningPlayer, 'u005', A.endx, A.endy, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( bj_lastCreatedUnit, false )
call UnitAddAbility( bj_lastCreatedUnit, 'Arav' )
call SetUnitX( bj_lastCreatedUnit, A.endx )
call SetUnitY( bj_lastCreatedUnit, A.endy )
call SetUnitFlyHeight( bj_lastCreatedUnit, A.endz - GetLocZ( A.endx, A.endy ), 0.00 )
call KillUnit( bj_lastCreatedUnit )
set bj_lastCreatedUnit = CreateUnit( A.owningPlayer, 'u006', A.endx, A.endy, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( bj_lastCreatedUnit, false )
call UnitAddAbility( bj_lastCreatedUnit, 'Arav' )
call SetUnitX( bj_lastCreatedUnit, A.endx )
call SetUnitY( bj_lastCreatedUnit, A.endy )
call SetUnitFlyHeight( bj_lastCreatedUnit, A.endz - GetLocZ( A.endx, A.endy ) + 50.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
set bj_lastCreatedUnit = CreateUnit( A.owningPlayer, 'u007', A.endx, A.endy, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( bj_lastCreatedUnit, false )
call UnitAddAbility( bj_lastCreatedUnit, 'Arav' )
call SetUnitX( bj_lastCreatedUnit, A.endx )
call SetUnitY( bj_lastCreatedUnit, A.endy )
call SetUnitFlyHeight( bj_lastCreatedUnit, A.endz - GetLocZ( A.endx, A.endy ), 0.00 )
call KillUnit( bj_lastCreatedUnit )
call KillUnit( A.dummy )
call KillUnit( A.dummy1 )
set A.caster = null
set A.dummy = null
set A.dummy1 = null
call A.destroy( )
endif
endfunction
function Trig_SpellAnim_Actions takes nothing returns nothing
local timer t = CreateTimer( )
local SpellS A = SpellS.create( )
local SpellS A1 = SpellS.create( )
local real a
local real d
set A.caster = GetTriggerUnit( )
set A.owningPlayer = GetOwningPlayer( A.caster )
set A.startx = GetUnitX( A.caster )
set A.starty = GetUnitY( A.caster )
set A.startz = GetLocZ( A.startx, A.starty ) + GetUnitFlyHeight( A.caster )
set A.endx = GetSpellTargetX( )
set A.endy = GetSpellTargetY( )
set A.endz = GetLocZ( A.endx, A.endy )
set a = Atan2( A.endy - A.starty, A.endx - A.startx )
set d = SquareRoot( ( A.startx - A.endx ) * ( A.startx - A.endx ) + ( A.starty - A.endy ) * ( A.starty - A.endy ) )
if d < 800.00 then
set d = 800.00
endif
set A.midx = A.startx - d * Cos( a - 30.00 * bj_DEGTORAD )
set A.midy = A.starty - d * Sin( a - 30.00 * bj_DEGTORAD )
set A.midz = A.startz + 500.00
set A.b = true
set A.time = 0.00
set A.timeMax = 1.15
set A.dummy = CreateUnit( A.owningPlayer, 'u002', A.startx, A.starty, GetRandomReal( 0.00, 360.00 ) )
set A.dummy1 = CreateUnit( A.owningPlayer, 'u003', A.startx, A.starty, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( A.dummy, false )
call UnitAddAbility( A.dummy, 'Arav' )
call SetUnitX( A.dummy, A.startx )
call SetUnitY( A.dummy, A.starty )
call SetUnitFlyHeight( A.dummy, A.startz - GetLocZ( A.startx, A.starty ), 0.00 )
call SetUnitPathing( A.dummy1, false )
call UnitAddAbility( A.dummy1, 'Arav' )
call SetUnitX( A.dummy1, A.startx )
call SetUnitY( A.dummy1, A.starty )
call SetUnitFlyHeight( A.dummy1, A.startz - GetLocZ( A.startx, A.starty ), 0.00 )
call SaveInteger( H, GetHandleId( t ), 0, A )
call TimerStart( t, TimerPeriodic, true, function move )
//=======
set t = CreateTimer( )
set A1.caster = A.caster
set A1.owningPlayer = A.owningPlayer
set A1.startx = A.startx
set A1.starty = A.starty
set A1.startz = A.startz
set A1.endx = A.endx
set A1.endy = A.endy
set A1.endz = A.endz
set A1.midx = A1.startx - d * Cos( a + 30.00 * bj_DEGTORAD )
set A1.midy = A1.starty - d * Sin( a + 30.00 * bj_DEGTORAD )
set A1.midz = A1.startz + 500.00
set A1.b = true
set A1.time = 0.00
set A1.timeMax = 1.15
set A1.dummy = CreateUnit( A1.owningPlayer, 'u002', A1.startx, A1.starty, GetRandomReal( 0.00, 360.00 ) )
set A1.dummy1 = CreateUnit( A1.owningPlayer, 'u003', A1.startx, A1.starty, GetRandomReal( 0.00, 360.00 ) )
call SetUnitPathing( A1.dummy, false )
call UnitAddAbility( A1.dummy, 'Arav' )
call SetUnitX( A1.dummy, A1.startx )
call SetUnitY( A1.dummy, A1.starty )
call SetUnitFlyHeight( A1.dummy, A1.startz - GetLocZ( A1.startx, A1.starty ), 0.00 )
call SetUnitPathing( A1.dummy1, false )
call UnitAddAbility( A1.dummy1, 'Arav' )
call SetUnitX( A1.dummy1, A1.startx )
call SetUnitY( A1.dummy1, A1.starty )
call SetUnitFlyHeight( A1.dummy1, A1.startz - GetLocZ( A1.startx, A1.starty ), 0.00 )
call SaveInteger( H, GetHandleId( t ), 0, A1 )
call TimerStart( t, TimerPeriodic, true, function move )
set t = CreateTimer( )
call SaveUnitHandle( H, GetHandleId( t ), 0, A.caster )
call SaveEffectHandle( H, GetHandleId( t ), 1, AddSpecialEffectTarget( "Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnMissile.mdl", A.caster, "left hand" ) )
call SaveEffectHandle( H, GetHandleId( t ), 2, AddSpecialEffectTarget( "Abilities\\Weapons\\LavaSpawnMissile\\LavaSpawnMissile.mdl", A.caster, "right hand" ) )
call TimerStart( t, 0.00, false, function SetAnim )
set t = null
endfunction
//===========================================================================
function Trig_SpellAnim_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function InitTrig_SpellAnim takes nothing returns nothing
set gg_trg_SpellAnim = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SpellAnim, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_SpellAnim, Condition( function Trig_SpellAnim_Conditions ) )
call TriggerAddAction( gg_trg_SpellAnim, function Trig_SpellAnim_Actions )
set TempItem = CreateItem( 'spsh', 0.00, 0.00 )
call SetItemVisible( TempItem, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u002', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u003', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u004', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u005', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u006', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u007', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
set bj_lastCreatedUnit = CreateUnit( Player( PLAYER_NEUTRAL_PASSIVE ), 'u008', 0.00, 0.00, 0.00 )
call KillUnit( bj_lastCreatedUnit )
call ShowUnit( bj_lastCreatedUnit, false )
endfunction
endlibrary
upd упс, заметил говно на видео что после взрыва тот маленький дымок резко пропадает, некрасиво-некрасиво, после такого можно себе и голову отрубить, пойду займусь этим прямо сейчас
`
ОЖИДАНИЕ РЕКЛАМЫ...
3
biridius
1 год назад
3
Очень круто. Красиво как отвечает траектория снарядов анимации мага.
Чтобы оставить комментарий, пожалуйста, войдите на сайт.