Raised This Month: $51 Target: $400
 12% 

Custom particle systems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 11-02-2015 , 06:05   Custom particle systems
Reply With Quote #1

I am completely lost in this. I've searched around but found nothing which would work for me.

Does anyone know whether it's possible to precache the particle system and having clients download it? Or the other way around? :p
Phil25 is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 11-02-2015 , 08:46   Re: Custom particle systems
Reply With Quote #2

I was browsing SMLIB and found the following:
PHP Code:
/*
 * Precaches the given particle system.
 * It's best to call this OnMapStart().
 * Code based on Rochellecrab's, thanks.
 * 
 * @param particleSystem    Name of the particle system to precache.
 * @return                    Returns the particle system index, INVALID_STRING_INDEX on error.
 */
stock PrecacheParticleSystem(const String:particleSystem[])
{
    static 
particleEffectNames INVALID_STRING_TABLE;

    if (
particleEffectNames == INVALID_STRING_TABLE) {
        if ((
particleEffectNames FindStringTable("ParticleEffectNames")) == INVALID_STRING_TABLE) {
            return 
INVALID_STRING_INDEX;
        }
    }

    new 
index FindStringIndex2(particleEffectNamesparticleSystem);
    if (
index == INVALID_STRING_INDEX) {
        new 
numStrings GetStringTableNumStrings(particleEffectNames);
        if (
numStrings >= GetStringTableMaxStrings(particleEffectNames)) {
            return 
INVALID_STRING_INDEX;
        }
        
        
AddToStringTable(particleEffectNamesparticleSystem);
        
index numStrings;
    }
    
    return 
index;
}

/*
 * Rewrite of FindStringIndex, because in my tests
 * FindStringIndex failed to work correctly.
 * Searches for the index of a given string in a string table. 
 * 
 * @param tableidx        A string table index.
 * @param str            String to find.
 * @return                String index if found, INVALID_STRING_INDEX otherwise.
 */
stock FindStringIndex2(tableidx, const String:str[])
{
    
decl String:buf[1024];

    new 
numStrings GetStringTableNumStrings(tableidx);
    for (new 
i=0numStringsi++) {
        
ReadStringTable(tableidxibufsizeof(buf));
        
        if (
StrEqual(bufstr)) {
            return 
i;
        }
    }
    
    return 
INVALID_STRING_INDEX;

This is supposedly based on this. I tested both methods, however nothing worked. The stock runs correctly because the index was getting printed in my tests.

Also, I'm not sure whether that matters, but the way I test it is with a tiny test map with a info_particle_system in the center, so I'm not invoking the particle via scripts.
Phil25 is offline
lingzhidiyu
Senior Member
Join Date: Mar 2014
Old 11-02-2015 , 10:50   Re: Custom particle systems
Reply With Quote #3

csgo only

PHP Code:
PrecacheGeneric("particles/*.pcf"true);
AddFileToDownloadsTable("particles/*.pcf"); 
lingzhidiyu is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-02-2015 , 11:35   Re: Custom particle systems
Reply With Quote #4

tf2 pls
__________________
Chdata is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 11-02-2015 , 11:50   Re: Custom particle systems
Reply With Quote #5

https://forums.alliedmods.net/showpo...43&postcount=2 ? :O
Miu is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 11-02-2015 , 14:02   Re: Custom particle systems
Reply With Quote #6

That is quite disappointing.

On another note, is it possible to override client's manifest file for the same map? Or the particle system itself, for that matter; forcing clients to redownload it.
Phil25 is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-08-2015 , 14:07   Re: Custom particle systems
Reply With Quote #7

In TF2 if you use the "make a copy of a particle manifest file for EVERY map" method, I hear it can give clients errors when they are playing that map not on your server.


I was wondering if there's a way to hook some function related to whatever loads such file in TF2 and change what particles it's loading or add some / etc....
__________________

Last edited by Chdata; 11-08-2015 at 14:07.
Chdata 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 18:13.


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