//-- // Strafing runs for third section aweldon Mar 05 //-- void letLooseTheDogsOfWar( entity fighter , entity projectileOne , entity projectileTwo , float burst ) { entity tempTarget = $null_entity; // Master function for firing volleys of missiles at the player. // Declare counter float burstCount = 0; // Check counter against total volleys and valid entity status while( burstCount < burst && isValidEntity( fighter ) ) { vector guessLead = $playerWalker.getLinearVelocity(); //guessLead_x = guessLead_x * 2; //guessLead_y = guessLead_y * 2; vector playerLeading = $playerWalker.getWorldOrigin() + guessLead; sys.setSpawnArg( "classname", "target_null" ); sys.setSpawnArg( "origin", playerLeading ); tempTarget = sys.spawn( "target_null" ); projectileOne.appendTarget( tempTarget ); projectileTwo.appendTarget( tempTarget ); // Fire away! sys.trigger( projectileOne ); sys.wait( .1 ); sys.trigger( projectileTwo ); sys.wait( .3 ); // Increment burst counter burstCount++; tempTarget.remove(); projectileOne.removeTarget( tempTarget ); projectileTwo.removeTarget( tempTarget ); } if( !isValidEntity( fighter ) ) { // Quick check for correctly terminating the function //sys.println( "Caught flyer death, ignoring weapons fire call" ); tempTarget.remove(); } } float lastFighterTookPath = 0; void strafingRun( entity flyer , float activePath ) { // Add functions for each flyer path here if( activePath == 1 ) { // Banking and firing for path 1 setNewTimes( flyer , 1.5 , .5 , .5 ); flyer.rotateOnce( '45 0 0' ); sys.waitFor( flyer ); setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '-60 0 0' ); sys.waitFor( flyer ); thread letLooseTheDogsOfWar( flyer , flyer.getTarget(0) , flyer.getTarget(1), 3 ); flyer.rotateOnce( '30 0 0' ); sys.waitFor( flyer ); setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '-75 0 0' ); } else if( activePath == 2 ) { // Banking and firing for path 2 setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '-45 0 0' ); sys.waitFor( flyer ); setNewTimes( flyer , 2 , .5 , .5 ); flyer.rotateOnce( '60 0 0' ); sys.waitFor( flyer ); thread letLooseTheDogsOfWar( flyer , flyer.getTarget(0) , flyer.getTarget(1), 2 ); setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '-40 0 0' ); sys.waitFor( flyer ); setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '75 0 0' ); } else { // Banking and firing for path 3 setNewTimes( flyer , 1.5 , .5 , .5 ); flyer.rotateOnce( '-45 0 0' ); sys.waitFor( flyer ); setNewTimes( flyer , 2 , .5 , .5 ); flyer.rotateOnce( '60 0 0' ); sys.wait( 1.5 ); thread letLooseTheDogsOfWar( flyer , flyer.getTarget(0) , flyer.getTarget(1), 2 ); sys.waitFor( flyer ); setNewTimes( flyer , 1 , .5 , .5 ); flyer.rotateOnce( '-45 0 0' ); sys.wait( .5 ); thread letLooseTheDogsOfWar( flyer , flyer.getTarget(0) , flyer.getTarget(1), 1 ); sys.waitFor( flyer ); setNewTimes( flyer , 1.5 , .5 , .5 ); flyer.rotateOnce( '75 0 0' ); } } // Base function to run a strafing run on a random spline void startStrafingRun( string basePrefix, string flyPrefix , float numero , float numSplines , string splPrefix ) { // Takes in number of flyer to start on one of the selection of splines float randomPath; entity flyer = sys.getEntity( flyPrefix + numero ); entity flyerBase = sys.getEntity( basePrefix + numero ); // Grab a first attempt at a spline path randomPath = sys.random( 1337 ) * 10000 % numSplines + 1; //sys.println( "Will attempt to path down spline " + randomPath ); while( randomPath == lastFighterTookPath ) { // Re-set random path selection randomPath = sys.random( 1337 ) * 10000 % numSplines + 1; //sys.println( "First attempt failed, will now attempt spline " + randomPath ); sys.waitFrame(); } // Mark this as the most recently used spline lastFighterTookPath = randomPath; entity spline = ( sys.getEntity( splPrefix + randomPath ) ); flyerBase.startSpline( spline ); // Start rotations and rocket volleys thread strafingRun( flyer , randomPath ); sys.waitFor( flyerBase ); if( isValidEntity( flyer ) ) { flyer.remove(); } } void stroggStrafingMayhem( ) { // Define the number of splines to use here: float numSplines = 3; // Define all entity prefixes... prefixi... whatever. string basePrefix = "strafeBase_"; string flyPrefix = "strafingFlyer_"; string splPrefix = "flyerStrafe_"; // Start each strafing run, in this case with a slight random wait time added between each thread startStrafingRun( basePrefix, flyPrefix , 1 , numSplines , splPrefix ); sys.wait( 2 + sys.random(2) ); thread startStrafingRun( basePrefix, flyPrefix , 2 , numSplines , splPrefix ); sys.wait( 2 + sys.random(1) ); thread startStrafingRun( basePrefix, flyPrefix , 3 , numSplines , splPrefix ); sys.wait( 2 + sys.random(2) ); thread startStrafingRun( basePrefix, flyPrefix , 4 , numSplines , splPrefix ); } void stroggFlyerExplosion( entity flyer , entity explosion ) { // Define variables for function entity pilot; vector old; vector new; vector flingPilot; // Calculate velocity vector old = flyer.getWorldOrigin(); sys.waitFrame(); new = flyer.getWorldOrigin(); // Nuke flyer and trigger explosion flyer.hide(); flingPilot = new - old; sys.trigger( explosion ); sys.waitFrame(); // Spawn ragdoll pilot and remove flyer sys.setSpawnArg( "classname", "monster_strogg_marine" ); sys.setSpawnArg( "origin", explosion.getWorldOrigin() + '0 0 64'); pilot = sys.spawn( "monster_strogg_marine" ); pilot.kill(); flyer.remove(); sys.waitFrame(); // Establish velocity for flinging pilot flingPilot_x = 300*flingPilot_x; flingPilot_y = 300*flingPilot_y; flingPilot_z = 3000; //sys.println( flingPilot ); // Make that ragdoll fly! pilot.setLinearVelocity( flingPilot ); } void stroggExplode_1() { thread stroggFlyerExplosion( $strafingFlyer_1 , $flyerStrafeExplode_1 ); } void stroggExplode_2() { thread stroggFlyerExplosion( $strafingFlyer_2 , $flyerStrafeExplode_2 ); } void stroggExplode_3() { thread stroggFlyerExplosion( $strafingFlyer_3 , $flyerStrafeExplode_3 ); } void stroggExplode_4() { thread stroggFlyerExplosion( $strafingFlyer_4 , $flyerStrafeExplode_4 ); } //-- // End strafing runs