AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Traceline is acting weird again... (https://forums.alliedmods.net/showthread.php?t=242681)

.Dare Devil. 06-23-2014 01:51

Traceline is acting weird again...
 
Hello alliedmodders!



PHP Code:

stock zn_cameramodeidstatus )
{
    if( 
status )
    {
        if( !
is_valid_ent(zn_cament[id]) )
        {
            static 
Float:o[3]
            
pevidpev_origin)
            
zn_cament[id] = create_entity("info_target")
            
            
set_pevzn_cament[id], pev_classname"camera" )
            
            
cfg_string(cfg_animations0temp263 )
            
formattemp1100"models/player/%s/%s.mdl"temp2temp2 )
            if(
zn_animmdl_index_bset_pevzn_cament[id], pev_bodyzn_intzn_animmdl_index_b) )
            
entity_set_model(zn_cament[id], temp1)
            
dllfunc(DLLFunc_Spawnzn_cament[id])
            
set_pev(zn_cament[id], pev_solidSOLID_NOT)
            
set_pev(zn_cament[id], pev_movetypeMOVETYPE_FOLLOW)
            
entity_set_origin(zn_cament[id], o)
            
entity_set_size(zn_cament[id], Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.03.03.0 } )
            
set_pevzn_cament[id], pev_team159 )
            
attach_view(idzn_cament[id])
            
set_pevzn_cament[id], pev_nextthinkget_gametime() + 0.01 )
            
set_pevzn_cament[id], pev_ownerid )
            
        }
    }
    else
    {
        
attach_view(idid)
        if(
is_valid_ent(zn_cament[id])) remove_entity(zn_cament[id])
        
zn_cament[id] = 0
        
    
}
}

public 
zn_camthink(ent)
{
    if( !
is_valid_ent(ent) ) return HAM_IGNORED
    
static id
    id 
peventpev_owner )
    if( 
peventpev_team ) != 159 ) return HAM_IGNORED
    
if( !is_user_connected(id) ) 
    {
        
remove_entity(ent)
        
zn_cament[id] = 0
        
return HAM_SUPERCEDE
    
}
    static 
Float:o[3], Float:o2[3], Float:a[3]
    
pevidpev_origin)
    
pevidpev_v_angle)
    
a[1] += 180.0
    
if( a[1] > 360.0 a[1] -= 360.0
    a
[0] *= -1.0
    zn_velocity_by_angle
a100.0o2)
    
o2[0] += o[0
    
o2[1] += o[1
    
o2[2] += o[2]
    
engfuncEngFunc_TraceLineoo2IGNORE_MONSTERS0);
    
// engfunc(EngFunc_TraceHull, o, o, DONT_IGNORE_MONSTERS, HULL_HEAD, 0, 0)
    
get_tr20TR_vecEndPos)
    
// o[0] -= o2[0] * 0.95
    // o[1] -= o2[1] * 0.95
    // o[2] -= o2[2] * 0.95
    
set_peventpev_origin)
    
pevidpev_v_angle)
    
set_peventpev_angles)
    
// set_pev( id, pev_angles, Float:{0.0, 0.0, 0.0} )
    
    
set_peventpev_nextthinkget_gametime() + 0.01 )
    return 
HAM_IGNORED
}

stock zn_velocity_by_angleFloat:a[3], Float:bFloat:c[3]) 
{
    static 
Float:d
    engfunc
(EngFunc_MakeVectorsa)
    
global_get(glb_v_forwardc)
    
vector_length(c)
    
c[0] *= (d); c[1] *= (d); c[2] *= (d)


What im doing wrong here i dont understand?
Why tracelines dont like me? :)

Edit:
It is doing same thing on de_dust2 if you think that the map is the problem here.

Arkshine 06-23-2014 03:07

Re: Traceline is acting weird again...
 
Why do you want to reinvent the wheel?

https://forums.alliedmods.net/showthread.php?t=65427
https://forums.alliedmods.net/showpo...0&postcount=29

.Dare Devil. 06-23-2014 03:27

Re: Traceline is acting weird again...
 
The problem is that old wheel dont want to work fine in linux.
When player model have blank or 1 triangle bodypart, set_view crash my server.
I need to sometimes use fake model entity what i attach to player by pev_aiment.
That way i can use player models with no animations meaning that i can have only one model with animation and the ohter one without. That means the player model size is much more better.

I need to hide the model original player model but setting render value 0 so it will be invisible will be bad idea because it will still take the same amount of cpu. Basically it would mean that im rendering player with 2 models.

https://forums.alliedmods.net/showpo...0&postcount=29
This will be also a bad idea because camera can go through the walls
Same with this: https://forums.alliedmods.net/showthread.php?t=65427

The last thing i want is player to see inside the walls.
I always hide secred spots inside the walls.

georgik57 06-23-2014 05:13

Re: Traceline is acting weird again...
 
Quote:

Originally Posted by Arkshine (Post 2155969)

Quote:

Originally Posted by georgik57 (Post 1454415)
I found 4 bugs on this
1. When shooting, the bullets don't go out of the weapon model attached to the player, but from the right side of the screen
http://forums.alliedmods.net/attachm...1&d=1303337246

2. Entities attached to the player model can't be seen when the player is using 3rd person mode
http://forums.alliedmods.net/attachm...1&d=1303337233
It should be like in this video: http://www.youtube.com/user/schmurge.../1/zvsRYYXh-eQ

3. -SNIP- Not a bug.

4. If the camera goes outside the map(like in water or something) it won't chase the player anymore. Will make a video about this if you guys are interested on fixing the plug-in and can't understand what I'm trying to say.

And a little suggestion:
Make a custom transparency changeable by a cvar. Not being able to see through your model is quite annoying...

Note that problem #4 can crash the server. Tested not much time ago.

Quote:

Originally Posted by georgik57 (Post 1454605)
5. The camera sometimes moves by itself o_O. I mean, it shakes, and the mouse isn't moving and it isn't because of the sensor...

So yea, this wheel should be at least fixed if not reinvented.

I also tested Connor's last posted code from that thread and it has the same problems: https://forums.alliedmods.net/showpo...5&postcount=51

meTaLiCroSS 06-24-2014 00:08

Re: Traceline is acting weird again...
 
Try with
PHP Code:

//engfunc( EngFunc_TraceLine, o, o2, IGNORE_MONSTERS, 0, 0 );
engfuncEngFunc_TraceLineoo2IGNORE_MONSTERSid); 

And *not really a fix* try to create your own tracehandle

.Dare Devil. 06-24-2014 23:42

Re: Traceline is acting weird again...
 
PHP Code:

public zn_camthink(ent)
{
    if( !
is_valid_ent(ent) ) return HAM_IGNORED
    
static id
    id 
peventpev_owner )
    if( 
peventpev_team ) != 159 ) return HAM_IGNORED
    
if( !is_user_connected(id) ) 
    {
        
remove_entity(ent)
        
zn_cament[id] = 0
        
return HAM_SUPERCEDE
    
}
    static 
Float:o[3], Float:o2[3], Float:a[3]
    
pevidpev_origin)
    
pevidpev_v_angle)
    
a[1] += 180.0
    
if( a[1] > 360.0 a[1] -= 360.0
    a
[0] *= -1.0
    zn_velocity_by_angle
a100.0o2)
    
o2[0] += o[0
    
o2[1] += o[1
    
o2[2] += o[2]
    static 
tr
    tr 
create_tr2();
    
engfuncEngFunc_TraceLineoo2IGNORE_MONSTERSidtr );
    
// engfunc(EngFunc_TraceHull, o, o, DONT_IGNORE_MONSTERS, HULL_HEAD, 0, 0)
    
get_tr2trTR_vecEndPos)
    
// o[0] -= o2[0] * 0.95
    // o[1] -= o2[1] * 0.95
    // o[2] -= o2[2] * 0.95
    
set_peventpev_origin)
    
pevidpev_v_angle)
    
set_peventpev_angles)
    
// set_pev( id, pev_angles, Float:{0.0, 0.0, 0.0} )
    
    
set_peventpev_nextthinkget_gametime() + 0.01 )
    return 
HAM_IGNORED


still same

meTaLiCroSS 06-25-2014 13:36

Re: Traceline is acting weird again...
 
Use free_tr2 also (not related).

Make sure the entity is thinking, put a print_center output with the gametime

Nextra 06-25-2014 16:00

Re: Traceline is acting weird again...
 
We either need some good debugging info by you or a working test plugin that exhibits the same error. This looks like it is very difficult to debug from just looking at the code.


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

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