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

TE_Setupbeamlaser spawns at wrong location


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-02-2012 , 15:40   TE_Setupbeamlaser spawns at wrong location
Reply With Quote #1

Hi guys.

Code:
public Action:TestCommand_Used(client, args)
{
    decl targetid;
    
    targetid = GetClientAimTarget(client, true);
    
    if(targetid > 0)
    {
        if(IsClientConnected(targetid))
        {
            if(IsClientInGame(targetid) && !IsFakeClient(targetid))
            {
                if(GetUserAdmin(targetid) == INVALID_ADMIN_ID)
                {
                    
                    decl String:username[MAX_NAME_LENGTH];
                    decl String:targetname[MAX_NAME_LENGTH];
                        
                    GetClientName(client, username, MAX_NAME_LENGTH);
                    GetClientName(targetid, targetname, MAX_NAME_LENGTH);
                    
                    TE_SetupBeamLaser(client, targetid, g_sprite, 0, 0, 0, 1.0, 2.0, 2.0, 3, 0.0, beamcolor, 1);
                    
                    for(new i=1;i<=MaxClients;i++)
                    {
                        if(IsClientConnected(i))
                        {
                            if(IsClientInGame(i) && !IsFakeClient(i))
                            {
                                if(GetUserAdmin(i) != INVALID_ADMIN_ID)
                                {
                                    PrintToChat(i, "%s used testcommand on %s", username, targetname);
                                    
                                    TE_SendToClient(i);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    return Plugin_Handled;
}
Somehow this beam does not appear between the two entities. However, when I turn around a bit, I see a red flicker (color is 255,0,0,100), so the material (materials/sprites/laserbeam.vmt) is definately being precached correctly when the plugin starts. I have no idea why the beam is not between the two entities but somewhere else and only visible in a glitchy and dislocated/disoriented way in front of my eyes if I turn around and stand still in a certain position.
Clientid and targetid are definately correct because the nicknames in the debugline are as well.

I'm using L4D2 btw.

Any ideas?
I'm clueless on that one.


Also, I wanted to play a laserbeam-sound but unfortunately I can't find any in the L4D2-soundlib, although I'm sure that I just haven't looked properly yet. Maybe one of you can give me the path of a useable soundfile, I'm pretty sure I heard one in a l4d2-plugin before.


Thanks in advance!
House

Last edited by Dr. Greg House; 02-02-2012 at 15:46.
Dr. Greg House is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-04-2012 , 11:58   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #2

No ideas?
Dr. Greg House is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-04-2012 , 12:53   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #3

Try different beam materials...

or quick try this. Haven't tested now because using another computer
Spoiler

Just aim someone human player and use command sm_beam

Have read that it could make beam but you see it from up to down or vice versa.
But not show better from sides... Assuming now.

Last edited by Bacardi; 02-06-2012 at 12:48. Reason: update code
Bacardi is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-04-2012 , 13:25   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #4

No difference, sorry

What I've also noticed on both commands: Sometimes the game just crashes (only the client not the server, no error message on both sides, the server just registers a timeout). I mean, wtf?

Last edited by Dr. Greg House; 02-04-2012 at 13:29.
Dr. Greg House is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 02-04-2012 , 18:02   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #5

for HaloIndex use g_sprite aswell.
also the origins of the entities are used for the start/end points so if both entities are clients then the origin is at the feet so it will be feet to feet.
i'd also move the tempent setup to just before where you send it, no point setting it up if you're not going to send it because of certain conditions.
blodia is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-04-2012 , 21:53   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #6

Still no difference. Also there is no connection between the feet.
Dr. Greg House is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 02-05-2012 , 09:19   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #7

try using TE_SetupBeamPoints instead and use the client/target eye posisiton as the start/end points, also add a check to see if client/target is a alive unless you want to be able to track them when they're dead too.
blodia is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 02-05-2012 , 12:04   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #8

That works, but has the disadvantage that it's not attached to the players.
Dr. Greg House is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-06-2012 , 13:42   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #9

I update my post #3

Ok, TE_SetupBeamLaser works but maybe not way you like it.
It have laser effect.

You can see beam from one direction (look entity where beam start) and when your view is close between two entities.
Otherwise it fade out when look other way or move far.


But try this, using env_beam (I tested in Cs:s)
Spoiler



*
by the way... can be done custom TempEnts ??


*edit
Here, I made stock in same code... this should be included in SM sdktools.
TE_SetupBeamEnts()
PHP Code:
#include <sdktools>

new mdlindx;

public 
OnPluginStart()
{
    
RegAdminCmd("sm_beam"cmd_beamADMFLAG_GENERIC);
}

public 
OnMapStart()
{
    
mdlindx PrecacheModel("materials/sprites/purplelaser1.vmt");
}

public 
Action:cmd_beam(clientargs)
{
    new 
target;

    if((
target GetClientAimTarget(clientfalse)) > && target <= MaxClients)
    {
        new 
colour[4];
        
colour[0] = 255;
        
colour[1] = 0;
        
colour[2] = 0;
        
colour[3] = 255;

        
TE_SetupBeamEnts(targetclientmdlindx00010.01.01.000.0colour0);
        
TE_SendToAll(0.1);
    }
    return 
Plugin_Handled;
}

stock TE_SetupBeamEnts(StartEntityEndEntityModelIndexHaloIndexStartFrameFrameRateFloat:Life
                
Float:WidthFloat:EndWidthFadeLengthFloat:Amplitude, const Color[4], Speed)
{
    
TE_Start("BeamEnts");
    
TE_WriteEncodedEnt("m_nStartEntity"StartEntity);
    
TE_WriteEncodedEnt("m_nEndEntity"EndEntity);
    
TE_WriteNum("m_nModelIndex"ModelIndex);
    
TE_WriteNum("m_nHaloIndex"HaloIndex);
    
TE_WriteNum("m_nStartFrame"StartFrame);
    
TE_WriteNum("m_nFrameRate"FrameRate);
    
TE_WriteFloat("m_fLife"Life);
    
TE_WriteFloat("m_fWidth"Width);
    
TE_WriteFloat("m_fEndWidth"EndWidth);
    
TE_WriteFloat("m_fAmplitude"Amplitude);
    
TE_WriteNum("r"Color[0]);
    
TE_WriteNum("g"Color[1]);
    
TE_WriteNum("b"Color[2]);
    
TE_WriteNum("a"Color[3]);
    
TE_WriteNum("m_nSpeed"Speed);
    
TE_WriteNum("m_nFadeLength"FadeLength);


Last edited by Bacardi; 02-06-2012 at 14:35.
Bacardi is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 08-20-2013 , 14:07   Re: TE_Setupbeamlaser spawns at wrong location
Reply With Quote #10

Unfortunately, none of these examples are working, no errors, nothing happens. I'm using "materials/sprites/laserbeam.vmt".
Dr. Greg House 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 06:40.


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