Raised This Month: $4 Target: $400
 1% 

[CS:GO] Beam particle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BlackBird
Junior Member
Join Date: May 2017
Old 10-20-2021 , 04:58   [CS:GO] Beam particle
Reply With Quote #1

Hi, everybody
There is a task to create a particle in the form of a ray between two players. But there is no way to do that.
There is a ready-made model of a particular *.pcf. I create it and assign it a parent SetParent Input, and as a control point I specify the second player to which the beam should be attached. All I get in the end is fixing the beam at the feet of the second player (cpoint1) and attaching it to the first player at the foot level, but with an offset of +-100 units. At the same time, any movements of the second or first player cause a chaotic displacement of the beam in the run-up (that is, the beam may not be at the feet of the first player, but to the right or left of him from 100-300 units).

I tried to teleport the particle to eye level and slightly above the player's model and got the result that the beam is above the head of the first player with an offset to the right or left

Question. How to create a beam between two players so that the first player (who launches the beam) has the beam coming from the eye position and is attached to the second player (the victim of the first player) in the center of his model?

Code:
particle = CreateEntityByName("info_particle_system");
if(IsValidEdict(particle))
{
        char clientStr[64], targetStr[64]; 
        
        GetEntPropString(client, Prop_Data, "m_iName", clientStr, sizeof(clientStr));
        if (strlen(clientStr) < 3 ) 
        {
            Format(clientStr, sizeof(clientStr), "Client%i", client);
            DispatchKeyValue(client, "targetname", clientStr);
        }

        DispatchKeyValue(particle, "start_active", "1");
        DispatchKeyValue(particle, "targetname", "TestParticle");
        DispatchKeyValue(particle, "parentname", clientStr);

        GetEntPropString(aimTarget, Prop_Data, "m_iName", targetStr, sizeof(targetStr));
        if (strlen(targetStr) < 3) 
        {
            Format(targetStr, sizeof(targetStr), "Client%i", aimTarget);
            DispatchKeyValue(aimTarget, "targetname", targetStr);
        }

        DispatchKeyValue(particle, "effect_name", "test_beam");

        DispatchKeyValue(particle, "cpoint1", targetStr);
        DispatchSpawn(particle);
        SetVariantString(clientStr);
        AcceptEntityInput(particle, "SetParent");
        SetVariantString("mouth");
        AcceptEntityInput(particle, "SetParentAttachment");
        
        //The particle is finally ready
        ActivateEntity(particle);
        AcceptEntityInput(particle, "start");
}

Last edited by BlackBird; 10-20-2021 at 05:10.
BlackBird is offline
BlackBird
Junior Member
Join Date: May 2017
Old 10-20-2021 , 07:20   Re: [CS:GO] Beam particle
Reply With Quote #2

Close
BlackBird is offline
Reply


Thread Tools
Display Modes

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 03:08.


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