Grenade Issues

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Grenade Issues

Postby Skwirl » Wed Apr 26, 2017 2:06 pm

So I found a weapon mod to at least give me an idea of how to program grenades. Turns out the Spawn: state needs to be prolonged to the amount of seconds I want.

Now, I have two problems...

1) I'm not getting a satisfying full-on explosion sound. Merely something that sounds like puffing air into the mic. It's not blowing up like my missile explosions can.

2) I'm showering the grenade I threw with tracer shots, and it absolutely will not blow up.

Here's the code. What did I do wrong?

Code: Select allExpand view
// Projectile
actor grenade_frag_p {
   Tag "grenade_frag_p"
   Damage 0
   Health 1
   Height 4
   Radius 2
   Speed 35
   Mass 5
   BounceFactor 0.3
   WallBounceFactor 0.25
   BounceCount 3
   +SHOOTABLE
   +NOBLOOD
   +DONTGIB
   +NOICEDEATH
   +FORCEXYBILLBOARD
   +VULNERABLE
   -NOGRAVITY
   -NOBLOCKMAP

   States {
      Spawn:
         BON2 A 175
         Goto Death
      Death:
         TNT1 A 0 A_Quake(5, 25, 0, 400)
         TNT1 A 1 Bright A_SpawnItemEx("GrenadeExplosion")
         Stop
   }
}


Code: Select allExpand view
/*

Effect - Grenade Explosion

The effect that happens when a grenade explodes.

*/

actor GrenadeExplosion {
   +NOBLOCKMAP
   +ALLOWPARTICLES
   +RANDOMIZE
   +NOBLOOD
   +NOGRAVITY
   RenderStyle Translucent
   Alpha 0.5
   VSpeed 15
   Mass 3
   
   States {
      Spawn:
         BEXP A 2 Bright A_PlaySound("weapons/pistol")
         BEXP B 2 Bright A_SetScale(1.2, 1.2)
         BEXP C 4 Bright
         BEXP D 1 Bright A_SetScale(1.2, 1.2)
         BEXP D 1 Bright
         BEXP D 1 Bright
         BEXP D 1 Bright A_SetScale(1.4, 1.4)
         BEXP D 1 Bright
         BEXP D 1 Bright A_FadeOut(0.25)
         BEXP D 1 Bright A_SetScale(1.6, 1.6)
         BEXP D 1 Bright
         BEXP E 1 Bright A_FadeOut(0.05)
         BEXP E 1 Bright A_SetScale(1.8, 1.8)
         BEXP E 1 Bright
         BEXP E 1 Bright A_FadeOut(0.05)
         BEXP E 1 Bright A_SetScale(2.0, 2.0)
         BEXP E 1 Bright
         BEXP E 1 Bright A_FadeOut(0.05)
         BEXP E 1 Bright A_FadeOut(0.05)
         BEXP E 1 Bright A_FadeOut(0.05)
         Stop
   }
}
Skwirl
Of creatings Countryball Combat!
 
Joined: 01 Feb 2015
Location: 'merica

Re: Grenade Issues

Postby Skwirl » Sun Jun 18, 2017 6:25 pm

Bumping because I'd like the help.

Also good news, I was able to migrate this into GZDoom 3.1 without fatal errors.
Skwirl
Of creatings Countryball Combat!
 
Joined: 01 Feb 2015
Location: 'merica

Re: Grenade Issues

Postby Matt » Mon Jun 19, 2017 12:41 am

Unfortunately the first frame of spawn state still needs the nodelay keyword:
Code: Select allExpand view
BEXP A 2 nodelay Bright A_PlaySound("weapons/pistol")
(I don't remember if the nodelay goes first or bright or if it even matters, if that doesn't work switch 'em around)

I don't know what you mean by "showering the grenade I threw with tracer shots".

Why the +ALLOWPARTICLES?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Grenade Issues

Postby Skwirl » Mon Jun 19, 2017 7:41 am

Vaecrius wrote:Unfortunately the first frame of spawn state still needs the nodelay keyword:
Code: Select allExpand view
BEXP A 2 nodelay Bright A_PlaySound("weapons/pistol")
(I don't remember if the nodelay goes first or bright or if it even matters, if that doesn't work switch 'em around)

I don't know what you mean by "showering the grenade I threw with tracer shots".


I slang a lot when I talk... I was shooting the grenade, but each time I did, it was not exploding. I was "showering it in bullets", as in I used a machine gun on it and everything, but it just will not blow up. And I don't know why.

Vaecrius wrote:Why the +ALLOWPARTICLES?
[/quote]

It's been a long time since I touched the code, but I do want to make different types of explosions, including fragmentation that like shoots out a circle of different effects (shrapnel, smoke clouds, etc.), and I figured Particles were the way to do it.
Skwirl
Of creatings Countryball Combat!
 
Joined: 01 Feb 2015
Location: 'merica

Re: Grenade Issues

Postby Matt » Mon Jun 19, 2017 10:46 am

I just gave this a try.

Everything seems to work as it ought after I add the nodelay.

Shooting it detonates it as it ought, but with that sprite and those dimensions it's really hard to hit and the hitbox isn't where I would think it is.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Grenade Issues

Postby Skwirl » Mon Jun 19, 2017 3:45 pm

Vaecrius wrote:I just gave this a try.

Everything seems to work as it ought after I add the nodelay.

Shooting it detonates it as it ought, but with that sprite and those dimensions it's really hard to hit and the hitbox isn't where I would think it is.


Son of a bitch it worked. Thanks!

At one point I removed the A_Quake because I found that was eating up the sound time of the explosion which was why it sounded like a puff. I also resized the radius/height, and it worked. Just as it should.

Now I have a grenade that can be blown up before the timer, a grenade that gives a quake effect when you're close enough, etc.
Skwirl
Of creatings Countryball Combat!
 
Joined: 01 Feb 2015
Location: 'merica

Re: Grenade Issues

Postby Matt » Mon Jun 19, 2017 4:41 pm

I like that quake effect!

If you have the explosion sound on CHAN_AUTO and/or after the quake call it should not get cut off.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to Editing

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], phantombeta and 1 guest