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

Change the laser beam of tripmine (Half-Life)


Post New Thread Reply   
 
Thread Tools Display Modes
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 13:44   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #21

EDIT2:
Im using this now:

PHP Code:
public fw_EmitSound(entchannel, const sample[], Float:volumeFloat:attnflagspitch)
{
    if(
equali(sample"weapons/mine_activate.wav") && pev_valid(ent))
    {
        new 
Float:flOrigin[3]
        new 
Float:flVecEnd[3]

        
pev(entpev_originflOrigin)
        
flVecEnd[0] = get_pdata_float(entm_vecEnd_xXO_PLAYER)
        
flVecEnd[1] = get_pdata_float(entm_vecEnd_yXO_PLAYER)
        
flVecEnd[2] = get_pdata_float(entm_vecEnd_zXO_PLAYER)

        new 
beam
        beam 
get_pdata_cbase(ent176XO_PLAYER)

        if(
pev_valid(beam))
            
RelinkBeam(beamflVecEndflVecEndflOrigin)
    }
}

RelinkBeam(const beam, const FloatOrigin[3], const FloatstartPos[3], const FloatendPos[3])
{
    static 
Floatmins[3], Floatmaxs[3]

    
mins[0] = floatmin(startPos[0], endPos[0])
    
mins[1] = floatmin(startPos[1], endPos[1])
    
mins[2] = floatmin(startPos[2], endPos[2])

    
maxs[0] = floatmax(startPos[0], endPos[0])
    
maxs[1] = floatmax(startPos[1], endPos[1])
    
maxs[2] = floatmax(startPos[2], endPos[2])

    
xs_vec_sub(minsOriginmins)
    
xs_vec_sub(maxsOriginmaxs)

    
set_pev(beampev_minsmins)
    
set_pev(beampev_maxsmaxs)

    
engfunc(EngFunc_SetSizebeamminsmaxs)
    
engfunc(EngFunc_SetOriginbeamOrigin)

If you found anything that could be optimized, please tell me
Thanks.

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

I said the whole code, but it's was just the pev_origin, but since you relink after, I guess it's fine.

equal() is enough. You could also just checking some letters. Except that, not really.
__________________
Arkshine is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 15:44   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #23

Aha! you missed one thing: TR_vecEndPos
I need to traceline and get_tr2 TR_vecEndPos or else the beam will visually go through brushes/entities
kNowo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2013 , 16:07   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #24

Not sure what you mean, 2048 is used only 2 times.
__________________
Arkshine is offline
kNowo
Senior Member
Join Date: Apr 2011
Location: Malaysia
Old 08-06-2013 , 16:14   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #25

I am really bad at explaining things.

flVecEnd is 4000.0 units away from the tripmine, so when I relink the beam, it will relink (visually only) starting from the tripmine and go all the way 4000 units away. So, I traceline the endorigin (where it hits something) first, then relink from tripmine to the new endorigin.
kNowo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-06-2013 , 16:30   Re: Change the laser beam of tripmine (Half-Life)
Reply With Quote #26

I don't think I get what you say. The traceline before calculating "vecTmpEnd" uses m_vecEnd offset.
So just recalculating vecTmpEnd, and relinking with this new origin should be enough.
I don't think it's necessary, but you may need to set pev_origin before, as it's what does "SetStartPos".
__________________

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

I didn't recalculate vecTmpEnd. Maybe that's why the beam was piercing brushes and entities.

Last edited by kNowo; 08-06-2013 at 16:57.
kNowo 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 07:31.


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