[Info] About bullet/particle power change

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1229
Gender:
United States of America

[Info] About bullet/particle power change

Post by Archive-Poster »

Note #1: This information probably will not make much sence if you unfamiliar with the trace scripting.

I found the way to change a bullet/particle power directly through fraction traceresult. The problem is that the [power | fraction] dependence are nonlinear.

This is a table for AWP TA leg damage:

Code: Select all

 F          D  
---------------
 0.0        30 
 0.1        29 
 0.3        28 
 0.5        27 
 0.7        26 
 0.9        25 
 1.1        24 
 1.4        23 
 1.7        22 
 2.0        21 
 2.3        20 
 2.6        19 
 2.8        18 
 3.2        17 
 3.5        16 
 3.9        15 
 4.2        14 
 4.6        13 
 5.1        12 
 5.6        11 
 6.2        10 
 6.6         9 
 7.3         8 
 8.0         7 
 8.9         6 
 9.8         5 
10.7         4 
12.0         3 
13.8         2 
16.2         1 
20.4         0
Note #2: For fraction in range {0.0 ... ~5.0} the dependence are nearly linear.

Note #3: Also you can use a negative fraction values to increase power.
User avatar
Archive-Poster
Posts: 1229
Gender:
United States of America

Re: [Info] About bullet/particle power change

Post by Archive-Poster »

This is very interesting. Are the fractions in the table the same with other weapons?

The TR_flFraction value.

This is what im trying to do. Block the damage but still have the effect of getting shot.

Code: Select all

new hitplace = get_tr(TR_iHitgroup)
if(hitplace == HIT_CHEST || hitplace == HIT_STOMACH)
{
set_tr(TR_flFraction, 30.0)
}
Because using 1.0 it seems like you didnt even get hit.
User avatar
Archive-Poster
Posts: 1229
Gender:
United States of America

Re: [Info] About bullet/particle power change

Post by Archive-Poster »

Quick question, what is TR_flFraction (and the other stuff for that matter). I haven't had much experience with trace_line() and would appreciate a quick explanation ;).
User avatar
Archive-Poster
Posts: 1229
Gender:
United States of America

Re: [Info] About bullet/particle power change

Post by Archive-Poster »

It's a trace result data member. Probably represents a tracing time in some units. To reproduce hit effect without any damage you can set it to high value for example to 100.0.
flFraction is a variable within this TraceResult structure that tells you how far the trace went before it hit something. For example if you are tracing between 2 points that are 100 units apart and TraceLine returns with flFraction = 0.75 then you know that 3/4 of the way from the start point to the end point something was in the way.
So, the reason that all TraceLine codes assume that you didn't hit anything if flFraction is 1.0, is because that means that the trace made it 100% of the way before hitting anything (aka, it never hit anything).
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest