| Blockland Forums > Modification Help |
| "Unknown command onFire" + grenade not working |
| (1/2) > >> |
| Demian:
What the hell. I get that error in console. I'm trying to make a smoke grenade and it isn't launching. The arm raises but when I release nothing happens. I copied the spear script for states. Essentially I just want a spear with a different model, no explosion and a different emitter. How is this not working? --- Code: ---datablock ParticleData(PA_smokeMarker) { animateTexture = false; useInvAlpha = false; textureName = "base/data/particles/cloud"; animTexName[0] = "base/data/particles/cloud"; lifetimeMS = 7000; lifetimeVarianceMS = 1000; spinSpeed = 10; spinRandomMin = -90; spinRandomMax = 90; constantAcceleration = 0; inheritedVelFactor = 0; dragCoefficient = 0; gravityCoefficient = 0; windCoefficient = 0; times[0] = "0"; times[1] = "1"; sizes[0] = "0.4"; sizes[1] = "6"; colors[0] = "1 1 1 1"; colors[1] = "0 0 0 0"; }; datablock ParticleEmitterData(EM_smokeMarker) { particles = PA_smokeMarker; uiName = "Smoke Marker"; lifetimeMS = 0; lifetimeVarianceMS = 0; ejectionOffset = 0; ejectionPeriodMS = 30; periodVarianceMS = 0; ejectionVelocity = 4; velocityVariance = 0.5; orientParticles = false; //??? orientOnVelocity = false; //??? phiReferenceVel = 0; //??? phiVariance = 360; //Particle's ejection angle on the Z-axis (0, 360) thetaMin = 0; //Particle's ejection angle on the X-axis (0,180) thetaMax = 20; //Particle's ejection angle on the X-axis (0,180) useEmitterColors = false; //??? useEmitterSizes = false; //??? overrideAdvance = false; //Update existing particles immidiately if an update to the script is made? }; datablock ProjectileData(PR_smokeMarker) { projectileShapeName = "Add-Ons/Weapon_HeGrenade/hegrenadeProjectile.dts"; uiName = "Smoker Marker, White"; lifetime = 9000; fadeDelay = 9500; armingDelay = 0; directDamage = 0; radiusDamage = 0; collideWithPlayers = 1; particleEmitter = EM_smokeMarker; muzzleVelocity = 30; velInheritFactor = 1; minStickVelocity = 0; bounceAngle = 0; bounceElasticity = 0.4; bounceFriction = 0.3; isBallistic = true; gravityMod = 1; //0.0 - 1.0 impactImpulse = 100; verticalImpulse = 100; }; datablock ItemData(IT_smokeMarker) { category = "Weapon"; className = "Weapon"; shapeFile = "Add-Ons/Weapon_Gun/pistol.dts"; uiName = "Smoke Marker, White"; iconName = "Add-Ons/Weapon_Gun/icon_gun"; canDrop = true; image = IM_smokeMarker; friction = 0.6; elasticity = 0.2; sticky = 0; gravityMod = true; mass = 1; drag = 0.5; density = 0.2; doColorShift = true; colorShiftColor = "1 1 1 1"; }; datablock ShapeBaseImageData(IM_smokeMarker) { className = "WeaponImage"; shapeFile = "Add-Ons/Weapon_Gun/pistol.dts"; Projectile = PR_smokeMarker; projectileType = Projectile; Item = IT_smokeMarker; armReady = true; melee = false; mountPoint = 0; correctMuzzleVector = true; offset = "0 0 0"; rotation = "1 0 0 0"; eyeOffset = "0 0 0"; eyeRotation = "1 0 0 0"; doColorShift = true; colorShiftColor = "1 1 1 1"; stateName[0] = "Activate"; stateTimeoutValue[0] = 0.1; stateTransitionOnTimeout[0] = "Ready"; stateSequence[0] = "ready"; stateSound[0] = weaponSwitchSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "Charge"; stateAllowImageChange[1] = true; stateName[2] = "Charge"; stateTransitionOnTimeout[2] = "Armed"; stateTimeoutValue[2] = 0.7; stateWaitForTimeout[2] = false; stateTransitionOnTriggerUp[2] = "AbortCharge"; stateScript[2] = "onCharge"; stateAllowImageChange[2] = false; stateName[3] = "AbortCharge"; stateTransitionOnTimeout[3] = "Ready"; stateTimeoutValue[3] = 0.3; stateWaitForTimeout[3] = true; stateScript[3] = "onAbortCharge"; stateAllowImageChange[3] = false; stateName[4] = "Armed"; stateTransitionOnTriggerUp[4] = "Fire"; stateAllowImageChange[4] = false; stateName[5] = "Fire"; stateTransitionOnTimeout[5] = "Ready"; stateTimeoutValue[5] = 0.5; stateFire[5] = true; stateSequence[5] = "fire"; stateScript[5] = "onFire"; stateWaitForTimeout[5] = true; stateAllowImageChange[5] = false; //stateSound[5] = spearFireSound; }; function IM_smokeMarker::onCharge(%this, %obj, %slot) { %obj.playthread(2, spearReady); } function IM_smokeMarker::onAbortCharge(%this, %obj, %slot) { %obj.playthread(2, root); } function IM_smokeMarker::onFire(%this, %obj, %slot) { %obj.playthread(2, spearThrow); Parent::onFire(%this, %obj, %slot); } --- End code --- |
| Amade:
Add className = "WeaponImage"; somewhere within the image datablock. |
| Demian:
Damn that useless classname thing. Okay that works now same with the emitter but how is the projectile not bouncing? It just disappears when it hits anything. Updated code in OP. |
| Amade:
--- Quote from: Demian on October 18, 2011, 12:21:09 PM ---Damn that useless classname thing. --- End quote --- It's not useless at all when you learn how to use it. --- Quote from: Demian on October 18, 2011, 12:21:09 PM ---Okay that works now same with the emitter but how is the projectile not bouncing? It just disappears when it hits anything. Updated code in OP. --- End quote --- Try increasing the bounceAngle. |
| Demian:
--- Quote from: Amade on October 18, 2011, 04:37:38 PM ---It's not useless at all when you learn how to use it. --- End quote --- From what I've experimented with items only work when it's set to "WeaponImage". |
| Navigation |
| Message Index |
| Next page |