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

need a little traceline help...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
diamond-optic
Veteran Member
Join Date: May 2005
Old 12-17-2009 , 00:18   need a little traceline help...
Reply With Quote #1

well im working on a shotgun plugin for dod.. its basically working great, but im having a few issues that my small brain cant figure out...

basically with the firing of the pellets, im doing tracelines for each one to check for hits and for the most part this works great. Except.. The higher or lower the player aims, the less 'spread' there is left and right (when looking straight down from high up (or looking straight up) there is basically no spread from left to right so they end up hitting in a straight line up and down)

its probably just the math or something, im not really sure.. This function isnt originally my code so im not exactly sure on whats totally going on at all points during this function.. i have a feeling it might be related to the global_get( glb_v_forward, fwd ) native, but ive messed around with all sorts of stuff and cant seem to figure it out

so here's the function:

Code:
#define WPN_PELLETS 16 #define WPN_RANGE   2000.0 #define WPN_SPREAD  5.0 #define WPN_COF  2.0 #define WPN_COFMOVING   3.0 #define WPN_COFCROUCH   1.5 //called with this: // Get COF Offset new Float:offset[3]; pev( id, pev_v_angle, offset ); // set default cof and get speed new Float:velocity[3], Float:cof = WPN_COF; pev( id, pev_velocity, velocity ); // check conditions if( button & IN_DUCK || dod_get_pronestate(id) )  //If crouched or prone..     cof = WPN_COFCROUCH; else if( velocity[0] || velocity[1] || velocity[2] )  //else if standing and moving...     cof = WPN_COFMOVING;     offset[0] += random_float( cof, (cof * -1.0) ); offset[1] += random_float( cof, (cof * -1.0) ); new Float:start[3], Float:view_ofs[3]; pev( id, pev_origin, start ); pev( id, pev_view_ofs, view_ofs ); xs_vec_add( start, view_ofs, start );        for( new i; i < WPN_PELLETS; i++ )     {     shoot_pellet( id, offset, start );     } /////////////////////////////////////////////////////// shoot_pellet( id, Float:offset[3], Float:start[3] ) {        new Float:dest[3];     xs_vec_copy( offset, dest );         dest[0] += random_float( WPN_SPREAD, (WPN_SPREAD* -1.0) );     dest[1] += random_float( WPN_SPREAD, (WPN_SPREAD* -1.0) );         engfunc( EngFunc_MakeVectors, dest );         new Float:fwd[3];     global_get( glb_v_forward, fwd );     xs_vec_mul_scalar( fwd, WPN_RANGE, dest );     xs_vec_add( start, dest, dest );         new Float:end[3]; //,player;     traceline( start, dest, id, end );         //traceline is another function that calls the EngFunc_TraceLine and handles giving out damage and such... all of which works fine }


any ideas how to make it so the spread stays somewhat constant no matter what the pitch angle is? (so its the same when looking straight down as it is when looking straight ahead... and everywhere in between)
__________________

Last edited by diamond-optic; 12-17-2009 at 03:10.
diamond-optic is offline
skyler814
New Member
Join Date: Feb 2010
Old 02-13-2010 , 23:04   Re: need a little traceline help...
Reply With Quote #2

i need some help i saw were you got this and contacted many pople to try and get some help with it but know one will help me get it working can any one help me get the shotgun plugin working heres a link


http://www.dodplugins.net/forums/showthread.php?t=1826
skyler814 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 21:28.


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