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-09-2019 , 13:19   Re: m_hActiveWeapon
Reply With Quote #21

Quote:
Originally Posted by MasterMind420 View Post
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
Understand you. All thanks, friends.
Entity is offline
SZOKOZ
Member
Join Date: Jan 2014
Old 05-10-2019 , 11:27   Re: m_hActiveWeapon
Reply With Quote #22

Quote:
Originally Posted by TheDS1337 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
    {
        
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);
        }
    }

The attachment you are looking for is muzzle_flash.
Code:
ActivateEntity(particle);			
SetVariantString("!activator");
AcceptEntityInput(particle, "SetParent", active_weapon, particle);			
SetVariantString("muzzle_flash"); 
AcceptEntityInput(particle, "SetParentAttachment", active_weapon, particle);
I can't for the life of me remember but I don't think the player actually carries the weapon entity when they have the weapon active or in inventory so I don't know if this will work. It should always work however when the weapon is not equipped (e.g. on the floor, not picked up in general).
If that doesn't work for the weapon while it is active on the player then try parenting it on the client. The player version of the attachment isn't exactly on the muzzle but you could add a specific offset for the gun types if you are willing to do the extra work or it might even be good enough for your needs.
Code:
ActivateEntity(particle);			
SetVariantString("!activator");
AcceptEntityInput(particle, "SetParent", client, particle);			
SetVariantString("muzzle_flash"); 
AcceptEntityInput(particle, "SetParentAttachment", client, particle);
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam

Last edited by SZOKOZ; 05-10-2019 at 11:30.
SZOKOZ is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-10-2019 , 12:58   Re: m_hActiveWeapon
Reply With Quote #23

try attaching the particle to the players hand then teleporting(this should work) it to the tip of the gun and get the location of the tip in relation to the hand(trial and error to figure out), check that the weapon u want the particle on is active, apply the particle. theoretically the particle should move with the tip of the gun because the hand should move accordingly. If it does not then it won't look right....but imo your best bet is doing that.

Last edited by MasterMind420; 05-10-2019 at 12:59.
MasterMind420 is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-10-2019 , 14:39   Re: m_hActiveWeapon
Reply With Quote #24

https://forums.alliedmods.net/showth...=200458&page=3
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Entity
Member
Join Date: May 2016
Old 05-16-2019 , 06:21   Re: m_hActiveWeapon
Reply With Quote #25

Quote:
Originally Posted by MasterMind420 View Post
try attaching the particle to the players hand then teleporting(this should work) it to the tip of the gun and get the location of the tip in relation to the hand(trial and error to figure out), check that the weapon u want the particle on is active, apply the particle. theoretically the particle should move with the tip of the gun because the hand should move accordingly. If it does not then it won't look right....but imo your best bet is doing that.
Maybe it's the only way. All thanks
Entity 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 22:58.


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