AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Beam particle (https://forums.alliedmods.net/showthread.php?t=334793)

BlackBird 10-20-2021 03:58

[CS:GO] Beam particle
 
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");
}


BlackBird 10-20-2021 06:20

Re: [CS:GO] Beam particle
 
Close


All times are GMT -4. The time now is 13:35.

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