HE knockback plugin, mathematics help...
Code:
This was my idea back in the AMX mod days when it "couldn't be done"...now I've made it...but the calculation is messed up. Seems HE's only send you 1 direction based on where you are on the map. Would anyone mind taking a look at this and telling me what kind of calculation I gotta do to send the user in the correct direction?...and possibly even set up a variable on how strong the effect is? |
if you're having problems catching the grenade id in the damage event, one alternative you could use is the TE_EXPLOSION tempent. Grenades (and their explosion origins) are easily catchable with the SVC_TEMPENTITY event (event "23"), and if you have an origin of the explosion, you can get distance and a vector velocity to send the player(s) to.
here's some code to help you along.. Code:
now you would need to check if the player(s) were damaged first, so it might be a good idea to store this origin in a global var and wait until the damage event before actually moving the players. and speaking of which, here's a couple stocks i wrote that will help you in determining the velocity (kickback) to give the player(s) damaged. Code:
you would really only need to use the set_velocity_from_origin() function, so let me outline the parameters a bit.. 1) ent - this is the player entity that you are pushing (kicking back) 2) fOrigin - this is the origin of the grenade explosion 3) fSpeed - this is how fast you want to push the player backwards (linear). this is required to get the vector speed (velocity) that will be used to force the player back. one way to get this is to make some kind of calculation as to how far the player is from the grenade explosion, the closer (or higher damage taken), the more speed given, etc... for example, if you wanted the player to move 5 velocity per point of damage, it's as simple as doing 5 * iDamage. etc etc. i can't wait to see this plugin in action :) |
the plugin works fine man. Appropriately checks damage, everything.
My problem is, the coords it gives when it damages a player, doesn't send them in the OPPOSITE direction that I need them to. -- I think what I need to do, is take gren origin minus player origin, and send them in to THAT vector...or find the difference of the gren and player origin and add it onto the player origin. Not sure yet. Basically, we'll be able to conc jump in CS =D THANKS for the help tho, I'll be working on it tomarrow morning when my girlfriend calls |
if you didnt even read the 2nd half of my post, then you missed the major point of it..
i gave you a couple stocks you can use to send the player away from the grenade.. you're having a problem with them going in the opposite direction? these will push them in the correct direction.. even if you dont need to use the stock for face value, all the coding you need is in there to project the player away from something. |
Yea, I noticed that after I posted. :roll:
Thanks for the stocks. VERY HELPFUL... |
|
woot !
|
The cool thing is you can set it to a negative number he_push to like -30, and it acts like a gravity 'nade...I found it quite fun.
|
| All times are GMT -4. The time now is 17:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.