SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(isObject(Meltdown))
  2.    Meltdown.DSOFileCount++;
  3. else
  4.    quit();
  5.  
  6. $WarpSpeedLimit = 4500;
  7. $WarpMassImpulseFactor = 10;
  8.  
  9. //**************************************************************
  10. // Warp FLIER
  11. //**************************************************************
  12.  
  13. datablock FlyingVehicleData(WarpFlyer) : ShrikeDamageProfile
  14. {
  15.    spawnOffset = "0 0 2";
  16.  
  17.    catagory = "Vehicles";
  18.    shapeFile = "vehicle_air_scout.dts";
  19.    multipassenger = false;
  20.  
  21.    debrisShapeName = "vehicle_air_scout_debris.dts";
  22.    debris = ShapeDebris;
  23.    renderWhenDestroyed = false;
  24.  
  25.    drag    = 0.15;
  26.    density = 1.0;
  27.  
  28.    mountPose[0] = sitting;
  29.    numMountPoints = 1;  
  30.    isProtectedMountPoint[0] = true;
  31.    cameraMaxDist = 15;
  32.    cameraOffset = 2.5;
  33.    cameraLag = 0.9;
  34.    explosion = VehicleExplosion;
  35.     explosionDamage = 1.25;
  36.     explosionRadius = 12.5;
  37.  
  38.    keepReticle = true;
  39.    
  40.    maxDamage = 1.40;
  41.    destroyedLevel = 1.40;
  42.  
  43.    isShielded = true;
  44.    energyPerDamagePoint = 100;
  45.    maxEnergy = 290;      // Afterburner and any energy weapon pool
  46.    minDrag = 30;           // Linear Drag (eventually slows you down when not thrusting...constant drag)
  47.    rotationalDrag = 900;        // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
  48.    rechargeRate = 0.825;
  49.  
  50.    maxAutoSpeed = 10;       // Autostabilizer kicks in when less than this speed. (meters/second)
  51.    autoAngularForce = 350;       // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
  52.    autoLinearForce = 215;        // Linear stabilzer force (this slows you down when autostabilizer kicks in)
  53.    autoInputDamping = 0.95;      // Dampen control input so you don't` whack out at very slow speeds
  54.    
  55.    // Maneuvering
  56.    maxSteeringAngle = 5;    // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
  57.    horizontalSurfaceForce = 6;   // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
  58.    verticalSurfaceForce = 4;     // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
  59.    maneuveringForce = 3200;      // Horizontal jets (W,S,D,A key thrust)
  60.    steeringForce = 1250;         // Steering jets (force applied when you move the mouse)
  61.    steeringRollForce = 425;      // Steering jets (how much you heel over when you turn)
  62.    rollForce = 4;                // Auto-roll (self-correction to right you after you roll/invert)
  63.    hoverHeight = 3;        // Height off the ground at rest
  64.    createHoverHeight = 3;  // Height off the ground when created
  65.    maxForwardSpeed = 1500;
  66.  
  67.    // Turbo Jet
  68.    jetForce = 3500;      // Afterburner thrust (this is in addition to normal thrust)
  69.    minJetEnergy = 16;     // Afterburner can't be used if below this threshhold.
  70.    jetEnergyDrain = 2.6;       // Energy use of the afterburners (low number is less drain...can be fractional)                                                                                                                                                                                                                                                                                          // Auto stabilize speed
  71.    vertThrustMultiple = 2.15;
  72.  
  73.    // Rigid body
  74.    mass = 150;        // Mass of the vehicle
  75.    bodyFriction = 0;     // Don't mess with this.
  76.    bodyRestitution = 0.5;   // When you hit the ground, how much you rebound. (between 0 and 1)
  77.    minRollSpeed = 0;     // Don't mess with this.
  78.    softImpactSpeed = 25;       // Sound hooks. This is the soft hit.
  79.    hardImpactSpeed = 55.56;    // Sound hooks. This is the hard hit.
  80.  
  81.    // Ground Impact Damage (uses DamageType::Ground)
  82.    minImpactSpeed = 12;      // If hit ground at speed above this then it's an impact. Meters/second
  83.    speedDamageScale = 0.03;
  84.  
  85.    // Object Impact Damage (uses DamageType::Impact)
  86.    collDamageThresholdVel = 48.0;
  87.    collDamageMultiplier   = 0.0125;
  88.  
  89.    //
  90.    minTrailSpeed = 200;      // The speed your contrail shows up at.
  91.    trailEmitter = ContrailEmitter;
  92.    forwardJetEmitter = ShrikeEngineEmitter;
  93.    downJetEmitter = TurboJetEmitter;
  94.  
  95.    //
  96.    jetSound = ScoutFlyerThrustSound;
  97.    engineSound = ScoutFlyerEngineSound;
  98.    softImpactSound = SoftImpactSound;
  99.    hardImpactSound = HardImpactSound;
  100.    //wheelImpactSound = WheelImpactSound;
  101.    
  102.    //
  103.    softSplashSoundVelocity = 10.0;
  104.    mediumSplashSoundVelocity = 15.0;  
  105.    hardSplashSoundVelocity = 20.0;  
  106.    exitSplashSoundVelocity = 10.0;
  107.    
  108.    exitingWater      = VehicleExitWaterMediumSound;
  109.    impactWaterEasy   = VehicleImpactWaterSoftSound;
  110.    impactWaterMedium = VehicleImpactWaterMediumSound;
  111.    impactWaterHard   = VehicleImpactWaterMediumSound;
  112.    waterWakeSound    = VehicleWakeMediumSplashSound;
  113.    
  114.    dustEmitter = VehicleLiftoffDustEmitter;
  115.    triggerDustHeight = 4.0;
  116.    dustHeight = 1.0;
  117.  
  118.    damageEmitter[0] = SmallHeavyDamageSmoke;
  119.    damageEmitter[1] = SmallRedFlameEmitter;
  120.    damageEmitter[2] = DamageBubbles;
  121.    damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
  122.    damageLevelTolerance[0] = 0.4;
  123.    damageLevelTolerance[1] = 0.4;
  124.    numDmgEmitterAreas = 1;
  125.  
  126.    minMountDist = 4;
  127.  
  128.    splashEmitter[0] = VehicleFoamDropletsEmitter;
  129.    splashEmitter[1] = VehicleFoamEmitter;
  130.  
  131.    shieldImpact = VehicleShieldImpact;
  132.  
  133.    cmdCategory = "Tactical";
  134.    cmdIcon = CMDFlyingScoutIcon;
  135.    cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
  136.    targetNameTag = 'Camanis*';
  137.    targetTypeTag = 'Hypergrav';
  138.    sensorData = AWACPulseSensor;
  139.    sensorRadius = AWACPulseSensor.detectRadius;
  140.    sensorColor = "255 194 9";
  141.  
  142.    checkRadius = 5.5;
  143.    observeParameters = "1 10 10";
  144.  
  145. //   runningLight[0] = ShrikeLight1;
  146. //   runningLight[1] = ShrikeLight2;
  147.  
  148.    shieldEffectScale = "0.937 1.125 0.60";
  149.  
  150. };
  151.  
  152. //**************************************************************
  153. // WEAPONS
  154. //**************************************************************
  155.  
  156. datablock ShapeBaseImageData(WarpPlasmaMainImage)
  157. {
  158.    className = WeaponImage;
  159.    shapeFile = "turret_mortar_large.dts";
  160.    item      = Chaingun;
  161.    projectile = WarpGaussBullet;
  162.    projectileType = TracerProjectile;
  163.  
  164.    mountPoint = 10;
  165.    offset = "0 3 -0.45";
  166.    rotation = "0 1 0 0";
  167.  
  168.    usesEnergy = true;
  169.    useMountEnergy = true;
  170.    // DAVEG -- balancing numbers below!
  171.    minEnergy = 10;
  172.    fireEnergy = 5;
  173.    fireTimeout = 250;
  174.  
  175.    //--------------------------------------
  176.    stateName[0]             = "Activate";
  177.    stateSequence[0]         = "Deploy";
  178.    stateAllowImageChange[0] = false;
  179.    stateTimeoutValue[0]        = 0.05;
  180.    stateTransitionOnTimeout[0] = "Ready";
  181.    stateTransitionOnNoAmmo[0]  = "NoAmmo";
  182.    //--------------------------------------
  183.    stateName[1]       = "Ready";
  184.    stateTransitionOnTriggerDown[1] = "Spinup";
  185.    stateTransitionOnNoAmmo[1]      = "NoAmmo";
  186.    //--------------------------------------
  187.    stateName[2]               = "NoAmmo";
  188.    stateTransitionOnAmmo[2]   = "Ready";
  189.    stateTransitionOnTriggerDown[2] = "DryFire";
  190.    //--------------------------------------
  191.    stateName[3]         = "Spinup";
  192.    stateTimeoutValue[3]          = 0.01;
  193.    stateWaitForTimeout[3]        = false;
  194.    stateTransitionOnTimeout[3]   = "Fire";
  195.    stateTransitionOnTriggerUp[3] = "Spindown";
  196.    //--------------------------------------
  197.    stateName[4]             = "Fire";
  198.    stateAllowImageChange[4] = false;
  199.    stateScript[4]           = "onFire";
  200.    stateFire[4]             = true;
  201.    stateSequence[4]         = "Recoil";
  202.    stateSound[4]            = PlasmaFireSound;
  203.    // IMPORTANT! The stateTimeoutValue below has been replaced by fireTimeOut
  204.    // above.
  205.    stateTimeoutValue[4]          = 0.25;
  206.    stateTransitionOnTimeout[4]   = "checkState";
  207.    //--------------------------------------
  208.    stateName[5]       = "Spindown";
  209.    stateSpinThread[5] = SpinDown;
  210.    stateTimeoutValue[5]            = 0.05;
  211.    stateSequence[5]         = "Fire";
  212.    stateWaitForTimeout[5]          = false;
  213.    stateTransitionOnTimeout[5]     = "Ready";
  214.    stateTransitionOnTriggerDown[5] = "Spinup";
  215.    //--------------------------------------
  216.    stateName[6]       = "EmptySpindown";
  217.    stateTransitionOnAmmo[6]   = "Ready";
  218.    stateTimeoutValue[6]        = 0.01;
  219.    stateTransitionOnTimeout[6] = "NoAmmo";
  220.    //--------------------------------------
  221.    stateName[7]       = "DryFire";
  222.    stateSound[7]      = ShrikeBlasterDryFireSound;
  223.    stateTransitionOnTriggerUp[7] = "NoAmmo";
  224.    stateTimeoutValue[7]        = 0.25;
  225.    stateTransitionOnTimeout[7] = "NoAmmo";
  226.  
  227.    stateName[8] = "checkState";
  228.    stateTransitionOnTriggerUp[8] = "Spindown";
  229.    stateSequence[8]         = "Fire_Vis";
  230.    stateTransitionOnNoAmmo[8]    = "EmptySpindown";
  231.    stateTimeoutValue[8]          = 0.01;
  232.    stateTransitionOnTimeout[8]   = "ready";
  233. };
  234.  
  235. datablock ShapeBaseImageData(WarpPlasmaSideAImage) : WarpPlasmaMainImage
  236. {
  237.    shapeFile = "turret_tank_barrelmortar.dts";
  238.    offset = "5.25 -3.5 0.75";
  239.    rotation = "0 1 0 90";
  240.  
  241.    stateScript[3]           = "onTriggerDown";
  242.    stateScript[5]           = "onTriggerUp";
  243.    stateScript[6]           = "onTriggerUp";
  244.    stateSequence[4]         = "Recoil";
  245. //   stateSequence[5]         = "Fire_Vis";
  246. //   stateSequence[8]         = "Fire_Vis";
  247. };
  248.  
  249. datablock ShapeBaseImageData(WarpPlasmaSideBImage) : WarpPlasmaMainImage
  250. {
  251.    shapeFile = "turret_tank_barrelmortar.dts";
  252.    offset = "-5.25 -3.5 0.75"; //-1.5";
  253.    rotation = "0 1 0 -90";
  254.  
  255.    stateScript[3]           = "onTriggerDown";
  256.    stateScript[5]           = "onTriggerUp";
  257.    stateScript[6]           = "onTriggerUp";
  258.    stateSequence[4]         = "Recoil";
  259. //   stateSequence[5]         = "Recoil";
  260. //   stateSequence[8]         = "Recoil";
  261. };
  262.  
  263. datablock ShapeBaseImageData(WarpFlyerParam)
  264. {
  265.    mountPoint = 2;
  266.    shapeFile = "turret_muzzlepoint.dts";
  267.  
  268.    projectile = PlasmaBolt;
  269.    projectileType = LinearFlareProjectile;
  270. };
  271.  
  272. function WarpFlyer::onTrigger(%data, %obj, %trigger, %state)
  273. {
  274.      if(%trigger == 0)
  275.      {
  276.           if(%obj.selectedWeapon == 1)
  277.           {
  278.                %obj.setImageTrigger(2, false);
  279.                %obj.setImageTrigger(3, false);
  280.                %obj.setImageTrigger(4, false);
  281.  
  282.                switch(%state)
  283.                {
  284.                    case 0:
  285.                    %obj.fireWeapon = false;
  286.                    %obj.setImageTrigger(2, false);
  287.                    %obj.setImageTrigger(3, false);
  288.                    %obj.setImageTrigger(4, false);
  289.                    case 1:
  290.                    %obj.fireWeapon = true;
  291.                    if(%obj.nextWeaponFire == 2)
  292.                    {
  293.                          %obj.setImageTrigger(2, true);
  294.                          %obj.setImageTrigger(3, false);
  295.                          %obj.setImageTrigger(4, false);
  296.                    }
  297.                    if(%obj.nextWeaponFire == 3)
  298.                    {
  299.                          %obj.setImageTrigger(2, false);
  300.                          %obj.setImageTrigger(3, true);
  301.                          %obj.setImageTrigger(4, false);
  302.                    }
  303.                    else
  304.                    {
  305.                          %obj.setImageTrigger(2, false);
  306.                          %obj.setImageTrigger(3, false);
  307.                          %obj.setImageTrigger(4, true);
  308.                    }
  309.                }
  310.           }
  311.      }
  312. }
  313.  
  314. //=============================================================================
  315.  
  316. datablock ShapeBaseImageData(CamanisMuzzleImage)
  317. {
  318.    shapeFile = "vehicle_grav_scout.dts";
  319.    offset = "0 5.5 -1";
  320. //   rotation = "0 1 0 90";
  321. };
  322.  
  323. datablock ShapeBaseImageData(GenWing1Image)
  324. {
  325.    shapeFile = "station_generator_large.dts";
  326.  
  327.    mountPoint = 1;
  328.    offset = "-2 1 0";
  329.    rotation = "0 1 0 90";
  330.  
  331.    stateName[0]             = "Idle";
  332.    stateSequence[0]         = "Power";
  333. };
  334.  
  335. datablock ShapeBaseImageData(GenWing2Image)
  336. {
  337.    shapeFile = "station_generator_large.dts";
  338.  
  339.    mountPoint = 1;
  340.    offset = "2 1 0";
  341.    rotation = "0 1 0 -90";
  342.  
  343.    stateName[0]             = "Idle";
  344.    stateSequence[0]         = "Power";
  345. };
  346.  
  347. datablock StaticShapeData(WarpBubble)
  348. {
  349.    shapeFile = "grenade_flare.dts";
  350. };
  351.  
  352. datablock StaticShapeData(WarpCore)
  353. {
  354.    shapeFile = "station_generator_large.dts";
  355. //   emap = true;
  356.    maxDamage = WarpFlyer.maxDamage;
  357.    destroyedLevel = WarpFlyer.destroyedLevel;
  358. };
  359.  
  360. function WarpCore::onDamage(%data, %obj)
  361. {
  362.    %newDamageVal = %obj.getDamageLevel();
  363.    if(%obj.lastDamageVal !$= "")
  364.       if(isObject(%obj.getObjectMount()) && %obj.lastDamageVal > %newDamageVal)
  365.          %obj.getObjectMount().setDamageLevel(%newDamageVal);
  366.    %obj.lastDamageVal = %newDamageVal;
  367. }
  368.  
  369. function WarpCore::damageObject(%this, %targetObject, %sourceObject, %position, %amount, %damageType ,%vec, %client, %projectile)
  370. {
  371.    //If vehicle turret is hit then apply damage to the vehicle
  372.    %vehicle = %targetObject.getObjectMount();
  373.    if(%vehicle)
  374.       %vehicle.getDataBlock().damageObject(%vehicle, %sourceObject, %position, %amount, %damageType, %vec, %client, %projectile);
  375. }
  376.  
  377. datablock StaticShapeData(HoleEntry)
  378. {
  379.    shapeFile = "energy_explosion.dts";
  380. };
  381.  
  382. datablock StaticShapeData(Subspace)
  383. {
  384.    shapeFile = "grenade_flare.dts";
  385. };
  386.  
  387. datablock ShockLanceProjectileData(GeneratorPowerup)
  388. {
  389.    directDamage        = 0;
  390.    radiusDamageType    = $DamageType::Default;
  391.    kickBackStrength    = 0;
  392.    velInheritFactor    = 0;
  393.    sound               = "";
  394.  
  395.    zapDuration = 6;
  396.    impulse = 0;
  397.    boltLength = 14.0;
  398.    extension = 14.0;            // script variable indicating distance you can shock people from
  399.    lightningFreq = 50.0;
  400.    lightningDensity = 18.0;
  401.    lightningAmp = 0.25;
  402.    lightningWidth = 0.05;
  403.  
  404.  
  405.    boltSpeed[0] = 2.0;
  406.    boltSpeed[1] = -0.5;
  407.  
  408.    texWrap[0] = 1.5;
  409.    texWrap[1] = 1.5;
  410.  
  411.    startWidth[0] = 0.3;
  412.    endWidth[0] = 0.6;
  413.    startWidth[1] = 0.3;
  414.    endWidth[1] = 0.6;
  415.  
  416.    texture[0] = "special/jammermap";
  417.    texture[1] = "special/jammermap";
  418.    texture[2] = "special/cloaktexture";
  419.    texture[3] = "special/jammermap";
  420. };
  421.  
  422. datablock ShockLanceProjectileData(BlueShift)
  423. {
  424.    directDamage        = 0;
  425.    radiusDamageType    = $DamageType::Default;
  426.    kickBackStrength    = 0;
  427.    velInheritFactor    = 0;
  428.    sound               = "";
  429.  
  430.    zapDuration = 0.4;
  431.    impulse = 0;
  432.    boltLength = 14.0;
  433.    extension = 14.0;            // script variable indicating distance you can shock people from
  434.    lightningFreq = 50.0;
  435.    lightningDensity = 18.0;
  436.    lightningAmp = 0.25;
  437.    lightningWidth = 0.05;
  438.  
  439.  
  440.    boltSpeed[0] = 2.0;
  441.    boltSpeed[1] = -0.5;
  442.  
  443.    texWrap[0] = 1.5;
  444.    texWrap[1] = 1.5;
  445.  
  446.    startWidth[0] = 0.3;
  447.    endWidth[0] = 0.6;
  448.    startWidth[1] = 0.3;
  449.    endWidth[1] = 0.6;
  450.  
  451.    texture[0] = "special/shieldenvmap";
  452.    texture[1] = "special/shieldmap";
  453.    texture[2] = "special/shieldenvmap";
  454.    texture[3] = "special/shieldmap";
  455. };
  456.  
  457. function WarpFlyer::playerDismounted(%data, %obj, %player)
  458. {
  459.    %obj.fireWeapon = false;
  460.    %obj.setImageTrigger(2, false);
  461.    %obj.setImageTrigger(3, false);
  462.    %obj.setImageTrigger(4, false);
  463.    setTargetSensorGroup(%obj.getTarget(), %obj.team);
  464. }
  465.  
  466. function WarpPlasmaMainImage::onFire(%data,%obj,%slot)
  467. {
  468.    Parent::onFire(%data,%obj,%slot);
  469.    %obj.nextWeaponFire = 3;
  470.    schedule(250, 0, "fireNextWarp", %obj);
  471. }
  472.  
  473. function WarpPlasmaSideAImage::onFire(%data,%obj,%slot)
  474. {
  475.    Parent::onFire(%data,%obj,%slot);
  476.    %obj.nextWeaponFire = 4;
  477.    schedule(250, 0, "fireNextWarp", %obj);
  478. }
  479.  
  480. function WarpPlasmaSideBImage::onFire(%data,%obj,%slot)
  481. {
  482.    Parent::onFire(%data,%obj,%slot);
  483.    %obj.nextWeaponFire = 2;
  484.    schedule(250, 0, "fireNextWarp", %obj);
  485. }
  486.  
  487. //Warp core functions
  488.  
  489. function WSInitCore(%obj)
  490. {
  491.    if(!isObject(%obj))
  492.       return;
  493.  
  494.    if(%obj.WarpCoreActive)
  495.    {
  496.       %obj.zapCnt++;
  497.       if(%obj.zapCnt > 4)
  498.       {
  499.          if(!isObject(%obj.client.player))
  500.             return;
  501.          %obj.client.player.zap = new ShockLanceProjectile()
  502.          {
  503.             dataBlock        = "blueshift";
  504.             initialDirection = "0 0 -0.5";
  505.             initialPosition  = vectorAdd(%obj.client.player.getPosition(), "0 0 0.6");
  506.             sourceObject     = %obj;
  507.             sourceSlot       = 0;
  508.             targetId         = %obj;
  509.          };
  510.          MissionCleanup.add(%obj.client.player.zap);
  511.  
  512.          %obj.client.player.zap2 = new ShockLanceProjectile()
  513.          {
  514.             dataBlock        = "blueshift";
  515.             initialDirection = "0 0 -0.5";
  516.             initialPosition  = vectorAdd(%obj.client.player.getPosition(), "0 0 0.6");
  517.             sourceObject     = %obj;
  518.             sourceSlot       = 0;
  519.             targetId         = %obj.core;
  520.          };
  521.          MissionCleanup.add(%obj.client.player.zap2);
  522.          %obj.zapCnt = 0;
  523.       }
  524.    }
  525.  
  526.    %obj.nacellePct++;
  527.    %out = graphBar100(%obj.nacellePct);
  528.  
  529.    if(%obj.nacellePct < 33)
  530.       %color = "<color:FF0000>";
  531.    else if(%obj.nacellePct < 66)
  532.       %color = "<color:FFFF00>";
  533.    else
  534.       %color = "<color:00FF00>";
  535.  
  536.    %nacelleFX = %color @ %obj.nacellePct;
  537.    commandToClient( %obj.client, 'BottomPrint', "<color:00FF11><font:sui generis:18>Warp core charging: "@%nacelleFX@"%\n"@%out, 5, 2);
  538.  
  539.    if(%obj.nacellePct <= 100)
  540.       schedule(50, 0, "WSInitCore", %obj);
  541.    else
  542.    {
  543.       %obj.setFrozenState(true);
  544.  
  545.       %pos = %obj.getPosition();
  546.       %nvec = vectorNormalize(%obj.getMuzzleVector(0));
  547.       %vec = vectorScale(%nvec, 25);
  548.       %new = vectorAdd(%pos, %vec);
  549.  
  550.       %wormhole = new StaticShape()
  551.       {
  552.          scale = "15 15 15";
  553.          dataBlock = "Subspace";
  554.       };
  555.       MissionCleanup.add(%wormhole);
  556.       %obj.wormhole = %wormhole;
  557.       %wormhole.setPosition(%new);
  558.       %wormhole.playThread(0, "throw");
  559.       %wormhole.startfade(1000, 0, false);
  560.  
  561.       %pos2 = %obj.getPosition();
  562.       %nvec2 = vectorNormalize(%obj.getMuzzleVector(0));
  563.       %vec2 = vectorScale(%nvec2, -13);
  564.       %new2 = vectorAdd(%pos2, %vec2);
  565.  
  566.       %wormhole2 = new StaticShape()
  567.       {
  568.          scale = "50 50 50";
  569.          dataBlock = "HoleEntry";
  570.       };
  571.       MissionCleanup.add(%wormhole2);
  572.       %obj.wormhole2 = %wormhole2;
  573.       %wormhole2.setPosition(%new2);
  574.       %wormhole2.playThread(0, "ambient");
  575.       %wormhole2.startfade(1000, 0, false);
  576.       %wormhole2.setRotation(%obj.getRotation());
  577.  
  578.       %obj.applyImpulse(%obj.getTransform(), %obj.impulse);
  579.       schedule(500, 0, "WSPhase2", %obj);
  580.    }
  581. }
  582.  
  583. function WSPhase2(%obj)
  584. {
  585.    if(isObject(%obj) && %obj.WarpCoreActive)
  586.    {
  587.       %obj.zapcnt++;
  588.  
  589.       if(%obj.zapCnt > 3)
  590.       {
  591.           %field = %obj.getMountNodeObject(6);
  592.           %core = %obj.getMountNodeObject(7);
  593.  
  594.           %obj.client.player.zap = new ShockLanceProjectile()
  595.           {
  596.                dataBlock        = "firelancebolt";
  597.                initialDirection = "0 0 -0.5";
  598.                initialPosition  = vectorAdd(%obj.client.player.getPosition(), "0 0 0.6");
  599.                sourceObject     = %obj;
  600.                sourceSlot       = 0;
  601.                targetId         = %obj;
  602.           };
  603.           MissionCleanup.add(%obj.client.player.zap);
  604.  
  605.           %obj.client.player.zap2 = new ShockLanceProjectile()
  606.           {
  607.                dataBlock        = "basicshocker";
  608.                initialDirection = "0 0 -0.5";
  609.                initialPosition  = vectorAdd(%obj.client.player.getPosition(), "0 0 0.6");
  610.                sourceObject     = %obj;
  611.                sourceSlot       = 0;
  612.                targetId         = %core;
  613.           };
  614.           MissionCleanup.add(%obj.client.player.zap2);
  615.           %obj.zapCnt = 0;
  616.       }
  617.  
  618.       %obj.nacellePct = 0; // reset fun time :)
  619.       %obj.chargingWarp = true;
  620.       %vec = vectorScale(%obj.getMuzzleVector(0), (3 + getRandomT()));
  621.       %force = %obj.getDatablock().mass;
  622.       %newVec = VectorScale(%vec, %force);
  623.       %obj.impulse = %newVec;
  624.       %obj.applyImpulse(%obj.getTransform(), %obj.impulse);
  625.       %obj.vel = velToSingle(%obj.getVelocity());
  626.       %obj.load = msToKPH(%obj.vel);
  627.       %obj.wcLoad = (mSqrt(cube(%obj.load * 2.6) / (3.14 * (22/7)))) / 2;
  628.       %obj.wclPct = mFloor((%obj.wcLoad / 16000) * 100);
  629.  
  630. //      %out = graphBar100(%obj.wclPct);
  631.       commandToClient( %obj.client, 'BottomPrint', "<color:CCCC11><font:sui generis:18>Warp Core Load: "@%obj.wcLoad@" / 16000 ("@%obj.wclPct@"%)", 5, 1);
  632.  
  633.       if(%obj.vel < 237.5)
  634.          schedule(100, 0, "WSPhase2", %obj);
  635.       else
  636.       {
  637.          commandToClient(%obj.client, 'BottomPrint', "<color:FF0000><font:sui generis:32>>>>CRITICAL MASS<<<<", 5, 2);
  638.          %obj.setCloaked(true);
  639.          %obj.core.setCloaked(true);
  640.          schedule(1000, 0, "WSPhase3", %obj);
  641.       }
  642.    }
  643. }
  644.  
  645. function WSPhase3(%obj)
  646. {
  647.      if(isObject(%obj) && %obj.WarpCoreActive)
  648.      {
  649.           %obj.setFrozenState(false);
  650.           %obj.playShieldEffect("0.0 0.0 1.0");
  651.           %obj.applyImpulse(%obj.getPosition(), %obj.vel);
  652.           %obj.wormhole.startfade(5000, 0, true);
  653.           %obj.wormhole2.startfade(5000, 0, true);
  654.           WSPhase4(%obj);
  655.      }
  656. }
  657.  
  658. function WSPhase4(%obj)
  659. {
  660.      if(isObject(%obj) && %obj.WarpCoreActive && %obj.getMountedObject(0))
  661.      {
  662.           %obj.setCloaked(false);
  663.           %obj.core.setCloaked(false);
  664.           %obj.maxSpeed = msToKPH(velToSingle(%obj.getVelocity()));
  665.           %obj.inWarp = true;
  666.           %obj.chargingWarp = false;
  667.           %vec = vectorNormalize(%obj.getForwardVector());//%obj.getMuzzleVector(7);
  668.           if(%obj.maxSpeed > $WarpSpeedLimit) // 5375 // 694.444 m/s
  669.               %force = %obj.getDatablock().mass*5;
  670.           else
  671.               %force = %obj.getDatablock().mass*$WarpMassImpulseFactor;
  672.           %newVec = VectorScale(%vec, %force);
  673.           %obj.applyImpulse(%obj.getTransform(), %newVec);
  674.           %obj.spd = velToSingle(%obj.getVelocity());
  675.           %obj.spdNrm = msToKPH(%obj.spd) / 1000;
  676.           %obj.wcCount += 1;
  677.           %obj.wcMax = 100;
  678.           %obj.wcPct = mFloor(%obj.wcCount / %obj.wcMax);
  679.  
  680. //          %out = graphBar100R(%obj.wcPct, 75, 85, false);
  681.  
  682.           if(%obj.getMountNodeObject(0) && %obj.getMountedObject(0))
  683.                commandToClient(%obj.client, 'BottomPrint', "Speed: Warp "@%obj.spdNrm@" >> "@velToSingle(%obj.getVelocity())@" m/s | Warp Core Stress: "@%obj.wcPct@"%", 2, 1);
  684.  
  685.           if(%obj.wcPct < 100)
  686.                schedule(50, 0, "WSPhase4", %obj);
  687.           else
  688.           {
  689.                if(%obj.getDamageState() !$= Destroyed)      // hehe
  690.                     %obj.setDamageState(Destroyed);
  691.           }
  692.      }
  693.      else if(isObject(%obj))
  694.          warpCoreCoolDown(%obj);
  695. }
  696.  
  697. function warpCoreCoolDown(%obj)
  698. {
  699.      if(isObject(%obj) && !%obj.inWarp)
  700.      {
  701.           if(%obj.wcCount > 4)
  702.                %obj.wcCount -= 4;
  703.  
  704.           schedule(200, 0, "warpCoreCoolDown", %obj);
  705.      }
  706. }
  707.  
  708. function enableWarp(%a)
  709. {
  710.    %a.haltInfoBar = false;
  711.    %a.canWarp = true;
  712. }
  713.  
  714. function InitWarpCore(%obj)
  715. {
  716.    if(!%obj.canWarp)
  717.       return;
  718.  
  719.    if(!%obj.WarpCoreActive)
  720.    {
  721.       %obj.WarpCoreActive = true;
  722.       %obj.nacellePct = 0;
  723.       %obj.chargingWarp = false;
  724.       %obj.inWarp = false;
  725.  
  726.       %obj.client.player.zap = new ShockLanceProjectile()
  727.       {
  728.          dataBlock        = "generatorPowerup";
  729.          initialDirection = "0 0 -0.5";
  730.          initialPosition  = vectorAdd(%obj.client.player.getPosition(), "0 0 0.6");
  731.          sourceObject     = %obj;
  732.          sourceSlot       = 0;
  733.          targetId         = %obj.core;
  734.       };
  735.       %obj.haltInfoBar = true;
  736.       MissionCleanup.add(%obj.client.player.zap);
  737.       %obj.field.startFade(4500, 0, false);
  738.       commandToClient( %obj.client, 'BottomPrint', "<font:sui generis:18>Warp Core powering up...", 5, 1); // This should be interesting.....
  739.       schedule(4500, 0, "WSInitCore", %obj);
  740.    }
  741.    else //if(%obj.WarpCoreActive && (%obj.chargingWarp || %obj.inWarp))
  742.    {
  743.       if(isObject(%obj.wormhole))
  744.          %obj.wormhole.delete();
  745.       if(isObject(%obj.wormhole2))
  746.          %obj.wormhole2.delete();
  747.  
  748.       %obj.canWarp = false;
  749.       %obj.setCloaked(false);
  750.       %obj.core.setCloaked(false);
  751.       %obj.WarpCoreActive = false;
  752.       %obj.setFrozenState(false);
  753.       %obj.field.startFade(1500, 0, true);
  754.       commandtoClient( %obj.client, 'BottomPrint', "<font:sui generis:18>Warp Core powering down.", 5, 1); // This should be interesting.....
  755.       schedule(5000, 0, "enableWarp", %obj);
  756.    }
  757. }
RAW Paste Data
Top