Raised This Month: $ Target: $400
 0% 

Help with a fragmentation grenade


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jballou
Member
Join Date: Jul 2013
Old 10-03-2015 , 03:20   Help with a fragmentation grenade
Reply With Quote #1

I'm working on a mod for Insurgency that tweaks the grenades, I want to add a fragmentation effect that can hit people with fragments further than the explosion radius reaches. The way I think I'd like to implement it is to basically fire a number of "bullets" to act as fragments from the grenade in random directions. I'd like it to be a little smart so if the grenade is on a floor, it shoots a majority of the fragments up and out rather than into the ground, if for no other reason than shrinking the number of fragments I'm creating.

The distance from the grenade to the target will determine the amount of damage taken by the fragment, for example 100 at 1 meter and 20 at 10 meters. Ideally, I'd like to shoot 20-30 fragments, so I'm hoping this won't be too computationally intensive. I don't really have a preference as to using missiles and tiny fragment models or just using tracerays, my guess is traces will be less obnoxious than having to send a bunch of entity data.

I have been searching for a couple hours and didn't find anything like this, I'd appreciate a pointer at something I can use as a baseline if I'm just missing it. If not, I'd welcome any suggestions for the best ways to implement this, I can probably muddle through and get something working but I think this needs someone a little more experienced than me to implement properly.

Thanks for reading!
jballou is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 10-03-2015 , 09:42   Re: Help with a fragmentation grenade
Reply With Quote #2

I'd recommend tracking the grenade entity and using the TR_TraceRayFilter with different directions and set it so that it can only find players with the filter. You could make the directions semi-intelligent by having two different random generators based on if the grenade is touching the ground or not. If you do happen to find a hit with the ray then you'll need to check the distance before you call SDKHook_TakeDamage on that player. You should play around with the number of 'fragments' to see what causes lag for the server. Sounds fun though! Report back results.
__________________
databomb 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 10:39.


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