Raised This Month: $32 Target: $400
 8% 

Solved Precache Particle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-21-2016 , 10:04   Precache Particle
Reply With Quote #1

Please how to precache custom Particle? I use PrecacheGeneric(); but not work...
Code:
Particles: Missing 'particles/smoke_colors_blue.pcf'
Particles: Missing 'particles/unusuals_custom1.pcf'
Attempted to precache unknown particle system "explosion_smokegrenade_base_blue"!
Attempted to precache unknown particle system "explosion_child_smoke07b_base_blue"!
Attempted to precache unknown particle system "explosion_child_smoke03e_base_blue"!
Attempted to precache unknown particle system "explosion_child_smoke03d_ring_base_blue"!
Attempted to precache unknown particle system "explosion_child_distort01c_base_blue"!
Attempted to precache unknown particle system "explosion_child_smoke_bottom_base_blue"!
Attempted to precache unknown particle system "gabe"!
Attempted to precache unknown particle system "fluttershy"!
Attempted to precache unknown particle system "rd"!
Attempted to precache unknown particle system "derpy"!
But I have files on fastdl and in FTP server

Last edited by _GamerX; 11-21-2016 at 11:25.
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-21-2016 , 11:25   Re: Precache Particle
Reply With Quote #2

Solved
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 11-21-2016 , 12:40   Re: Precache Particle
Reply With Quote #3

I see the problem has been solved, but the op didn't post his solution, so I'm going to post here my solution, in case some people from the internet wanders here, hoping to find something.

Code:
stock int PrecacheParticleSystem(const char[] particleSystem) {     static int particleEffectNames = INVALID_STRING_TABLE;     if (particleEffectNames == INVALID_STRING_TABLE) {         if ((particleEffectNames = FindStringTable("ParticleEffectNames")) == INVALID_STRING_TABLE) {             return INVALID_STRING_INDEX;         }     }     int index = FindStringIndex2(particleEffectNames, particleSystem);     if (index == INVALID_STRING_INDEX) {         int numStrings = GetStringTableNumStrings(particleEffectNames);         if (numStrings >= GetStringTableMaxStrings(particleEffectNames)) {             return INVALID_STRING_INDEX;         }                 AddToStringTable(particleEffectNames, particleSystem);         index = numStrings;     }         return index; } stock int FindStringIndex2(int tableidx, const char[] str) {     char buf[1024];         int numStrings = GetStringTableNumStrings(tableidx);     for (int i=0; i < numStrings; i++) {         ReadStringTable(tableidx, i, buf, sizeof(buf));                 if (StrEqual(buf, str)) {             return i;         }     }         return INVALID_STRING_INDEX; }
Those stocks weren't made by me, but they are good enough to be shared.
__________________

Last edited by Benoist3012; 11-21-2016 at 12:40.
Benoist3012 is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-21-2016 , 12:45   Re: Precache Particle
Reply With Quote #4

I using this
PHP Code:
PrecacheGeneric("materials/smokes/smoke_colors_black.pcf"true);
PrecacheEffect("ParticleEffect");
PrecacheParticleEffect("smoke_colors_black");

stock void PrecacheEffect(const char[] sEffectName)
{
    static 
int table INVALID_STRING_TABLE;
    
    if (
table == INVALID_STRING_TABLE)
    {
        
table FindStringTable("EffectDispatch");
    }
    
bool save LockStringTables(false);
    
AddToStringTable(tablesEffectName);
    
LockStringTables(save);
}
stock void PrecacheParticleEffect(const char[] sEffectName)
{
    static 
int table INVALID_STRING_TABLE;
    
    if (
table == INVALID_STRING_TABLE)
    {
        
table FindStringTable("ParticleEffectNames");
    }
    
bool save LockStringTables(false);
    
AddToStringTable(tablesEffectName);
    
LockStringTables(save);

And working good

Last edited by _GamerX; 11-21-2016 at 12:46.
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Michael Shoe Maker
Senior Member
Join Date: Apr 2016
Old 11-21-2016 , 14:16   Re: Precache Particle
Reply With Quote #5

Quote:
Originally Posted by Benoist3012 View Post
I see the problem has been solved, but the op didn't post his solution, so I'm going to post here my solution, in case some people from the internet wanders here, hoping to find something.

Code:
stock int PrecacheParticleSystem(const char[] particleSystem) {     static int particleEffectNames = INVALID_STRING_TABLE;     if (particleEffectNames == INVALID_STRING_TABLE) {         if ((particleEffectNames = FindStringTable("ParticleEffectNames")) == INVALID_STRING_TABLE) {             return INVALID_STRING_INDEX;         }     }     int index = FindStringIndex2(particleEffectNames, particleSystem);     if (index == INVALID_STRING_INDEX) {         int numStrings = GetStringTableNumStrings(particleEffectNames);         if (numStrings >= GetStringTableMaxStrings(particleEffectNames)) {             return INVALID_STRING_INDEX;         }                 AddToStringTable(particleEffectNames, particleSystem);         index = numStrings;     }         return index; } stock int FindStringIndex2(int tableidx, const char[] str) {     char buf[1024];         int numStrings = GetStringTableNumStrings(tableidx);     for (int i=0; i < numStrings; i++) {         ReadStringTable(tableidx, i, buf, sizeof(buf));                 if (StrEqual(buf, str)) {             return i;         }     }         return INVALID_STRING_INDEX; }
Those stocks weren't made by me, but they are good enough to be shared.
Would this prevent the lag when the specific particle is first spawned?
Michael Shoe Maker is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 11-22-2016 , 00:29   Re: Precache Particle
Reply With Quote #6

Yep.
Just put this in OnMapStart, like any Precache*().

Last edited by Timocop; 11-22-2016 at 00:31.
Timocop is offline
TitanTF
Senior Member
Join Date: Mar 2016
Location: Singapore
Old 05-25-2017 , 13:01   Re: Precache Particle
Reply With Quote #7

Does this still work? I've tried both solutions posted here but both still generate the precache error in console.

I am doing the mapname_particles.txt for every map way now but it's tedious.
TitanTF is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 05-26-2017 , 04:31   Re: Precache Particle
Reply With Quote #8

Quote:
Originally Posted by TitanTF View Post
Does this still work? I've tried both solutions posted here but both still generate the precache error in console.

I am doing the mapname_particles.txt for every map way now but it's tedious.
Before saying it doesn't work, when the stock I posted is used in SF2 code that you use on your servers, mind telling us, what particles are you trying to precache? And is that particle from a custom pcf file?
__________________
Benoist3012 is offline
TitanTF
Senior Member
Join Date: Mar 2016
Location: Singapore
Old 05-26-2017 , 05:22   Re: Precache Particle
Reply With Quote #9

Quote:
Originally Posted by Benoist3012 View Post
Before saying it doesn't work, when the stock I posted is used in SF2 code that you use on your servers, mind telling us, what particles are you trying to precache? And is that particle from a custom pcf file?
I'm tryna cache respawn particles, they are a custom pcf file called respawn.pcf which is in both server and my side. I have also added the pcf file name into particles_manifest.txt under particles/

I will try your method again and see if it works
TitanTF is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 05-26-2017 , 05:35   Re: Precache Particle
Reply With Quote #10

Can't do custom particles in TF2
__________________
Pelipoika is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode