Raised This Month: $ Target: $400
 0% 

Determine a grenades origin at explosion AND the owner


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-10-2006 , 12:18   Determine a grenades origin at explosion AND the owner
Reply With Quote #1

Is this possible?

I want to determine the origin of where the grenade explodes, but I also want to determine the owner and how much damage it dealt.

I could catch the effect that is thrown when it explodes, but then I can't query that ent ID (to get the owner) b/c it will have been destroyed.

Any ideas?

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
VEN
Veteran Member
Join Date: Jan 2005
Old 03-10-2006 , 13:09  
Reply With Quote #2

I do not see any problem here.
AFAIR, grenade entity exist at explosion.
I believe all what you asked is possible.
VEN is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 03-10-2006 , 13:18  
Reply With Quote #3

VEN: While he did only ask if it was possible, I think he was really asking how he would go about doing it.
Brad is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-10-2006 , 13:51  
Reply With Quote #4

Maybe hook the explosion sound with FM_EmitSound? Dunno
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-10-2006 , 16:14  
Reply With Quote #5

Well one thing I just thought of... The damage event also passes coords so that arrows can be drawn on the screen and indicate to the player which direction the damage came from.

I wonder if that coord would be the origin of the grenade explosion... I'm going to test this
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-10-2006 , 20:15  
Reply With Quote #6

counter-strike grenades are a mystery!

Code:
public plugin_init() {    register_think("grenade","think_grenade"); } public think_grenade(ent) {    new hack = get_pdata_int(ent,118);    new oldhack = entity_get_int(ent,EV_INT_iuser1);    if(hack && !oldhack) {       // here comes explosion    }    entity_set_int(ent,EV_INT_iuser1,hack); }

you'll have to filter out c4 from this (they are considered grenades), but other than that it should alert one "think" (< 0.1 second) before a grenade explodes. you should also be able to grab EV_ENT_owner as usual.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 03-10-2006 , 22:58  
Reply With Quote #7

Thanks, that will occur before the on_damage event right?

Also, how would I link the amount of damage done back to that function?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-10-2006 , 23:04  
Reply With Quote #8

it will occur before damage. you can't tell how much damage is done, all this does is hook right before the grenade explodes. offset 118 changes from 0 to 1 the think prior to explosion.
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
VEN
Veteran Member
Join Date: Jan 2005
Old 03-11-2006 , 07:35  
Reply With Quote #9

I believe that better catch the explosion sound as v3x said, because it indicates exact the moment of explosion.

Kraugh's method seems less precise since grenades thinks not instantly but with something like 0.1sec delay.

Here is grenades explosion sound list:
Code:
HE Grenade
  weapons/debris1.wav
  weapons/debris2.wav
  weapons/debris3.wav

Flashbang
  weapons/flashbang-1.wav
  weapons/flashbang-2.wav

Smoke Grenade
  weapons/sg_explode.wav
VEN is offline
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 03-11-2006 , 09:51  
Reply With Quote #10

Code:
register_message(23, "grenade_explosion"); public grenade_explosion() {     if(get_msg_arg_int(1) == 3 && get_msg_arg_int (6) == 25 && get_msg_arg_int (7) == 30)     {         new Float:pos[3];         pos[0] = get_msg_arg_float(2);         pos[1] = get_msg_arg_float(3);         pos[2] = get_msg_arg_float(4);         // Code...     } }
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
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 20:19.


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