AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Gunshot smoke( wall puff) (https://forums.alliedmods.net/showthread.php?t=187943)

tei1995 06-20-2012 06:12

Gunshot smoke( wall puff)
 
How can i calculate angle, velocity, smoke when the bullet hit wall?
Can i use TE_MODEL to create the sprite?

Hyper Nova 06-20-2012 13:36

Re: Gunshot smoke( wall puff)
 
explain more please.

I dont understand how the smoke must be, mayby give picture or something?
if you want to change angle, velocity and such stuff then you need to create new entity.

<VeCo> 06-20-2012 13:41

Re: Gunshot smoke( wall puff)
 
Hook Ham_TraceAttack and get the hit point with get_tr2 TR_vecEndPos.

tei1995 06-20-2012 22:15

Re: Gunshot smoke( wall puff)
 
I know that, but i want create smoke at the point when bullet hit something not human.
Of course,TE_SPRITE cant be used in this case.

GordonFreeman (RU) 06-20-2012 22:39

Re: Gunshot smoke( wall puff)
 
get_user_aimning(id,victim,bh) - if 0<victim<=get_max_players() then is not human
get_user_origin(id,origin,3) - aim pos

tei1995 06-21-2012 00:45

Re: Gunshot smoke( wall puff)
 
Men, i want to create smoke, not get aim origin.

GordonFreeman (RU) 06-21-2012 01:47

Re: Gunshot smoke( wall puff)
 
create smoke at aim origin (problem?)

tei1995 06-21-2012 05:32

Re: Gunshot smoke( wall puff)
 
No,create smoke at bullet hit point. Use TraceAttack to get the endposition.
My english suck!

GordonFreeman (RU) 06-21-2012 05:48

Re: Gunshot smoke( wall puff)
 
to calculate angle you can use my method in http://forums.alliedmods.net/showthread.php?t=183454
PHP Code:

public spawn_something(ent,type){
    new 
model
    
    
new Float:mins[3]
    new 
Float:maxs[3]
    new 
i
    
    
new trace
    
new Float:ground_trace[3]
    
    static 
charger_model
    
    enum 
{_Trace_Length_ 10.0};
    
    new const 
Float:g_vectors[][] ={
        {
0.00.0Float:_Trace_Length_},
        {
0.00.0, -Float:_Trace_Length_},
        {
0.0Float:_Trace_Length_0.0},
        {
0.0, -Float:_Trace_Length_0.0},
        {
Float:_Trace_Length_0.00.0},
        {-
Float:_Trace_Length_0.00.0}
    }
    
    if(
pev_valid(ent) && ((charger_model || (charger_model engfunc(EngFunc_AllocString"info_target"))) && pev_valid((model engfunc(EngFunc_CreateNamedEntitycharger_model))))){
            
pev(entpev_minsmins)
            
pev(entpev_maxsmaxs)
            
            
xs_vec_add(minsmaxsmaxs)
            
xs_vec_mul_scalar(maxs0.5maxs)
            
            
set_pev(entpev_effectsEF_NODRAW)
            
            
engfunc(EngFunc_SetModel,model,type?hp_model:ap_model)
            
dllfunc(DLLFunc_Spawn,model)
            
            
set_pev(modelpev_solidSOLID_NOT)
            
set_pev(modelpev_takedamageDAMAGE_NO)
            
set_pev(modelpev_movetypeMOVETYPE_NOCLIP)
            
set_pev(modelpev_classname,type?"hp_model":"ap_model")
            
            do{
                if(
<< << (sizeof g_vectors))
                    break
                
                
xs_vec_sub(maxsg_vectors[i], ground_trace)
                
engfunc(EngFunc_TraceLine,maxsground_traceIGNORE_MONSTERS IGNORE_MISSILEenttrace)
                
get_tr2(traceTR_vecPlaneNormalground_trace)
                
                
i++
            }
            while(!(
ground_trace[2] || ground_trace[1] || ground_trace[0]));--i
            
            set_ent_angles_expert
(model,ground_trace,maxs)
            
i=0
            
            
return model
    
}
    
    return 
0
}

set_ent_angles_expert(&iEnt, const Float:ground_angle[], const Float:origin[]){
    new 
Float:real_angles[3]

    
xs_vec_mul_scalar(ground_angle, -1.0real_angles)
    
vector_to_angle(real_anglesreal_angles)

    
real_angles[1] += 180.0
    
    set_pev
(iEntpev_originorigin)
    
set_pev(iEntpev_anglesreal_angles)


create enitity and start traceline to then by spining right now.

tei1995 06-22-2012 09:13

Re: Gunshot smoke( wall puff)
 
I'm not sure about this calculate...
Do you have c++ code of wallpuff?


All times are GMT -4. The time now is 06:19.

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