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

change Beam Length of weapon tripmine HL?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 11-24-2021 , 13:58   change Beam Length of weapon tripmine HL?
Reply With Quote #1

Hi, I tried to change the beam length based on HLSDK but it didn't work.
PHP Code:
void CTripmineGrenade :: MakeBeamvoid )
{
   
TraceResult tr;

   
// ALERT( at_console, "serverflags %f\n", gpGlobals->serverflags );

   
UTIL_TraceLinepev->originm_vecEnddont_ignore_monstersENTpev ), &tr );

   
m_flBeamLength tr.flFraction;

   
// set to follow laser spot
   
SetThink( &CTripmineGrenade::BeamBreakThink );
   
pev->nextthink gpGlobals->time 0.1;

   
Vector vecTmpEnd pev->origin m_vecDir 2048 m_flBeamLength

   m_pBeam 
CBeam::BeamCreateg_pModelNameLaser10 );
   
m_pBeam->PointEntInitvecTmpEndentindex() );
   
m_pBeam->SetColor0214198 );
   
m_pBeam->SetScrollRate255 );
   
m_pBeam->SetBrightness64 );

What i do:

PHP Code:
public EmitSound(entitychannel, const sound[])
{
   if(
equal(sound "weapons/mine_activate.wav"))
   {
      
      
//static beam; beam = get_pdata_cbase(tripmine, m_pBeam, extraoffset_linux);   
      
static Floatorigin[3]
      static 
FloatvecEnd[3]
      static 
FloatvecDir[3];
      static 
Floatm_fBeamLength 
      
      pev
(tripmine pev_originorigin)
      
      
vecEnd[0] = get_pdata_float(tripminem_vecEnd_xextraoffset_linux);
      
vecEnd[1] = get_pdata_float(tripminem_vecEnd_yextraoffset_linux);
      
vecEnd[2] = get_pdata_float(tripminem_vecEnd_zextraoffset_linux);
      
      
vecDir[0] = get_pdata_float(tripminem_vecDir_xextraoffset_linux)
      
vecDir[1] = get_pdata_float(tripminem_vecDir_yextraoffset_linux)
      
vecDir[2] = get_pdata_float(tripminem_vecDir_zextraoffset_linux)
      
//global_get( glb_v_forward, dir );
      //angle_vector(origin, ANGLEVECTOR_FORWARD, dir)
      
m_fBeamLength  get_pdata_float(tripminem_flBeamLengthextraoffset_linux)


      
vecEnd[0] = origin[0] + vecDir[0] * 2048.0 m_fBeamLength
      vecEnd
[1] = origin[1] + vecDir[1] * 2048.0 m_fBeamLength
      vecEnd
[2] = origin[2] + vecDir[2] * 2048.0 m_fBeamLength
      

      set_pdata_float
(tripminem_vecEnd_xvecEnd[0], extraoffset_linux)
      
set_pdata_float(tripminem_vecEnd_yvecEnd[1], extraoffset_linux)
      
set_pdata_float(tripminem_vecEnd_zvecEnd[2], extraoffset_linux
      
      
//Beam_PointEntInit(beam, vecEnd, tripmine)
      
      
client_print(0print_chat,"=============  This ====> Done!")
      
      return 
FMRES_IGNORED;
      
//return FMRES_SUPERCEDE;
   
}
   return 
FMRES_IGNORED;

I should change the value of 2048.0 to a lower value, but the method seems wrong because the results remain the same
Is there a way that makes more sense?
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-29-2021 , 06:53   Re: change Beam Length of weapon tripmine HL?
Reply With Quote #2

Since MakeBeam() is called two times, you should probably hook Ham_Spawn on the "beam" entity instead if you don't want to work with orpheu. Then add a small delay, either using RequestFrame or set_task, get the owner of the beam and check if it's a tripmine, use CBeam::GetEndEntity to do that. Now just update the end position of the beam by calling CBeam::SetStartPos and CBeam::RelinkBeam

You will need to update CTripmine->m_vecEnd as well
__________________









Last edited by CrazY.; 11-29-2021 at 06:55.
CrazY. 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 17:35.


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