AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   env_beam between two players (https://forums.alliedmods.net/showthread.php?t=152961)

Greyscale 03-16-2011 22:51

env_beam between two players
 
You'd think this would have been discussed already but I could find nothing.

I just want to create a beam or some kind of solid line between 2 players and it should move smoothly with the players.

Heres what I got, and it just doesn't work. No beam shows.

Code:

AttachBeam(client1, client2)
{
    new beament  = CreateEntityByName("env_beam");
    if (IsValidEdict(beament))
    {
        // Name the start and end players.
        new String:tname1[16];
        Format(tname1, sizeof(tname1), "target%i", GetClientUserId(client1));
        DispatchKeyValue(client1, "targetname", tname1);
       
        new String:tname2[16];
        Format(tname2, sizeof(tname2), "target%i", GetClientUserId(client2));
        DispatchKeyValue(client2, "targetname", tname2);
       
        // Set keyvalues on the beam.
        DispatchKeyValue(beament, "renderamt", "255");
        DispatchKeyValue(beament, "rendercolor", "255 0 255");
        DispatchKeyValue(beament, "life", "0");
        DispatchKeyValue(beament, "BoltWidth", "10");
        DispatchKeyValue(beament, "NoiseAmplitude", "0");
        DispatchKeyValue(beament, "damage", "0");
        DispatchKeyValue(beament, "LightningStart", tname1);
        DispatchKeyValue(beament, "LightningEnd", tname2);
        DispatchKeyValue(beament, "TouchType", "0");
        // this is precached before map load. i also tried just not defining it and hoping a default would work.
        //DispatchKeyValue(beament, "texture", "materials/effects/laser1.vmt");
       
        DispatchSpawn(beament);
        AcceptEntityInput(beament, "TurnOn");
    }
}


Mitchell 03-16-2011 23:28

Re: env_beam between two players
 
last time i check env_beams dont move like as if you were to attach it to players, ive done this long ago with a deathrun map, attaching it to a info_target. not sure that was a long time ago.

Greyscale 03-17-2011 00:41

Re: env_beam between two players
 
So is there a way to do it using another method?

My last resort is just redrawing beams every frame, which is jittery but if it's the only way..

asherkin 03-17-2011 01:36

Re: env_beam between two players
 
Depending on the game, you can use a particle system.
For TF2, you can use the medic beam particle and attach one control point to each player.

Greyscale 03-17-2011 02:46

Re: env_beam between two players
 
Yeah I saw that when I was searching. This is for CS:S. Now that it's on the OB engine would this be available?

asherkin 03-17-2011 03:02

Re: env_beam between two players
 
Quote:

Originally Posted by Greyscale (Post 1434545)
Yeah I saw that when I was searching. This is for CS:S. Now that it's on the OB engine would this be available?

While the particle system is available, you would need to find a beam particle to use. Launch the game with -tools to see all the available ones.

Greyscale 03-17-2011 03:19

Re: env_beam between two players
 
Well there's no beam particles :/ but that -tools option is pretty coo.

berni 03-17-2011 08:24

Re: env_beam between two players
 
PHP Code:

TE_SetupBeamFollow(EntIndexModelIndexHaloIndexFloat:LifeFloat:WidthFloat:EndWidthFadeLength, const Color[4]) 

http://docs.sourcemod.net/api/index....d=show&id=387&

Nail 03-17-2011 08:50

Re: env_beam between two players
 
SetEntPropEnt(beam, Prop_Send, "moveparent", client);
SetEntityMoveType(beam, MOVETYPE_FLY );
http://docs.sourcemod.net/api/index....d=show&id=848&

Greyscale 03-17-2011 13:12

Re: env_beam between two players
 
bernie: I'm not sure how that accomplishes what I asked for.. unless you can somehow manipulate the net props.

Nail: That looks like it'll stick a beam to a player? I might be able to play around with that. Is that beam index an env_beam? If so I haven't been able to get env_beam to show at all.


All times are GMT -4. The time now is 08:00.

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