AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change Beam Length of weapon tripmine HL? (https://forums.alliedmods.net/showthread.php?t=335316)

abdobiskra 11-24-2021 13:58

change Beam Length of weapon tripmine HL?
 
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?

CrazY. 11-29-2021 06:53

Re: change Beam Length of weapon tripmine HL?
 
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


All times are GMT -4. The time now is 03:10.

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