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

[Help] beam entity.


Post New Thread Reply   
 
Thread Tools Display Modes
DarthMan
Veteran Member
Join Date: Aug 2011
Old 12-06-2018 , 05:02   Re: [Help] beam entity.
Reply With Quote #11

Quote:
Originally Posted by JocAnis View Post
By doing just that i dont think you would know if you need to change x or y axis.. Maybe something to do with vectors, velocity.. Idk but i would like to know too, in which way to do that
Yes,in this case, I guess, ANGLEVECTOR_RIGHT is the way to go, then turning it into left by making the z, y and z values negative, then using xs_vec_mul_scalar.
DarthMan is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-06-2018 , 05:11   Re: [Help] beam entity.
Reply With Quote #12

This should work. The result will be in dotOrigin.
Code:
new Float:tripmineAngles[3];
new Float:directionVector[3];
new Float:dotOrigin[3]
pev(tripmineEntity, pev_angles, tripmineAngles);
angle_vector(tripmineAngles, ANGLEVECTOR_FORWARD, directionVector);
xs_vec_mul_scalar(directionVector, 10.0, directionVector); // 10.0 is the distance
xs_vec_add(tripmineOrigin, directionVector, dotOrigin);
__________________

Last edited by klippy; 12-06-2018 at 05:13.
klippy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-06-2018 , 06:08   Re: [Help] beam entity.
Reply With Quote #13

@KliPPy
Not yet!
the full function :
PHP Code:
public Tripmine_Think_Post(ent)
{
    static 
FloatflTime;
    if (!
pev_valid(ent) || !pev(entTRIPMINE_LASER) || get_pdata_float(entm_flPowerUpextraoffset_linux) > (flTime get_gametime()))
        return 
HAM_IGNORED;
    
    
set_pev(entpev_nextthinkflTime 0.05);
    
    static 
beambeam get_pdata_cbase(entm_pBeamextraoffset_linux);
    if (!
pev_valid(beam)) return HAM_IGNORED;
    
    if (!
pev(entTRIPMINE_BEAM))
    {
        
        new 
Floatrgb[3];
        
GetBeamColor(rgb,1);
        
        
set_pev(beampev_rendercolorrgb);
        
set_pev(beampev_scaleget_pcvar_float(pcvar_lasermine_laser_width));
        
set_pev(beampev_bodyget_pcvar_num(pcvar_lasermine_laser_noise));
        
set_pev(beampev_renderamtget_pcvar_float(pcvar_lasermine_laser_bright));

        
set_pev(entTRIPMINE_BEAM1);
    }
    
    static 
FloatvecEnd[3];
    static 
Floatorigin[3];
    static 
Floatfraction;
    static 
Floatdamage;
    
    static 
ptrpHit;
    
    
pev(entpev_originorigin);
    
pev(entpev_dmgdamage);
    
    
origin[1] -= 10.0
    
    vecEnd
[0] = get_pdata_float(entm_vecEnd_xextraoffset_linux);
    
vecEnd[1] = get_pdata_float(entm_vecEnd_yextraoffset_linux);
    
vecEnd[2] = get_pdata_float(entm_vecEnd_zextraoffset_linux);
    
    
ptr create_tr2();

    
engfunc(EngFunc_TraceLineoriginvecEndDONT_IGNORE_MONSTERSentptr);
    
    
get_tr2(ptrTR_vecEndPosvecEnd);
    
get_tr2(ptrTR_flFractionfraction);

    
pHit get_tr2(ptrTR_pHit);
    if (
fraction 1.0)
    {
        
get_tr2(ptrTR_vecEndPosvecEnd);
        
        if (
pev_valid(pHit) && get_user_team(pHit) != get_user_team(pev(entTRIPMINE_OWNER)) )
        {
            
            if(
pev(entTRIPMINE_LASER)==1)
            {
                static 
FloatBloodDelay
                
pev(entTRIPMINE_BLOOD_DELAYBloodDelay);
                
                if (
BloodDelay  flTime// Say no to "Overflow 500 temporary ents" :D
                
{
                    
                    
set_pev(entTRIPMINE_BLOOD_DELAYflTime 0.1);
                    
UTIL_MakeBlood(vecEnddamagepHit);
                }
                
ExecuteHamB(Ham_TakeDamagepHitentpev(entTRIPMINE_OWNER), damageDMG_ENERGYBEAM DMG_ALWAYSGIB);
            }
        }
    }
    
    
free_tr2(ptr);
    
    static 
FloatfractionOld
    
pev(entTRIPMINE_FRACTION_OLDfractionOld);
    
    
entity_set_int(ent,EV_INT_solid,SOLID_BBOX)
    
entity_set_float(ent,EV_FL_takedamage,DAMAGE_YES)
    
entity_set_float(ent,EV_FL_dmg,100.0)
    
entity_set_float(ent,EV_FL_health30.0)
    
    static 
Float:flLifeTime;
    
pev(entpev_fuser4flLifeTime);
    
    if (
fractionOld != fraction)
    {
            
            
        new 
entity create_entity("info_target")
    
            
        
entity_set_stringentityEV_SZ_classname"dot_glow" );
        
entity_set_model(entity"sprites/glow02.spr")
        
entity_set_intentityEV_INT_solidSOLID_TRIGGER );
        
set_pev(entitypev_renderfxkRenderFxNone)
        
set_pev(entitypev_rendermodekRenderTransAdd)
        
set_pev(entitypev_renderamt255.0)
        
set_pev(entitypev_rendercolorFloat:{255.00.00.0}) 
        
set_pev(entitypev_scale0.19)
            
        
/*static Float:norigin[3];
        static Float:vangles[3];

        pev(ent, pev_v_angle, vangles)
        set_pev(entity, pev_v_angle, vangles)*/
        
        
new Float:tripmineAngles[3];
        new 
Float:directionVector[3];
        new 
Float:dotOrigin[3]
        
        
pev(entpev_anglestripmineAngles);// ent = tripmineEntity
        
        /*engfunc( EngFunc_MakeVectors, tripmineAngles )
        global_get( glb_v_forward, tripmineAngles )*/
        
        
angle_vector(tripmineAnglesANGLEVECTOR_FORWARDdirectionVector);
        
xs_vec_mul_scalar(directionVector10.0directionVector); // 10.0 is the distance
        
xs_vec_add(origindirectionVectordotOrigin);//origin = tripmineOrigin
        
        
engfunc(EngFunc_SetOriginentitydotOrigin);
            

        
RelinkBeam(beamvecEndvecEndorigin);
        
        
set_pev(entTRIPMINE_FRACTION_OLDfraction);
        
    }
    return 
HAM_IGNORED;   

the result:
https://imgur.com/E1QviIA
Each corner appears in a different origin beside the tripmine. (the same result in my first code) :==(
__________________

Last edited by abdobiskra; 12-06-2018 at 06:10.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-06-2018 , 06:50   Re: [Help] beam entity.
Reply With Quote #14

You still have this line in your code:
Code:
origin[1] -= 10.0
__________________
klippy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-06-2018 , 07:13   Re: [Help] beam entity.
Reply With Quote #15

Quote:
Originally Posted by KliPPy View Post
You still have this line in your code:
Code:
origin[1] -= 10.0
Yes, I have completely forgotten him
Now work in all directions .. except at (UP/Down)
https://imgur.com/r3kIvIf
__________________

Last edited by abdobiskra; 12-06-2018 at 07:14.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-06-2018 , 07:19   Re: [Help] beam entity.
Reply With Quote #16

Not exactly sure why. Try with
Code:
dotOrigin[2] -= dotOrigin[2];
before the code I preivously posted. If that doesn't work try with pev_v_angle instead of pev_angles.
__________________

Last edited by klippy; 12-06-2018 at 07:19.
klippy is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-06-2018 , 07:40   Re: [Help] beam entity.
Reply With Quote #17

Unfortunately both methods do not work.
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
JocAnis
Veteran Member
Join Date: Jun 2010
Old 12-06-2018 , 08:04   Re: [Help] beam entity.
Reply With Quote #18

maybe it has something to do with ANGLEVECTOR_UP ?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-06-2018 , 08:29   Re: [Help] beam entity.
Reply With Quote #19

Quote:
Originally Posted by JocAnis View Post
maybe it has something to do with ANGLEVECTOR_UP ?
not exactly.
btw, othere result when i test :
https://imgur.com/a/JbmECgX
It is intractable.
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 12-07-2018 , 02:53   Re: [Help] beam entity.
Reply With Quote #20

fixed :
PHP Code:
        angles_fix[0] += 360.0 tripmineAngles[0]
        
angles_fix[1] += tripmineAngles[1]
        
angles_fix[2] += tripmineAngles[2
NOw i want know how to make beam fadout like beam fllow in TEMPENTITY.
im wonder if i need for that : m_flBeamLength or calculate ?
Quote:
m_vecEnd_x = 170,
m_vecEnd_y = 171,
m_vecEnd_z = 172,
__________________

Last edited by abdobiskra; 12-07-2018 at 02:55.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
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 01:41.


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