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

Changing Particle Colours


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Noodl
Member
Join Date: Jun 2015
Old 07-14-2017 , 12:49   Changing Particle Colours
Reply With Quote #1

So I'm trying to alter a particle's colour (blue burning flames etc, type of thing).
I'm pretty new to stuff like entities, properties and offsets etc, in terms of finding an entity's properties and whatnot.

This is what I've got so far to spawn a simple particle at my feet, trying to get the colour (attaching and stuff can come later). A player has this m_clrRender prop, but the particle system I create does not. Is it even possible for us to change a particle system's colour via a plugin, rather than going into PCFs and stuff, and if so, how would I go about that?

Code:
int particle = CreateEntityByName("info_particle_system");
		char name[64];
		
		float position[3];
		GetEntPropVector(iClient, Prop_Send, "m_vecOrigin", position);
		TeleportEntity(particle, position, NULL_VECTOR, NULL_VECTOR);
		GetEntPropString(iClient, Prop_Data, "m_iName", name, sizeof(name));
		DispatchKeyValue(particle, "targetname", "tf2particle");
		DispatchKeyValue(particle, "parentname", name);
		DispatchKeyValue(particle, "effect_name", "superrare_greenenergy");
		DispatchSpawn(particle);
		SetVariantString(name);
		AcceptEntityInput(particle, "SetParent", particle, particle, 0);
		ActivateEntity(particle);
		AcceptEntityInput(particle, "start");
		CPrintToChatAll("goofing");
		int r, g, b, a;
		int offset = GetEntSendPropOffs(particle, "m_clrRender");
		if (offset > 0)
		{
			r = GetEntData(particle, offset, 1);
			g = GetEntData(particle, offset + 1, 1);
			b = GetEntData(particle, offset + 2, 1);
			a = GetEntData(particle, offset + 3, 1);
			CPrintToChatAll("goofing");
			CPrintToChatAll("%i %i %i %i", r, g, b, a);
		}

Last edited by Noodl; 07-14-2017 at 12:50.
Noodl is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 07-17-2017 , 05:38   Re: Changing Particle Colours
Reply With Quote #2

Try:
PHP Code:
DispatchKeyValue(particle"rendercolor"color); 
Also, a suggestion for setting parents for entities:
PHP Code:
SetVariantString("!activator");
AcceptEntityInput(particle"SetParent"iClientparticle); 
Because there are times where it fails.
cravenge is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-17-2017 , 13:17   Re: Changing Particle Colours
Reply With Quote #3

Particle colours can't be changed.
__________________
Silvers is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 07-17-2017 , 14:17   Re: Changing Particle Colours
Reply With Quote #4

You could try these two entities

https://developer.valvesoftware.com/wiki/Env_smokestack

https://developer.valvesoftware.com/..._particlelight

Be sure to read the docs the entity may be broken for the game your on.
It says it don't work for info_particle_system
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux 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 05:01.


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