datablock AudioProfile(wandBrickSound) { filename = "Add-Ons/Weapon_RPGDefault/sounds/wandmagichitbrick.wav"; description = AudioClosest3d; preload = true; }; datablock AudioProfile(wandPlayerSound) { filename = "Add-Ons/Weapon_RPGDefault/sounds/wandmagichitplayer.wav"; description = AudioClosest3d; preload = true; }; datablock AudioProfile(wandDrawSound) { filename = "Add-Ons/Weapon_RPGDefault/sounds/wanddraw.wav"; description = AudioClosest3d; preload = true; }; datablock AudioProfile(wandShoot) { filename = "Add-Ons/Weapon_RPGDefault/sounds/wandShoot.wav"; description = AudioClosest3d; preload = true; }; datablock ParticleData(MagicExplosionParticle) { dragCoefficient = 5; gravityCoefficient = 0.1; inheritedVelFactor = 0.2; constantAcceleration = 0.0; lifetimeMS = 500; lifetimeVarianceMS = 300; textureName = "base/data/particles/chunk"; spinSpeed = 10.0; spinRandomMin = -50.0; spinRandomMax = 50.0; colors[0] = "0.9 0.9 0.6 0.9"; colors[1] = "0.9 0.5 0.6 0.0"; sizes[0] = 0.25; sizes[1] = 0.0; }; datablock ParticleEmitterData(MagicExplosionEmitter) { ejectionPeriodMS = 1; periodVarianceMS = 0; ejectionVelocity = 5; velocityVariance = 0.0; ejectionOffset = 0.0; thetaMin = 80; thetaMax = 80; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "MagicExplosionParticle"; uiName = "Magic Shot Hit"; }; datablock explosionData(MeleeWandExplosion) { camShakeDuration = 0.5; camShakeFreq = "1 1 1"; emitter[0] = MagicExplosionEmitter; faceViewer = 1; lifetimeMS = 180; lightEndRadius = 0.5; lightStartColor = "0 0.7 1 1"; lightStartRadius = 1; shakeCamera = 1; soundProfile = "wandBrickSound"; datablock ExplosionData(MagicshotExplosion) { //explosionShape = ""; lifeTimeMS = 500; soundProfile = wandPlayerSound; particleEmitter = MagicExplosionEmitter; particleDensity = 10; particleRadius = 0.2; faceViewer = true; explosionScale = "0.5 1 1"; shakeCamera = true; camShakeFreq = "20.0 22.0 20.0"; camShakeAmp = "1.0 1.0 1.0"; camShakeDuration = 0.5; camShakeRadius = 10.0; // Dynamic light lightStartRadius = 2; lightEndRadius = 0; lightStartColor = "1 0 0"; lightEndColor = "0 0 0"; }; datablock DecalData(magicstab) { textureName = "add-ons/Weapon_RPGDefault/CI_rpgwand.png"; }; AddDamageType("magicstab", ' %1', '%2 %1',0.75,1); datablock ProjectileData(MagicStabProjectile) { shapeFile = "base/data/shapes/empty.dts"; directDamage = 100; directDamageType = $DamageType::magicstab; radiusDamageType = $DamageType::magicstab; brickExplosionRadius = 0; brickExplosionImpact = true; brickExplosionForce = 0; brickExplosionMaxVolume = 1; brickExplosionMaxVolumeFloating = 2; explosion = MeleeWandExplosion; muzzleVelocity = 50; velInheritFactor = 1; armingDelay = 0; lifetime = 75; fadeDelay = 70; bounceElasticity = 0; bounceFriction = 0; isBallistic = true; gravityMod = 0.50; hasLight = false; lightRadius = 3.0; lightColor = "1 0 0"; uiName = "Magic Wand Stab"; }; datablock ParticleData(MagicTrailParticle) { dragCoefficient = 3.0; windCoefficient = 0.0; gravityCoefficient = 0.0; inheritedVelFactor = 0.0; constantAcceleration = 0.0; lifetimeMS = 400; lifetimeVarianceMS = 0; spinSpeed = 500.0; spinRandomMin = -50.0; spinRandomMax = 50.0; useInvAlpha = false; animateTexture = false; //framesPerSec = 1; textureName = "base/data/particles/star1"; //animTexName = "./dot"; // Interpolation variables colors[0] = "0.75 0.75 0.75 0.3"; colors[1] = "0.75 0.75 0.75 0.2"; colors[2] = "1 1 1 0.0"; sizes[0] = 0.15; sizes[1] = 0.35; sizes[2] = 0.05; times[0] = 0.0; times[1] = 0.1; times[2] = 1.0; }; datablock ParticleEmitterData(MagicTrailEmitter) { ejectionPeriodMS = 5; periodVarianceMS = 0; ejectionVelocity = 5; //0.25; velocityVariance = 3; //0.10; ejectionOffset = 0; thetaMin = 0.0; thetaMax = 90.0; particles = MagicTrailParticle; }; datablock ParticleData(WandshotExplosionParticle) { dragCoefficient = 3.0; windCoefficient = 0.0; gravityCoefficient = 0.0; inheritedVelFactor = 0.0; constantAcceleration = 0.0; lifetimeMS = 500; lifetimeVarianceMS = 0; spinSpeed = 1000.0; spinRandomMin = -50.0; spinRandomMax = 50.0; useInvAlpha = false; animateTexture = false; //framesPerSec = 1; textureName = "base/data/particles/star1"; //animTexName = "./dot"; // Interpolation variables colors[0] = "0.8 0.8 1 0.8"; colors[1] = "0.4 0.4 1 0.8"; sizes[0] = 1.2; sizes[1] = 0.5; times[0] = 0.0; times[1] = 1.0; }; useInvAlpha = true; }; datablock ParticleEmitterData(WandshotExplosionEmitter) { ejectionPeriodMS = 7; periodVarianceMS = 0; ejectionVelocity = 8; velocityVariance = 1.0; ejectionOffset = 2.0; thetaMin = 0; thetaMax = 60; phiReferenceVel = 0; phiVariance = 360; overrideAdvance = false; particles = "WandshotExplosionParticle"; useEmitterColors = true; uiName = "Magicwand Vanish"; }; datablock ExplosionData(WandshotExplosion) { //explosionShape = ""; soundProfile = ""; lifeTimeMS = 50; emitter[0] = WandshotExplosionEmitter; 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 = 1; lightStartColor = "0.3 0.6 0.7"; lightEndColor = "0 0 0"; }; datablock DecalData(Wandshotthrow) { textureName = "add-ons/Weapon_RPGDefault/CI_rpgwandhit.png"; }; //Thrown projectile AddDamageType("Wandshotthrow", ' %1', '%2 %1',0.75,1); datablock ProjectileData(WandshotThrowProjectile) { projectileShapeName = ""; directDamage = 40; directDamageType = $DamageType::Wandshotthrow; radiusDamageType = $DamageType::Wandshotthrow; particleEmitter = MagicTrailEmitter; stickExplosion = MagicshotExplosion; bloodExplosion = MagicshotExplosion; explosion = WandshotExplosion; explodeOnPlayerImpact = true; explodeOnDeath = true; armingDelay = 6000; lifetime = 6000; fadeDelay = 6000; isBallistic = true; bounceAngle = 180; //stick almost all the time minStickVelocity = 10; bounceElasticity = 0; bounceFriction = 1; gravityMod = 0.35; doColorShift = true; colorShiftColor = "0.85 0.79 0.45 1.000"; hasLight = false; lightRadius = 3.0; lightColor = "0 0 1"; muzzleVelocity = 75; velInheritFactor = 1; lightColor = "0 0 0.5"; uiName = "Magicwand Throw"; }; ////////// // item // ////////// datablock ItemData(MagicwandItem) { category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "Add-Ons/Weapon_RPGDefault/shapes/modelwand.dts"; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "Gold Wand"; iconName = "Add-Ons/Weapon_RPGDefault/shapes/icon_rpgwand"; doColorShift = true; colorShiftColor = "0.85 0.79 0.45 1.000"; // Dynamic properties defined by the scripts image = MagicwandImage; canDrop = true; }; //////////////// //weapon image// //////////////// datablock ShapeBaseImageData(MagicwandImage) { // Basic Item properties shapeFile = "Add-Ons/Weapon_RPGDefault/shapes/modelwand.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 0; offset = "0 0 0"; // When firing from a point offset from the eye, muzzle correction // will adjust the muzzle vector to point to the eye LOS point. // Since this weapon doesn't actually fire from the muzzle point, // we need to turn this off. correctMuzzleVector = false; eyeOffset = "0 0 0"; // Add the WeaponImage namespace as a parent, WeaponImage namespace // provides some hooks into the inventory system. className = "WeaponImage"; // Projectile && Ammo. item = MagicwandItem; ammo = " "; projectile = MagicStabProjectile; projectileType = Projectile; //melee particles shoot from eye node for consistancy melee = true; doRetraction = false; //raise your arm up or not armReady = true; //casing = " "; doColorShift = true; colorShiftColor = "0.85 0.79 0.45 1.000"; // 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"; stateTimeoutValue[0] = 0.5; stateTransitionOnTimeout[0] = "Ready"; stateSound[0] = wandDrawSound; stateName[1] = "Ready"; stateTransitionOnTriggerDown[1] = "PreFire"; stateAllowImageChange[1] = true; stateName[2] = "PreFire"; stateScript[2] = "onPreFire"; stateAllowImageChange[2] = false; stateTimeoutValue[2] = 0.1; stateTransitionOnTimeout[2] = "Fire"; stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "CheckFire"; stateTimeoutValue[3] = 0.2; stateFire[3] = true; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateScript[3] = "onFire"; stateWaitForTimeout[3] = true; stateName[4] = "CheckFire"; stateTransitionOnTriggerUp[4] = "StopFire"; stateTransitionOnTriggerDown[4] = "Fire"; stateName[5] = "StopFire"; stateTransitionOnTimeout[5] = "Ready"; stateTimeoutValue[5] = 0.2; stateAllowImageChange[5] = false; stateWaitForTimeout[5] = true; stateSequence[5] = "StopFire"; stateScript[5] = "onStopFire"; }; function MagicwandImage::onPreFire(%this, %obj, %slot) { %obj.playthread(2, armattack); serverPlay3D(wandShoot, %pos); } function MagicwandImage::onStopFire(%this, %obj, %slot) { %obj.playthread(2, root); } package MagicwandPackage { function MagicStabProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client) { %currSlot = %obj.currTool; %client = %obj.sourceObject.client; if(isObject(%col.client.minigame)) { if(%obj.client.minigame $= %col.client.minigame) { if(%col.getClassName() $= "Player") { serverPlay3D(wandPlayerSound, %pos); return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } } } if((%col.getType() && $TypeMasks::FxBrickObjectType)) { serverPlay3D(wandBrickSound, %pos); return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } else { return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } } function WandshotThrowProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client) { if((%col.getType() & $TypeMasks::PlayerObjectType) && isObject(%col.client)) { serverPlay3D(wandPlayerSound, %pos); return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } if((%col.getType() && $TypeMasks::FxBrickObjectType)) { serverPlay3D(wandBrickSound, %pos); return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } else { return Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %client); } } function Armor::onTrigger(%this, %player, %slot, %val) { if(%player.getMountedImage(0) $= MagicwandImage.getID() && %slot $= 4 && %val) { %projectile = WandshotThrowProjectile; %vector = %player.getMuzzleVector(0); %objectVelocity = %player.getVelocity(); %vector1 = VectorScale(%vector, %projectile.muzzleVelocity); %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor); %velocity = VectorAdd(%vector1,%vector2); %p = new Projectile() { dataBlock = %projectile; initialVelocity = %velocity; initialPosition = %player.getMuzzlePoint(0); sourceObject = %player; sourceSlot = 0; client = %player.client; }; serverPlay3D(wandShoot,%player.getPosition()); %player.playthread("3","Activate"); MissionCleanup.add(%p); return %p; } Parent::onTrigger(%this, %player, %slot, %val); } }; activatePackage(MagicwandPackage);