I assembled a small function that would supposedly add a Splash object to any explosion as long as the explosionData had defined "doSplash = bool;" and "splashData = string;" lines, the idea being to use splash objects as explosion shockwaves to add some extra variety, plus the splash textures are not billboard particles which is a huge plus. But when I tried it nothing happened. At this point I'm just trying to get it to work at all for this particular explosion, but I haven't had any success.
Here's the script:
//Testgun.cs
//...
datablock ExplosionData(TestgunExplosion)
{
//explosionShape = "";
soundProfile = bulletHitSound;
lifeTimeMS = 150;
particleEmitter = gunExplosionEmitter;
particleDensity = 5;
particleRadius = 0.2;
emitter[0] = gunExplosionRingEmitter;
faceViewer = true;
explosionScale = "1 1 1";
shakeCamera = false;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "1.0 1.0 1.0";
camShakeDuration = 0.5;
camShakeRadius = 10.0;
// Dynamic light
lightStartRadius = 0;
lightEndRadius = 2;
lightStartColor = "0.3 0.6 0.7";
lightEndColor = "0 0 0";
// doSplash = 1;
// splashData = PlayerSplash;
};
//...
package MyMakeshiftShockwave //(208)
{
(210)function TestgunExplosion::onAdd(%this,%obj,%pos,%norm)
(211){
(212) // if(%this.getDataBlock().splashData $= "" || %this.getDatablock().doSplash != 1)
(213) // return;
(214)
(215) %scale = getWord(%obj.getScale(), 2);
(216) %s = new Splash()
(217) {
(218) dataBlock = PlayerSplash; //%this.explosionData.splashData;
(219) initialPosition = %pos;
(220) sourceObject = %obj;
(221) client = %obj.client;
(222) originPoint = %pos;
(223) };
(224) MissionCleanup.add(%s);
(225) %s.setScale(%scale SPC %scale SPC %scale);
(226) parent::onAdd(%this,%obj,%pos,%norm);
(227)}
};
activatePackage(MyMakeshiftShockwave);
The console does not detect any syntax errors when the script is loaded. The function simply doesn't work and I don't know where to look next. Any help would be extremely appreciated.
The complete script is attached, it's in "server.cs" form though.