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

Finding keyvalues of an Ent/Rotating a particle?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DiscoBBQ
Veteran Member
Join Date: Jan 2005
Location: Clemson, South Carolina
Old 12-07-2010 , 22:09   Finding keyvalues of an Ent/Rotating a particle?
Reply With Quote #1

Hey everyone, I have two questions, stemming from the same problem.

I am trying to rotate an entity, namely, info_particle_system.

I have attempted to do this three different ways.

1.
Code:
TeleportEntity(particle, position, angles, NULL_VECTOR);
2.
Code:
SetEntProp(particle, Prop_Send, "m_angRotation", angles);
*I found m_angRotation by using sm_dump_datamaps, where "m_angAbsRotation" and "m_vecAngVelocity" are also located, however they both cause a run-time error.

3.
Code:
DispatchKeyValue(particle, "Pitch Yaw Roll (Y Z X)", string_angles);
None of these three methods worked. However, TeleportEntity, and SetEntProp worked on other entities (such as doors) during testing.

According to http://developer.valvesoftware.com/w...article_system, the keyvalue for angular rotation is "Pitch Yaw Roll (Y Z X)". I have a hunch that this may be a typo. I also tried using angles as the keyvalue.

So my question stands, does anyone know how to rotate an info_particle_system, or find correct keyvalues?

This is a watered down version of the code I am using:
Code:
write_particle(ent, String:particle_name[], bool:incapped = false)
{
	decl particle;
	decl String:target_name[64];

	particle = CreateEntityByName("info_particle_system");
	
	if (IsValidEdict(particle))
	{
		decl Float:position[3], Float:angles[3];

		angles[0] = GetRandomFloat(0.0, 360.0);
		angles[1] = GetRandomFloat(0.0, 360.0);
		angles[2] = GetRandomFloat(0.0, 360.0);
		
		GetEntPropVector(ent, Prop_Send, "m_vecOrigin", position);
		
		TeleportEntity(particle, position, angles, NULL_VECTOR);

		Format(target_name, sizeof(target_name), "Entity%d", ent);
		DispatchKeyValue(ent, "targetname", target_name);
		GetEntPropString(ent, Prop_Data, "m_iName", target_name, sizeof(target_name));

		DispatchKeyValue(particle, "targetname", "L4D2Particle");
		DispatchKeyValue(particle, "parentname", target_name);
		DispatchKeyValue(particle, "effect_name", particle_name);

		DispatchSpawn(particle);
		
		SetVariantString(target_name);
		AcceptEntityInput(particle, "SetParent", particle, particle);
		
		SetEntPropVector(particle, Prop_Send, "m_angRotation", angles);
		
		ActivateEntity(particle);
		AcceptEntityInput(particle, "start");

		CreateTimer(GetRandomFloat(1.0, 2.0), delete_particle, particle);
	}
}
__________________
"Every man is guilty of all the good he did not do"
DiscoBBQ is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-07-2010 , 22:15   Re: Finding keyvalues of an Ent/Rotating a particle?
Reply With Quote #2

PHP Code:
DispatchKeyValue(Ent"angles""<X> <Y> <Z>"); 
__________________
Master(d)



Master53 is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 12-07-2010 , 22:23   Re: Finding keyvalues of an Ent/Rotating a particle?
Reply With Quote #3

Code:
DispatchKeyValue(particle, "Pitch Yaw Roll (Y Z X)", string_angles);
This keyvalue is almost certainly wrong. I noticed that you shouldn't just copy what's written in the Valve Dev Wiki as actual strings for Sourcemod.
To check if it's right, try and find it in the dumped datamaps. It should be at the end of the property's line.


Changing m_angRotation should've done the trick, though.
Angles is a vector (Float:[3]), so use SetEntPropVector (You used it in your code, but not your example).


Also, Teleporting before dispatching your entity's spawn isn't good and I think it might even cause errors.



I've never directly dealt with this before, so these are just suggestions.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys 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 07:09.


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