Author Topic: Weapon doesn't do any radius damage  (Read 3051 times)

This is confusing... I referenced the code from the Rocket Launcher just to be sure, but I can't figure out why this weapon won't do any radius damage.
I have to directly hit an enemy to do anything, and if I reduce the projectile's directDamage to 0, it does no damage at all.

Code: [Select]
datablock ExplosionData(DemonFireballWandExplosion : AdminWandExplosion)
{
  uiName = "Demonflame Fireball Explosion";
  particleEmitter = "";
  emitter[0] = DemonFireballWandExplosionEmitter;
  lifetimeMS = 100;
 
  soundProfile = DemonWandHitSound;
 
  faceViewer     = true;
  explosionScale = "1 1 1";
 
  damageRadius = 4;
  radiusDamage = 25;
 
  // Dynamic light
  lightStartRadius = 4;
  lightEndRadius = 0;
  lightStartColor = "0.66 0.19 1";
  lightEndColor = "0.29 0 1";
};

//### Projectile

datablock ProjectileData(DemonFireballWandProjectile)
{
  uiName = "Demonflame Fireball";
  projectileShapeName = "";
  directDamage = 25;
  directDamageType = $DamageType::MagicWand;
  radiusDamageType = $DamageType::MagicWand;
  impactImpulse = 100;
  verticalImpulse = 0;
  particleEmitter = DemonFireballWandEmitter;
  explosion = DemonFireballWandExplosion;
  bounceExplosion = DemonFireballWandExplosion;
  muzzleVelocity = 40;
  verInheritFactor = 0;
 
  armingDelay         = 4500;
   lifetime            = 5000;
   fadeDelay           = 5000;
   bounceElasticity    = 1;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 20;
};

Why are you referencing the Admin Wand's explosion if you already have most of the explosion data variables anyway?

The Admin Wand does no damage, so maybe that's the problem?

Why are you referencing the Admin Wand's explosion if you already have most of the explosion data variables anyway?

The Admin Wand does no damage, so maybe that's the problem?
There's not too much else to reference, but this explosiondata is partially from Gravity Cat's Endless Zombies Kompressorwand code. That didn't have radius damage, but I thought defining it would give it damage...
Should I make it refer to the Rocket Launcher instead?

Don't refer to anything, try just changing the line to "datablock ExplosionData(DemonFireballWandExplosion)"

Don't refer to anything, try just changing the line to "datablock ExplosionData(DemonFireballWandExplosion)"
Right. I'll try that when I have my computer next, thanks!

-cut-
Didn't work. The wand still does no radius damage.
Edit: Even making it refer to the Rocket Launcher doesn't work. Somehow, something about it is ruining its radius damage.
Could it be the small value on the radius damage, or the short lifetime? Do explosions need to last a certain time for radius damage to be detected?

Edit 2: Here's the COMPLETE code for the weapon.
Code: [Select]
//########## Demonflame Wand

//### Sound
datablock AudioProfile(DemonWandHitSound)
{
   filename    = "./demonWandHit.wav";
   description = AudioClose3d;
   preload = true;
};

datablock AudioProfile(DemonWandFireSound)
{
   filename    = "./demonWandFire.wav";
   description = AudioClose3d;
   preload = true;
};

//### Effects

datablock ParticleData(DemonWandAmbParticle)
{
  textureName = "base/data/particles/cloud";
  dragCoefficient = 0;
gravityCoefficient = -0.5;
inheritedVelFactor = 0;
windCoefficient = 0;
constantAcceleration = 0;
lifetimeMS = 600;
lifetimeVarianceMS = 100;
spinSpeed = 0;
spinRandomMin = -90.0;
spinRandomMax = 90;
useInvAlpha = 0;
colors[0] = "0.66 0.19 1 1.0";
colors[1] = "0.5 0.07 1 0.5";
colors[2] = "0.29 0 1 0";
sizes[0] = 0.3;
sizes[1] = 0.2;
sizes[2] = 0.1;
times[0] = 0;
times[1] = 0.1;
times[2] = 1;
useInvAlpha = false;
};

datablock ParticleEmitterData(DemonWandAmbEmitter)
{
  ejectionPeriodMS = 4;
periodVarianceMS = 2;
ejectionVelocity = 0;
ejectionOffset = 0.1;
velocityVariance = 0;
thetaMin = 0;
thetaMax = 180;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = 0;
  particles = "DemonWandAmbParticle";
  uiName = "Demonflame Wand Ambient";
};

datablock ParticleData(DemonWandAtkParticle : DemonWandAmbParticle)
{
colors[0] = "0.66 0.19 1 1.0";
colors[1] = "0.66 0.19 1 0.5";
colors[2] = "0.5 0.07 1 0";
};

datablock ParticleEmitterData(DemonWandAtkEmitter : DemonWandAmbEmitter)
{
  particles = "DemonWandAtkParticle";
  uiName = "Demonflame Wand Attack";
};

datablock ParticleData(DemonFireballWandParticle)
{
  dragCoefficient = 0;
  inheritedVelFactor = 0;
  lifetimeMS = 500;
  textureName = "base/data/particles/cloud";
  spinSpeed = 0;
  colors[0] = "0.66 0.19 1 1";
  colors[1] = "0.5 0.07 1 0.5";
  colors[2] = "0.29 0 1 0";
  sizes[0] = 1.25;
  sizes[1] = 0.7;
  sizes[2] = 0.4;
  times[0] = 0;
  times[1] = 0.25;
  times[2] = 1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(DemonFireballWandEmitter)
{
  ejectionPeriodMS = 5;
  ejectionVelocity = 1;
  velocityVariance = 1;
  thetaMin = 0;
  thetaMax = 180;
  phiReferenceVel = 0;
  phiVariance = 360;
  particles = "DemonFireballWandParticle";
  uiName = "Demonflame Fireball";
};

datablock ParticleData(DemonFireballWandExplosionParticle)
{
  dragCoefficient = 3;
  gravityCoefficient = -0.2;
  inheritedVelFactor   = 0;
constantAcceleration = 0.0;
lifetimeMS           = 500;
lifetimeVarianceMS   = 250;
  textureName = "base/data/particles/cloud";
  spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
  colors[0] = "0.66 0.19 1 1";
  colors[1] = "0.5 0.07 1 1";
  colors[2] = "0.29 0 1 0";
  sizes[0] = 4;
  sizes[1] = 0.75;
  sizes[2] = 0.4;
  times[0] = 0;
  times[1] = 0.04;
  times[2] = 1;
  useInvAlpha = false;
};

datablock ParticleEmitterData(DemonFireballWandExplosionEmitter)
{
  ejectionPeriodMS = 5;
   periodVarianceMS = 0;
   ejectionVelocity = 8;
   velocityVariance = 4;
   ejectionOffset   = 0.1;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
  particles = "DemonFireballWandExplosionParticle";
  uiName = "Demonflame Fireball Hit";
};

datablock ExplosionData(DemonFireballWandExplosion : rocketExplosion)
{
  uiName = "Demonflame Fireball Explosion";
  emitter[0] = DemonFireballWandExplosionEmitter;
  lifetimeMS = 350;
 
  particleEmitter = "";
 
  explosionShape = "base/data/shapes/empty.dts";
  soundProfile = DemonWandHitSound;
 
  shakeCamera = false;
 
  faceViewer     = true;
  explosionScale = "1 1 1";
 
  damageRadius = 3;
  radiusDamage = 25;
 
  impulseRadius = 2;
  impulseForce = 100;
 
  // Dynamic light
  lightStartRadius = 4;
  lightEndRadius = 0;
  lightStartColor = "0.66 0.19 1";
  lightEndColor = "0.29 0 1";
};

//### Projectile

datablock ProjectileData(DemonFireballWandProjectile)
{
  uiName = "Demonflame Fireball";
  projectileShapeName = "";
  directDamage = 25;
  directDamageType = $DamageType::MagicWand;
  radiusDamageType = $DamageType::MagicWand;
  impactImpulse = 100;
  verticalImpulse = 0;
  particleEmitter = DemonFireballWandEmitter;
  explosion = DemonFireballWandExplosion;
  bounceExplosion = DemonFireballWandExplosion;
  muzzleVelocity = 40;
  verInheritFactor = 0;
 
  armingDelay         = 4500;
   lifetime            = 5000;
   fadeDelay           = 5000;
   bounceElasticity    = 1;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 20;
};

datablock ItemData(DemonFireballWandItem : WandItem)
{
uiName = "Demonflame Wand";
doColorShift = true;
colorShiftColor = "0.5 0.07 1 1";

image = DemonFireballWandImage;
};

datablock ShapeBaseImageData(DemonFireballWandImage : AdminWandImage)
{
  projectile = DemonFireballWandProjectile;
  projectileType = Projectile;
  doColorShift = true;
  colorShiftColor = "0.5 0.07 1 1";

  stateName[0] = "Initial";
stateTimeoutValue[0] = 0.2;
stateTransitionOnTimeout[0] = "Ready";
//stateSound[0] = weaponSwitchSound;

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "preFire";
stateAllowImageChange[1] = true;
stateEmitter[1] = DemonWandAmbEmitter;
stateScript[1]                  = "onFireReload";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.4;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateEjectShell[3]        = false;
stateEmitter[3] = DemonWandAtkEmitter;
stateEmitterTime[3] = 0.4;
stateEmitterNode[3] = "muzzlePoint";
stateSound[3] = DemonWandFireSound;

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";
stateTransitionOnNoAmmo[4]       = "Recharge";

stateName[5]                    = "StopFire";
stateAllowImageChange[5]        = true;
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.01; //3.00
stateScript[5] = "onStopFire";
stateSequence[5] = "StopFire";
stateWaitForTimeout[5] = true;

stateName[6] = "PreFire";
stateScript[6] = "onPreFire";
stateAllowImageChange[6] = false;
stateTimeoutValue[6] = 0.1;
stateWaitForTimeout[6] = true;
stateTransitionOnTimeout[6] = "Fire";
};

function DemonFireballWandImage::onPreFire(%this,%obj,%slot) { %obj.playthread(2,armattack); }
function DemonFireballWandImage::onStopFire(%this,%obj,%slot) { %obj.playthread(2,root); }
« Last Edit: November 02, 2017, 05:57:04 PM by Brixmon »

Try putting "explodeOnDeath = true;" into your projectile data, your weapon uses an arming delay, and most weapons i've seen that use that also use explodeOnDeath, so i assume that's a necessary thing to have otherwise something like radius damage breaks

Try putting "explodeOnDeath = true;" into your projectile data, your weapon uses an arming delay, and most weapons i've seen that use that also use explodeOnDeath, so i assume that's a necessary thing to have otherwise something like radius damage breaks
That still won't fix it.
Can bounce explosions even deal radius damage? The projectile is meant to last a while, bouncing around and doing radius damage whenever it bounces, but it's not working. It might deal radius damage on its death explosion, but that's hard to test, since it takes so long...
Just for reference, other explosive weapons have functioning radius damage. I do have Obstructed Radius Damage enabled, if that helps, but disabling it had no effect on the problem earlier.

Edit: Spawning a long line of hole bots makes testing that easy. The final explosion IS dealing raidus damage, but the bounces refuse to do anything.
« Last Edit: November 02, 2017, 06:15:39 PM by Brixmon »

I don't know how Gravity Cat's zombie thing does it's stuff, but i've never even heard of a 'bounce' explosion, maybe it's possible that the 'bounceExplosion' variable is just a thing specific to Gravity Cat's mod?

It is possible to script your weapon to spawn an explosion whenever the projectile collides with anything, but not with this 'bounceExplosion' thing

I don't know how Gravity Cat's zombie thing does it's stuff, but i've never even heard of a 'bounce' explosion, maybe it's possible that the 'bounceExplosion' variable is just a thing specific to Gravity Cat's mod?

It is possible to script your weapon to spawn an explosion whenever the projectile collides with anything, but not with this 'bounceExplosion' thing
Uh... what? I don't know how you could've not heard of the bounce explosion thing. It's present in a lot more than that, and in fact, Gravity Cat's mod didn't include any bounce explosions in its wand projectiles.
You can find the bounceExplosion thing in the MAS Orb Launcher, the default Pong projectile, the energy ball projectile... it's used for practically every bouncing projectile.
And the Orb Launcher defines radius damage for its specific bounce explosion. Maybe I need different explosions for both in order for the damage to work?

Edit: Nope. Making a special bounce explosion doesn't fix it either.
« Last Edit: November 02, 2017, 06:36:02 PM by Brixmon »

Why are you referencing the Admin Wand's explosion if you already have most of the explosion data variables anyway?

The Admin Wand does no damage, so maybe that's the problem?
No. You can refer to another object as long as you overwrite the variable. Here's how inheritance works:
NewData : CopyData

The NewData will have the same exact data as CopyData - anything inside NewData will overwrite CopyData's variables that were copied onto NewData (note: CopyData will not be modified by this)

Change DamageRadius from 3 to 10 to see if it actually works.

You did mention that this projectile bounce - if you want the projectile to explode every bounce impact you have to package the projectile's onCollision function
« Last Edit: November 02, 2017, 07:38:22 PM by Kyuande »

No. You can refer to another object as long as you overwrite the variable. Here's how inheritance works:
NewData : CopyData

The NewData will have the same exact data as CopyData - anything inside NewData will overwrite CopyData's variables that were copied onto NewData.

Change DamageRadius from 3 to 10 to see if it actually works.
Haaa... I, um, I already tried that after I posted my last reply. There's absolutely no radius damage.
I also tried setting the radius damage to 100 so it would oneshot hole bots. It doesn't, and the hit markers mod only showed one damage number, so the bounce explosions simply refuse to deal radius damage.
Is this a known thing? You'd think if this was a problem with Blockland itself that the inability of bounce explosions to deal radius damage would be known, right, considering it's been around for over a decade...

Edit: If this is a thing, surely it's possible to get the bounce explosion to instead spawn a projectile that instantly dies, thus spawning a damaging explosion. I have very little coding experience- this mod is pretty much the culmination of all my TorqueScript ability I have at this time.
If that's possible to do, could someone show me? It would also be incredibly useful for making projectiles that split, which would be awesome.
Edit 2: Ah, I thought there was already something like this. The old Frag Grenade spawns shrapnel on explosion instead of normal radius damage, and it has a function here that could very well be appropriated for other purposes. I imagine I could use this for my purpose, but that's only needed here if the bounce explosion functionality GENUINELY cannot deal radius damage.
« Last Edit: November 02, 2017, 07:48:08 PM by Brixmon »

if you're spawning a projectile using code you need to make sure it has the sourceobject and sourceclient parameters defined as those are used in the minigameCanDamage damage check code

if you're spawning a projectile using code you need to make sure it has the sourceobject and sourceclient parameters defined as those are used in the minigameCanDamage damage check code
I'm not doing that yet. This has so far all been done using default code and functions. Bounce explosions, judging from these problems I've had, seem to be totally incapable of dealing radius damage in any way.

Edit: Oh, but how would I format sourceClient? Would it be:
Code: [Select]
sourceClient = %obj.client.player;Or:
Code: [Select]
sourceClient = %obj.client.getplayername;Or:
Code: [Select]
sourceClient = %obj.client.player.getID;
« Last Edit: November 02, 2017, 08:00:29 PM by Brixmon »

depends on the function its in, cause the parameters may be different.

sourceClient:
if %obj is a player object, then its %obj.client
if %obj is a projectile, then its %obj.sourceClient
if %obj is a client, then its %obj (duh)

sourceObject:
if %obj is a player object, then its %obj (duh)
if %obj is a projectile, then its %obj.sourceObject
if %obj is a client, then its %obj.player

we need the relevant oncollision code to comment on this better