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

Change the laser beam of tripmine (Half-Life)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-25-2010 , 04:27   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #11

tripmine.cpp...

Then in CTripmineGrenade :: MakeBeam(), where it's defined SetColor() and such... And you find :

inline void SetWidth( int width ) { pev->scale = width; }
inline void SetNoise( int amplitude ) { pev->body = amplitude; }
inline void SetColor( int r, int g, int b ) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
inline void SetBrightness( int brightness ) { pev->renderamt = brightness; }
inline void SetFrame( float frame ) { pev->frame = frame; }
inline void SetScrollRate( int speed ) { pev->animtime = speed; }
__________________
Arkshine is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 12-25-2010 , 07:29   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #12

tripmine.cpp. I blind. And you opened my eyes (again ).
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-05-2013 , 09:34   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #13

Reviving this thread. I don't want to open a new one because this thread seems to have many useful offsets.
What I'm trying to do it to extend the beam to be longer. AFAIK, the beam max length is 2048.0 unit length. How do I set the beam longer, say 4096.0? Also, is there any limit to the length?
kNowo is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 08:19   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #14

Damn, no one play half life anymore?
kNowo is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 08-06-2013 , 10:41   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #15

sure people play half-life
what sux is amxmodx half-life familiar peeps are not all gathered at this forum.
vamppa is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2013 , 11:53   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #16

Hook tripmine spawn, and recalculate offset m_vecEnd, which would be : origin + v_forward * valueYouWant.
__________________
Arkshine is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 12:27   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #17

This is what I came up with
PHP Code:
        static Floatorigin[3]
        static 
FloatvecEnd[3]
        static 
Floatneworigin[3]

        
pev(entpev_originorigin)
        
pev(entpev_originneworigin)
        
angle_vector(originANGLEVECTOR_FORWARDneworigin)

        
vecEnd[0] = origin[0] + neworigin[0] * 4000.0
        vecEnd
[1] = origin[1] + neworigin[1] * 4000.0
        vecEnd
[2] = origin[2] + neworigin[2] * 4000.0

        set_pdata_float
(entm_vecEnd_xvecEnd[0], XO_PLAYER)
        
set_pdata_float(entm_vecEnd_yvecEnd[1], XO_PLAYER)
        
set_pdata_float(entm_vecEnd_zvecEnd[2], XO_PLAYER
and the result ingame:
Attached Thumbnails
Click image for larger version

Name:	bounce--07082013-002610.jpg
Views:	139
Size:	60.4 KB
ID:	123850  
kNowo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2013 , 12:34   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #18

You don't have to anglevector and such.

m_end is calculated at the end of Spawn().

You have just to do : m_vecEnd = pev->origin + m_vecDir * 2048;

m_vecDir is gpGlobals->v_forward.

Just use :

new Float:dir[3];
global_get( glb_v_forward, dir );

vecEnd[0] = origin[0] + dir [0] * 4000.0
vecEnd[1] = origin[1] + dir [1] * 4000.0
vecEnd[2] = origin[2] + dir [2] * 4000.0

Make sure to hook as POST.
__________________

Last edited by Arkshine; 08-06-2013 at 12:40.
Arkshine is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 13:06   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #19

Worked great except for one thing: visually, the beam is shorter than default length ( 2048 ) but it is actually is 4000 unit length (i stand 3000 units away from it and it detects me touching the beam and it exploded). So I think we need to redraw/recalculate the beam somehow. If so, how do I do it?

EDIT: edit smiley (204

Last edited by kNowo; 08-06-2013 at 13:08.
kNowo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2013 , 13:26   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #20

Yes, in MakeBeam. That's something you see in HLSDK.

> Vector vecTmpEnd = pev->origin + m_vecDir * 2048 * m_flBeamLength;
...
> m_pBeam->PointEntInit( vecTmpEnd, entindex() );

MakeBeam() is called from PowerupThink(), before sound is played.

One solution could be the following :
  1. Hooking "weapons/mine_activate.wav" sound with FM_EmitSound
  2. Recalculating vecTmpEnd,
  3. Re-doing the whole PointEntInit()
It should work.
Check HLSDK to see what code to use.


As alternative method, if you use Orpheu, you could apply a memory patch to replace 2048 by value you want. If would be needed to be done one time.
__________________

Last edited by Arkshine; 08-06-2013 at 13:28.
Arkshine 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:14.


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