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

m_hActiveWeapon


Post New Thread Reply   
 
Thread Tools Display Modes
Entity
Member
Join Date: May 2016
Old 05-06-2019 , 06:09   Re: m_hActiveWeapon
Reply With Quote #11

Quote:
Originally Posted by Neuro Toxin View Post
It won't help
Entity is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-06-2019 , 06:25   Re: m_hActiveWeapon
Reply With Quote #12

https://developer.valvesoftware.com/...chy_(parenting)

Try parenting the effect into your weapon.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Entity
Member
Join Date: May 2016
Old 05-06-2019 , 09:19   Re: m_hActiveWeapon
Reply With Quote #13

Quote:
Originally Posted by eyal282 View Post
https://developer.valvesoftware.com/...chy_(parenting)

Try parenting the effect into your weapon.
PHP Code:
new active_weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
if (
IsValidEntity(active_weapon))
{
    new 
particle CreateEntityByName("info_particle_system");
        
    if (
particle != -1
    {
        
decl Float:position[3];
        
GetEntPropVector(active_weaponProp_Send"m_vecOrigin"position); //return Float:{0.0, 0.0, 0.0}
        
DispatchKeyValueVector(particle"origin"position);
        
DispatchKeyValue(particle"effect_name""smoke_trail");
        
DispatchKeyValue(particle"start_active""1");
        
        if (
DispatchSpawn(particle)) 
        {
            
ActivateEntity(particle);
            
SetVariantString("!activator");
            
AcceptEntityInput(particle"SetParent"active_weapon);
            
SetVariantString("0"); 
            
AcceptEntityInput(particle"SetParentAttachment"particle);
        }
    }

I tried...

Last edited by Entity; 05-06-2019 at 09:22.
Entity is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 05-06-2019 , 12:59   Re: m_hActiveWeapon
Reply With Quote #14

Quote:
Originally Posted by Entity View Post
PHP Code:
new active_weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
if (
IsValidEntity(active_weapon))
{
    new 
particle CreateEntityByName("info_particle_system");
        
    if (
particle != -1
    {
        
decl Float:position[3];
        
GetEntPropVector(active_weaponProp_Send"m_vecOrigin"position); //return Float:{0.0, 0.0, 0.0}
        
DispatchKeyValueVector(particle"origin"position);
        
DispatchKeyValue(particle"effect_name""smoke_trail");
        
DispatchKeyValue(particle"start_active""1");
        
        if (
DispatchSpawn(particle)) 
        {
            
ActivateEntity(particle);
            
SetVariantString("!activator");
            
AcceptEntityInput(particle"SetParent"active_weapon);
            
SetVariantString("0"); 
            
AcceptEntityInput(particle"SetParentAttachment"particle);
        }
    }

I tried...
I think they meant that you don't need to set the origin manually, it'll be updated automatically after SetParantAttachement, from wiki:
PHP Code:
SetParentAttachment
 Note
:    Entities must be parented before being sent this input. Use at least a 0.01 second delay between SetParent and SetParentAttachment inputs.
You can also fire a SetParentAttachment input at the child-entity to attach it to a specific attachment point on its parentThe parameter is the name of the attachment point.

The Child instantly teleports to the attachment pointThis is the only method which does not maintain the offset
You may try this, found it after few secs of search:
PHP Code:
new active_weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
if (
IsValidEntity(active_weapon))
{
    new 
particle CreateEntityByName("info_particle_system");
        
    if (
particle != -1
    {
        
DispatchKeyValue(particle"effect_name""smoke_trail");
        
DispatchKeyValue(particle"start_active""1");
        
        if (
DispatchSpawn(particle)) 
        {
            
ActivateEntity(particle);            
            
SetVariantString("!activator");
            
AcceptEntityInput(particle"SetParent"active_weaponparticle);            
            
SetVariantString("muzzle"); 
            
AcceptEntityInput(particle"SetParentAttachment"active_weaponparticle);
        }
    }


Last edited by TheDS1337; 05-06-2019 at 13:09.
TheDS1337 is offline
Entity
Member
Join Date: May 2016
Old 05-07-2019 , 16:44   Re: m_hActiveWeapon
Reply With Quote #15

Quote:
Originally Posted by TheDS1337 View Post
I think they meant that you don't need to set the origin manually, it'll be updated automatically after SetParantAttachement, from wiki:
PHP Code:
SetParentAttachment
 Note
:    Entities must be parented before being sent this input. Use at least a 0.01 second delay between SetParent and SetParentAttachment inputs.
You can also fire a SetParentAttachment input at the child-entity to attach it to a specific attachment point on its parentThe parameter is the name of the attachment point.

The Child instantly teleports to the attachment pointThis is the only method which does not maintain the offset
You may try this, found it after few secs of search:
PHP Code:
new active_weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
if (
IsValidEntity(active_weapon))
{
    new 
particle CreateEntityByName("info_particle_system");
        
    if (
particle != -1
    {
        
DispatchKeyValue(particle"effect_name""smoke_trail");
        
DispatchKeyValue(particle"start_active""1");
        
        if (
DispatchSpawn(particle)) 
        {
            
ActivateEntity(particle);            
            
SetVariantString("!activator");
            
AcceptEntityInput(particle"SetParent"active_weaponparticle);            
            
SetVariantString("muzzle"); 
            
AcceptEntityInput(particle"SetParentAttachment"active_weaponparticle);
        }
    }

so too does not work
Entity is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-07-2019 , 18:37   Re: m_hActiveWeapon
Reply With Quote #16

Hmm. Has the partical been precached.

If you spawn it at your location without parenting it, can you see it?
__________________
Neuro Toxin is offline
Entity
Member
Join Date: May 2016
Old 05-08-2019 , 10:34   Re: m_hActiveWeapon
Reply With Quote #17

Quote:
Originally Posted by Neuro Toxin View Post
Hmm. Has the partical been precached.

If you spawn it at your location without parenting it, can you see it?
Yes.
Entity is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-08-2019 , 15:09   Re: m_hActiveWeapon
Reply With Quote #18

Quote:
Originally Posted by Entity View Post
Yes.
any attempts ive made at parenting a particle to a weapon has failed. u can parent it to a non picked up weapon. however once u pick it up the particle immediately gets attached to the player regardless of who u parent parent it to again. this was for l4d2. the only way i can see it working is by maybe creating the particle without a parent then teleporting it to a specific location...where u want the particle effect on the weapon...so get the weapons vector in the world and then constantly teleport it to that location...so it moves with the weapon. i never attempted this because it just seems like too much of a hassle. unless someone has a better idea, thats all i got...u could set it to trigger the teleport when a player presses any movement keys and when they move there mouse to minimize constant teleporting

Last edited by MasterMind420; 05-08-2019 at 15:14.
MasterMind420 is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 05-08-2019 , 17:31   Re: m_hActiveWeapon
Reply With Quote #19

why not just get the player pos and adjust the x to coincide with the weapon's x
__________________
kratoss1812 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-08-2019 , 17:47   Re: m_hActiveWeapon
Reply With Quote #20

Quote:
Originally Posted by kratoss1812 View Post
why not just get the player pos and adjust the x to coincide with the weapon's x
It would never look right unless u account for the player/weapon moving...the particle would remain in the same spot in the world without being parented. Constant teleporting of the particle would need to be done without parenting it to give the illusion of it being parented to the weapon. In my opinion doing it from the client would be less accurate and not look right...u swing your arms yet the particle remains in the same spot. Get the weapons vector.

Last edited by MasterMind420; 05-08-2019 at 17:52.
MasterMind420 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 08:43.


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