Не пропадает particle

  • Автор темы Автор темы GOD
  • Дата начала Дата начала

GOD

Пользователь
7 Янв 2019
51
2
Проект
Reborn in progress
Lua:
function modifier_Kolpak:OnCreated( kv )

    if not IsServer() then return end
    
    self.owner = kv.isProvidedByAura~=1
    if not self.owner then return end
    
    self.radius = self:GetAbility():GetSpecialValueFor( "radius" )
    self.interval = self:GetAbility():GetSpecialValueFor( "damage_tick_interval" )
    self.damage = self:GetAbility():GetSpecialValueFor( "damage" )
    local duration = self:GetAbility():GetSpecialValueFor( "duration" )
    
    if IsServer() then
        self.damageTable = {
            victim = self:GetParent(),
            attacker = self:GetCaster(),
            damage = self.damage * self.interval,
            damage_type = DAMAGE_TYPE_PURE,
            ability = self,
        }
        
        self:OnIntervalThink()
        self:StartIntervalThink( self.interval )

        self:PlayEffects1( duration )
        self:PlayEffects3( duration )
        self.sound_loop = "Hero_Disruptor.StaticStorm"
        EmitSoundOn( self.sound_loop, self:GetParent() )
    end
end

function modifier_Kolpak:OnDestroy()
    if not IsServer() then return end

    if self.owner then
        StopSoundOn( self.sound_loop, self:GetParent() )
        local sound_stop = "Hero_Disruptor.StaticStorm.End"
        EmitSoundOn( sound_stop, self:GetParent() )
        UTIL_Remove( self:GetParent() )
        self:Destroy()
    end
end

function modifier_Kolpak:PlayEffects1( duration )
    local particle_cast = "particles/units/heroes/hero_riki/riki_smokebomb_smoke.vpcf"

    local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_WORLDORIGIN, self:GetParent() )
    ParticleManager:SetParticleControl( effect_cast, 0, self:GetParent():GetOrigin() )
    ParticleManager:SetParticleControl( effect_cast, 1, Vector( self.radius, self.radius, self.radius ) )
    ParticleManager:SetParticleControl( effect_cast, 2, Vector( duration, 0, 0 ) )
    ParticleManager:ReleaseParticleIndex( effect_cast )
end

function modifier_Kolpak:PlayEffects3( duration )
    local particle_cast = "particles/units/heroes/hero_brewmaster/brewmaster_cinder_brew_cast_trail_bubbles.vpcf"

    local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_WORLDORIGIN, self:GetParent() )
    ParticleManager:SetParticleControl( effect_cast, 0, self:GetParent():GetOrigin() )
    ParticleManager:SetParticleControl( effect_cast, 1, Vector( self.radius, self.radius, self.radius ) )
    ParticleManager:SetParticleControl( effect_cast, 2, Vector( duration, 0, 0 ) )
    ParticleManager:ReleaseParticleIndex( effect_cast )
end
 
Много способ перепробовал.
Про UTIL_Remove и self: Destroy писать не надо, осталось с теста, думал поможет))
 
Реклама: