| Blockland Forums > Modification Help |
| Item emitters don't show up when I fire it. |
| (1/3) > >> |
| Gojira:
Okay, so here's the deal. I am trying to make a sonic screwdriver (for now it uses the printer model until I get a good model) and I am trying to make it glow (using emitters) when it fires. Here's the script: --- Code: ---//audio datablock AudioProfile(sonicscrewdriverFireSound) { filename = "./sonicscrewdriver.wav"; description = AudioClose3d; preload = true; }; //emitters datablock ParticleData(sonicscrewdriverFireParticle) { dragCoefficient = 5; gravityCoefficient = -0.0; inheritedVelFactor = 1.0; constantAcceleration = 0.0; lifetimeMS = 100; lifetimeVarianceMS = 0; textureName = "base/data/particles/dot"; spinSpeed = 0.0; spinRandomMin = 0.0; spinRandomMax = 0.0; colors[0] = "0 0.141 0.333 0.7"; colors[1] = "0 0 1.000 0.6"; colors[2] = "0.106 0.459 0.769 0.5"; sizes[0] = 0.15; sizes[1] = 0.15; sizes[2] = 0.3; times[0] = 0.0; times[1] = 0.5; times[2] = 1.0; useInvAlpha = false; }; datablock ParticleEmitterData(sonicscrewdriverFireEmitter) { ejectionPeriodMS = 10; periodVarianceMS = 0; ejectionVelocity = 1; velocityVariance = 0.5; ejectionOffset = 0; thetaMin = 0; thetaMax = 180; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "sonicscrewdriverFireEmitter"; useEmitterColors = false; uiName = "Sonic Screwdriver Fire"; }; datablock ParticleData(sonicscrewdriverParticleA) { dragCoefficient = 5; gravityCoefficient = -0.0; inheritedVelFactor = 1.0; constantAcceleration = 0.0; lifetimeMS = 100; lifetimeVarianceMS = 0; textureName = "base/data/particles/dot"; spinSpeed = 0.0; spinRandomMin = 0.0; spinRandomMax = 0.0; colors[0] = "0 0 0 0"; colors[1] = "0 0 0 0"; colors[2] = "0 0 0 0"; sizes[0] = 0.15; sizes[1] = 0.15; sizes[2] = 0.3; times[0] = 0.0; times[1] = 0.5; times[2] = 1.0; useInvAlpha = false; }; datablock ParticleEmitterData(sonicscrewdriverEmitterA) { ejectionPeriodMS = 10; periodVarianceMS = 0; ejectionVelocity = 1; velocityVariance = 0.5; ejectionOffset = 0; thetaMin = 0; thetaMax = 180; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "sonicscrewdriverParticleA"; useEmitterColors = false; uiName = "Sonic Screwdriver Hit"; }; datablock ParticleData(sonicscrewdriverParticleB) { dragCoefficient = 0; gravityCoefficient = -0.0; inheritedVelFactor = 1.0; constantAcceleration = 0; lifetimeMS = 30; lifetimeVarianceMS = 0; textureName = "base/data/particles/dot"; spinSpeed = 0.0; spinRandomMin = 0.0; spinRandomMax = 0.0; colors[0] = "0 0 0 0"; colors[1] = "0 0 0 0"; colors[2] = "0 0 0 0"; sizes[0] = 0.1; sizes[1] = 0.1; sizes[2] = 0.1; times[0] = 0.0; times[1] = 0.3; times[2] = 1.0; useInvAlpha = false; }; datablock ParticleEmitterData(sonicscrewdriverEmitterB) { ejectionPeriodMS = 1; periodVarianceMS = 0; ejectionVelocity = 50; velocityVariance = 0.0; ejectionOffset = 0; thetaMin = 0; thetaMax = 0; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "sonicscrewdriverParticleB"; useEmitterColors = false; uiName = "Sonic Screwdriver Trace"; }; datablock ProjectileData(sonicscrewdriverProjectileA) { projectileShapeName = "base/data/shapes/empty.dts"; directDamage = 0; directDamageType = $DamageType::Generic; radiusDamageType = $DamageType::Generic; particleEmitter = sonicscrewdriverEmitterA; soundProfile = radioWaveTravelSound; brickExplosionRadius = 0; brickExplosionImpact = 0; //destroy a brick if we hit it directly? brickExplosionForce = 0; brickExplosionMaxVolume = 0; //max volume of bricks that we can destroy brickExplosionMaxVolumeFloating = 0; //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume) collideWithPlayers = true; muzzleVelocity = 1; velInheritFactor = 1.0; armingDelay = 4000; lifetime = 4000; fadeDelay = 4000; bounceElasticity = 0; bounceFriction = 0.00; isBallistic = true; gravityMod = 0.0; hasLight = false; lightRadius = 1; lightColor = "0 0 0"; uiName = ""; }; ////////// // item // ////////// datablock ItemData(sonicscrewdriverItem) { category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "base/data/shapes/printGun.dts"; rotate = false; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "Sonic Screwdriver"; iconName = "base/client/ui/itemIcons/printer"; doColorShift = true; colorShiftColor = "0.5 0.5 0.5 1.000"; // Dynamic properties defined by the scripts image = sonicscrewdriverImage; canDrop = true; }; //////////////// //weapon image// //////////////// datablock ShapeBaseImageData(sonicscrewdriverImage) { // Basic Item properties shapeFile = "base/data/shapes/printGun.dts"; emap = true; mountPoint = 0; offset = "0 0 0"; eyeOffset = 0; rotation = "1 0 0 0"; correctMuzzleVector = true; className = "WeaponImage"; // Projectile && Ammo. item = sonicscrewdriverItem; ammo = " "; projectile = sonicscrewdriverProjectileA; projectileType = Projectile; //melee particles shoot from eye node for consistancy melee = true; //raise your arm up or not armReady = true; doRetraction = false; raycastWeaponRange = 3000; raycastWeaponTargets = $TypeMasks::PlayerObjectType | //AI/Players $TypeMasks::StaticObjectType | //Static Shapes $TypeMasks::TerrainObjectType | //Terrain $TypeMasks::VehicleObjectType | //Terrain $TypeMasks::FXBrickObjectType; //Bricks raycastExplosionProjectile = LaserPointProjectileA; raycastExplosionBrickSound = ""; raycastExplosionPlayerSound = ""; raycastDirectDamage = 0; raycastDirectDamageType = $DamageType::MilitaryRifle; doColorShift = true; colorShiftColor = sonicscrewdriverItem.colorShiftColor;//"0.500 0.500 0.500 1.000"; //casing = " "; // Images have a state system which controls how the animations // are run, which sounds are played, script callbacks, etc. This // state system is downloaded to the client so that clients can // predict state changes and animate accordingly. The following // system supports basic ready->fire->reload transitions as // well as a no-ammo->dryfire idle state. // Initial start up state stateName[0] = "Activate"; stateTransitionOnTriggerDown[0] = "Fire"; stateAllowImageChange[0] = true; stateSound[0] = sprayActivateSound; stateTransitionOnTimeout[0] = "Ready"; stateTimeoutValue[0] = 0.3; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "Fire"; stateAllowImageChange[1] = true; //stateName[2] = "PreFire"; //stateSound[2] = ""; //stateTimeoutValue[2] = 0.01; //stateTransitionOnTimeout[2] = "Fire"; stateName[2] = "Fire"; stateTransitionOnTriggerUp[2] = "StopFire"; stateTransitionOnTimeout[2] = "Fire"; stateTimeoutValue[2] = 0.01; stateWaitForTimeout[2] = true; stateFire[2] = true; stateAllowImageChange[2] = true; stateSound[2] = sonicscrewdriverFireSound; stateScript[2] = "onFire"; stateEmitter[2] = sonicscrewdriverFireEmitter; stateEmitterTime[2] = 0.07; stateSequence[2] = "fire"; stateName[3] = "StopFire"; stateTransitionOnTimeout[3] = "Ready"; stateWaitForTimeout[3] = true; stateAllowImageChange[3] = true; stateSequence[3] = "stopfire"; }; function sonicscrewdriverImage::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit) { if(!isObject(%col)) return; %colType = %col.getType(); //%col changes to CorpseObjectType if you kill a player if(!isObject(CritProjectile)) %crit = 0; if(%this.raycastDirectDamage > 0 && %colType & ($TypeMasks::PlayerObjectType | $TypeMasks::VehicleObjectType)) { if(isObject(%col.spawnBrick) && %col.spawnBrick.getGroup().client == %obj.client) %dmg = 1; if(miniGameCanDamage(%obj,%col) == 1 || %dmg) %this.onRaycastDamage(%obj,%slot,%col,%pos,%normal,%shotVec,%crit); } if(%colType & $TypeMasks::fxBrickObjectType && getSimTime() - %col.lastLaserActivateTime > 200) { %col.lastLaserActivateTime = getSimTime(); $InputTarget_["Self"] = %col; $InputTarget_["Player"] = %obj; $InputTarget_["Client"] = %obj.client; if($Server::LAN) { $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj.client); } else { $InputTarget_["MiniGame"] = getMiniGameFromObject(%col); } %col.processInputEvent("onActivate", %obj.client); } if(isObject(%this.raycastExplosionProjectile)) { %scaleFactor = getWord(%obj.getScale(), 2); %p = new Projectile() { dataBlock = %this.raycastExplosionProjectile; initialPosition = vectorAdd(%pos,vectorScale(%normal,0.05)); initialVelocity = "0 0 0"; sourceObject = %obj; client = %obj.client; sourceSlot = 0; originPoint = %pos; }; MissionCleanup.add(%p); %p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor); //%p.explode(); } if(isObject(%this.raycastExplosionSound)) serverplay3d(%this.raycastExplosionSound,%pos); if(isObject(%this.raycastExplosionCritSound) && %crit) serverplay3d(%this.raycastExplosionCritSound,%pos); %colPlayer = (%colType & $TypeMasks::PlayerObjectType); if(%colPlayer && isObject(%this.raycastExplosionPlayerSound)) serverplay3d(%this.raycastExplosionPlayerSound,%pos); else if(!%colPlayer && isObject(%this.raycastExplosionBrickSound)) serverplay3d(%this.raycastExplosionBrickSound,%pos); } --- End code --- Help would be greatly appreciated. |
| Gojira:
Wow, really? No help? |
| Gojira:
SERIOUSLY. |
| Loki:
is sonicscrewdriver.wav even in the folder? Is it mono? |
| Gojira:
--- Quote from: Loki on October 22, 2010, 10:29:02 PM ---is sonicscrewdriver.wav even in the folder? Is it mono? --- End quote --- I fixed the sound, but I need the emitter. |
| Navigation |
| Message Index |
| Next page |