Jump to content

Exploding Barrel


teamjh14

Recommended Posts

I'm working on a mod that will essentially spawn an explosion inside a barrel. This is proving more difficult than previously thought. The code is pretty basic:

 

if ( ExplosionIndex > 0 ) ;ExplosionIndex references the index in a formlist with a bunch of explosive projectiles
set ExplosionIndex to ExplosionIndex - 1
set thisExplosion to ( ListGetNthForm BurnBarrelExplosions ExplosionIndex )
;thisExplosion is the projectile we found in the formlist / thisBarrel is the barrel we are referencing
set iZ to ((thisBarrel.GetPos Z) + 100) ;iZ will position the projectile above the barrel

set newExplosion to thisBarrel.PlaceAtMe thisExplosion ;newExplosion, of course, is the newly spawned explosion
newExplosion.SetPos Z iZ
endif

 

I've tried two different things before this, with similar results (which I will go over shortly):

1. Instead of a projectile, I spawned the explosion directly at the barrel.

2. I simply used PlaceAtMe to spawn the projectile at the placement point of the barrel.

 

All three methods produced basically the same result: most of the explosions deliver no damage whatsoever to the player. With the former solution, the player is sometimes damaged. However, this is a sporadic and unpredictable result. I would like it so they are damaged whenever they are within the proximity of the barrel and the explosion goes off.

 

My assumption is that the projectile doesn't damage the player because it winds up rolling to the other side of the barrel, though it seems that a nuclear blast would injure them anyway (could be wrong about that though...). However, if this is the case, why isn't the direct explosion call damaging the player?

 

Any ideas would be much appreciated. I am SO close to releasing this thing and would love to get it out there soon.

Link to comment
Share on other sites

I'm working on a mod that will essentially spawn an explosion inside a barrel. This is proving more difficult than previously thought. The code is pretty basic:

 

if ( ExplosionIndex > 0 ) ;ExplosionIndex references the index in a formlist with a bunch of explosive projectiles
set ExplosionIndex to ExplosionIndex - 1
set thisExplosion to ( ListGetNthForm BurnBarrelExplosions ExplosionIndex )
;thisExplosion is the projectile we found in the formlist / thisBarrel is the barrel we are referencing
set iZ to ((thisBarrel.GetPos Z) + 100) ;iZ will position the projectile above the barrel

set newExplosion to thisBarrel.PlaceAtMe thisExplosion ;newExplosion, of course, is the newly spawned explosion
newExplosion.SetPos Z iZ
endif

 

I've tried two different things before this, with similar results (which I will go over shortly):

1. Instead of a projectile, I spawned the explosion directly at the barrel.

2. I simply used PlaceAtMe to spawn the projectile at the placement point of the barrel.

 

All three methods produced basically the same result: most of the explosions deliver no damage whatsoever to the player. With the former solution, the player is sometimes damaged. However, this is a sporadic and unpredictable result. I would like it so they are damaged whenever they are within the proximity of the barrel and the explosion goes off.

 

My assumption is that the projectile doesn't damage the player because it winds up rolling to the other side of the barrel, though it seems that a nuclear blast would injure them anyway (could be wrong about that though...). However, if this is the case, why isn't the direct explosion call damaging the player?

 

Any ideas would be much appreciated. I am SO close to releasing this thing and would love to get it out there soon.

 

well i dont script much but i think your problem is that a explosive aimation is playing but you did not specify to damage the player in the script. the animation alone will not damage you.

Link to comment
Share on other sites

 

well i dont script much but i think your problem is that a explosive aimation is playing but you did not specify to damage the player in the script. the animation alone will not damage you.

 

To be honest, in looking for a solution I thought that too. However, the explosion animation has a "Damage" field in it (Explosion entry in GECK wiki). I suppose this might be an antiquated or unused field, but I've found nothing to substantiate that. Also, one of my explosions is the Gas Fire Trap explosion, which actually does deal damage when called directly (wow, this problem just doesn't get any less mucky, does it?). I've checked out the damage field on all of my explosions, and they all have some amount of damage.

 

Just as a point of clarity, I have compared the one or two explosion objects that do deal damage with the ones that don't, and I've found no noticeable difference. For the projectile tests, I have created grenade-like projectiles with its appropriate explosion (so the objects are set as "Lobbers"). I prefer the projectile over directly calling the explosion, simply because it allows for a delay before exploding.

Link to comment
Share on other sites

Fixed (I think). I don't want to be long winded about this, but the way I figured this out was weird and I want to share :teehee:

 

Okay, so all of my projectiles were stripped of their mesh files so that the player wouldn't see the explosive. So I thought "maybe that's the problem." I hunted a bit and found a random mesh (milk carton) and I couldn't get it to work. It was falling down from a little higher than the barrel and landing on top of it, and when it exploded the player received no damage. So I thought "maybe something funky is happening with the collision between the milk crate and the top of the barrel" and instead I used a chandelier for the mesh. This worked for EVERY explosion. WTH?!? I then tried sinking the chandelier down into the barrel, and this also worked. I took it one step farther and swapped the chandelier back out for the milk crate. This also worked.

 

So, end of the story: I didn't like the milk crate, so now all the projectiles are bags of flour. You can't see them because they're inside another mesh. I think my suspicion was confirmed in these tests, that the explosion was somehow being blocked by the collision mesh of the barrel. It was inside the collision mesh, so I suspect the explosion just ignores the collision mesh altogether. A little bit of a hack job, but **** it, it works.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...