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

env_beam between two players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-16-2011 , 22:51   env_beam between two players
Reply With Quote #1

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");
    }
}
__________________
Greyscale is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-16-2011 , 23:28   Re: env_beam between two players
Reply With Quote #2

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.
Mitchell is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-17-2011 , 00:41   Re: env_beam between two players
Reply With Quote #3

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..
__________________
Greyscale is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-17-2011 , 01:36   Re: env_beam between two players
Reply With Quote #4

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.
__________________
asherkin is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-17-2011 , 02:46   Re: env_beam between two players
Reply With Quote #5

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?
__________________
Greyscale is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-17-2011 , 03:02   Re: env_beam between two players
Reply With Quote #6

Quote:
Originally Posted by Greyscale View Post
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.
__________________
asherkin is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-17-2011 , 03:19   Re: env_beam between two players
Reply With Quote #7

Well there's no beam particles :/ but that -tools option is pretty coo.
__________________
Greyscale is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 03-17-2011 , 08:24   Re: env_beam between two players
Reply With Quote #8

PHP Code:
TE_SetupBeamFollow(EntIndexModelIndexHaloIndexFloat:LifeFloat:WidthFloat:EndWidthFadeLength, const Color[4]) 
http://docs.sourcemod.net/api/index....d=show&id=387&
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 03-17-2011 , 08:50   Re: env_beam between two players
Reply With Quote #9

SetEntPropEnt(beam, Prop_Send, "moveparent", client);
SetEntityMoveType(beam, MOVETYPE_FLY );
http://docs.sourcemod.net/api/index....d=show&id=848&
Nail is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 03-17-2011 , 13:12   Re: env_beam between two players
Reply With Quote #10

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.
__________________
Greyscale 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 16:38.


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