impact-sensitive grenades


(jamez) #1

i guess this would fall under “panzer” type weapon, but a rifle that could shoot off a lot of smoke where it lands, or fake fire etc
or for those people thinking about making urban-gameplay type mods a molotov cocktail

but all i really would like to know is how u could check for a bounce with a grenade


(jamez) #2

ok sorry to bother people but i think i found it here

bolt->s.eFlags = EF_BOUNCE_HALF | EF_BOUNCE;

im guessing if u take them out

bolt->s.eFlags = 0;

it will make the grenade ‘think’ when it impacts (explode)


(Seph64) #3

Close not quite though, if you want a grenades that explodes something on impact, change the EF_BOUNCE to ET_MISSILE, you juat had to take a look at the WP_PANZERFAUST code, since that explodes on impact.


(digibob) #4

EF_ stuff is not the same as ET_ stuff, so don’t do that.

EF = Entity Flags
ET = Entity Type

Grenades are already ET_MISSILEs.


(bacon) #5

You forgot the think. Change it so it looks like this:

				bolt->s.eFlags				= 0;
				bolt->think					= G_ExplodeMissile;

It’ll explode the grenade as soon it hits anything


(Seph64) #6

I don’t know enough about how Wolfenstein’s version of the Quake 3 engine does things, so I’ll just agree with you for now. :slight_smile:


(Pamper) #7

FYI, in WWII the Allies really did have grenades that went off when they hit something. They’re called Gammon Grenades, read about them here:
http://www.thedropzone.org/artifacts/weapons.html


(jamez) #8

hey bacon, incase u didnt know grenades already are set to explode when they think, and
seph what are u talking about?

bolt->s.eType= ET_MISSILE; i agree with this

bolt->s.eFlags= ET_MISSILE; u told me to do this?


(jamez) #9

i finally got around to testing this mod, turns out the grenade falls through the ground, what needs to be enabled for a collision to happen normally (where does it check for EF_BOUNCE?)


(jamez) #10

ok, i found the bounce code just put this:

if {!Q_stricmp(ent->classname,"<classname of grenade here>")){
G_ExplodeMissile(ent);
return;
}

under this:

if ( ( !other->takedamage || !ent->damage ) && ( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) )

in g_missle.c

this will


(jamez) #11

argh, this will make the explode func trigger as it normally would when there is an impact of a nade of ur choice, nothing else needs to be changed


(bacon) #12

My code works perfectly and it’s less coding…


(jamez) #13

bacon i wasnt just talking about normal nades, smoke nades will fall through the ground unless u enable the bounce.


(bacon) #14

Why would you want smoke grenades to explode? That kinda defeats their purpose IMO


(jamez) #15

no not explode but more go off, also if u did something like set the parent to whatever it collides with then every time it thinks before it releases gas, change position to the entity and u could have a sticky nade