THREAD: Stunt plane
  1. 01-01-2013, 05:56 PM
    758
    Posts
    10,390
    Reputation
    Jun 2010
    NextGenUpdate
    This mod was orginally made by x_DaftVader_x for cod4, I thought this was pretty cool so I converted it to mw2. Took me a while but I finally got it to work.




    StuntRun()
    {
    gun=self getcurrentweapon();
    self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
    self.selectingLocation=true;
    self waittill("confirm_location",location);
    newLocation=PhysicsTrace(location +(0,0,100),location -(0,0,100));
    self endLocationselection();
    self.selectingLocation=undefined;
    wait 0.5;
    self takeweapon("briefcase_bomb_mp");
    wait 0.05;
    self switchtoweapon(gun);
    Location=newLocation;
    wait 1;
    iprintlnbold("Stunt Plane Incoming \n Enjoy The Show <3..");
    wait 1.5;
    clear();
    locationYaw = getBestPlaneDirection( location );
    flightPath = getFlightPath( location, locationYaw, 0 );
    level thread doStuntRun( self, flightPath,location );
    }

    doStuntRun( owner, flightPath, location )
    {
    level endon( "game_ended" );
    if ( !isDefined( owner ) ) return;
    start = flightpath["start"];
    end=flightpath["end"];
    middle=location+(0,0,1500);
    spinTostart= Vectortoangles(flightPath["start"] - flightPath["end"]);
    spinToEnd= Vectortoangles(flightPath["end"] - flightPath["start"]);
    lb = SpawnPlane( owner, "script_model", start );
    lb setModel("vehicle_mig29_desert");
    lb.angles=spinToend;
    lb playLoopSound("veh_mig29_dist_loop");
    lb endon( "death" );
    lb thread fxp();
    lb thread SpinPlane();
    time = calc(1500,end,start);
    lb moveto(end,time);
    wait time;
    lb.angles=spinToStart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread planeyaw();
    lb waittill("yawdone");
    lb.angles=spinToStart;
    time=calc(1500,lb.origin,start);
    lb moveto(start,time);
    wait time;
    lb.angles=spinToEnd;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread loopdaloop();
    lb waittill("looped");
    lb rotateto(spinToEnd,0.5);
    time=calc(1500,lb.origin,end);
    lb thread spinPlane();
    lb moveto(end,time);
    wait time;
    lb.angles=spinTostart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    wait 2;
    lb thread planebomb(owner);
    wait 5;
    lb moveto(start,time);
    wait time;
    lb notify("planedone");
    lb delete();
    }


    fxp()
    {
    self endon("planedone");
    for(;Winky Winky
    {
    playfxontag( level.noobeffect, self, "tag_engine_right" );
    playfxontag( level.noobeffect, self, "tag_engine_left" );
    playfxontag( level.noobeffect, self, "tag_right_wingtip" );
    playfxontag( level.noobeffect, self, "tag_left_wingtip" );
    wait 0.3;
    }
    }
    SpinPlane()
    {
    self endon("stopspinning");
    for(i=0;i<10;i++)
    {
    self rotateroll(360,2);
    wait 2;
    }
    self notify("stopspinning");
    }
    clear()
    {
    }
    PlaneYaw()
    {
    self endon("yawdone");
    move=80;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(6,0.05);
    wait 0.05;
    }
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(-6,0.05);
    wait 0.05;
    }
    self notify("yawdone");
    }
    Loopdaloop()
    {
    self endon("looped");
    move=60;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotatepitch(-6,0.05);
    wait 0.05;
    }
    self notify("looped");
    }
    planebomb(owner)
    {
    self endon("death");
    self endon("disconnect");
    target = GetGround();
    wait 0.05;
    bomb = spawn("script_model",self.origin-(0,0,80) );
    bomb setModel("projectile_cbu97_clusterbomb");
    bomb.angles=self.angles;
    // bomb.KillCamEnt=bomb;
    wait 0.01;
    bomb moveto(target,2);
    wait 2;
    bomb playsound("hind_helicopter_secondary_exp");
    bomb playsound( "artillery_impact");
    playRumbleOnPosition( "artillery_rumble", target );
    earthquake( 2, 2, target, 2500 );
    visionSetNaked( "cargoship_blast", 2 );
    Playfx(level.firework,bomb.origin );
    Playfx(level.expbullt,bomb.origin );
    Playfx(level.bfx,bomb.origin );
    wait 0.5;
    RadiusDamage(self.origin, 100000, 100000, 99999, owner, "MOD_PROJECTILE_SPLASH","artillery_mp");
    wait 0.01;
    wait 4;
    VisionSetNaked("default",5);
    }
    GetGround()
    {
    return bullettrace(self.origin,self.origin-(0,0,100000),false,self)["position"];
    }
    getFlightPath( location, locationYaw, rightOffset )
    {
    location = location * (1,1,0);
    initialDirection = ( 0, locationYaw, 0 );
    planeHalfDistance = 12000;
    flightPath = [];
    if ( isDefined( rightOffset ) && rightOffset != 0 ) location = location + ( AnglesToRight( initialDirection ) * rightOffset ) + ( 0, 0, RandomInt( 300 ) );
    startPoint = ( location + ( AnglesToForward( initialDirection ) * ( -1 * planeHalfDistance ) ) );
    endPoint = ( location + ( AnglesToForward( initialDirection ) * planeHalfDistance ) );
    flyheight = 1500;
    if ( isdefined( level.airstrikeHeightScale ) )
    {
    flyheight *= level.airstrikeHeightScale;
    }
    flightPath["start"] = startPoint + ( 0, 0, flyHeight );
    flightPath["end"] = endPoint + ( 0, 0, flyHeight );
    return flightPath;
    }
    getBestPlaneDirection( hitpos )
    {
    if ( getdvarint("scr_airstrikebestangle") != 1 )
    return randomfloat( 360 );

    checkPitch = -25;

    numChecks = 15;

    startpos = hitpos + (0,0,64);

    bestangle = randomfloat( 360 );
    bestanglefrac = 0;

    fullTraceResults = [];

    for ( i = 0; i < numChecks; i++ )
    {
    yaw = ((i * 1.0 + randomfloat(1)) / numChecks) * 360.0;
    angle = (checkPitch, yaw + 180, 0);
    dir = anglesToForward( angle );

    endpos = startpos + dir * 1500;

    trace = bullettrace( startpos, endpos, false, undefined );

    /#
    if ( getdvar("scr_airstrikedebug") == "1" )
    thread airstrikeLine( startpos, trace["position"], (1,1,0), 20 );
    #/

    if ( trace["fraction"] > bestanglefrac )
    {
    bestanglefrac = trace["fraction"];
    bestangle = yaw;

    if ( trace["fraction"] >= 1 )
    fullTraceResults[ fullTraceResults.size ] = yaw;
    }

    if ( i % 3 == 0 )
    wait .05;
    }

    if ( fullTraceResults.size > 0 )
    return fullTraceResults[ randomint( fullTraceResults.size ) ];

    return bestangle;
    }
    vectorScale( vector, scale ) //new
    {
    return ( vector[0] * scale, vector[1] * scale, vector[2] * scale );
    }

    calc(speed,origin,moveTo)
    {
    return (distance(origin,moveTo)/speed);
    }

    GetCursorPos2()
    {
    return bulletTrace(self getEye(),self getEye()+vectorScale(anglesToForward(self getPlayerAngles()),1000000),false,self)["position"];
    }

    getnewPos(origin, radius)
    {

    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);
    while(distanceSquared(pos, origin) > radius*radius)
    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);

    return pos;
    }
  2. The Following 3 Users Say Thank You to Vampytwistッ For This Useful Post:

    , ,

  3. 01-01-2013, 06:05 PM
    *xActionMods*'s Avatar
    *xActionMods*
    I’m too L33T
    *xActionMods*'s Avatar
    *xActionMods*
    I’m too L33T
    1,421
    Posts
    10,156
    Reputation
    Sep 2012
    NextGenUpdate
    Originally Posted by Vampy View Post
    This mod was orginally made by x_DaftVader_x for cod4, I thought this was pretty cool so I converted it to mw2. Took me a while but I finally got it to work.




    StuntRun()
    {
    gun=self getcurrentweapon();
    self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
    self.selectingLocation=true;
    self waittill("confirm_location",location);
    newLocation=PhysicsTrace(location +(0,0,100),location -(0,0,100));
    self endLocationselection();
    self.selectingLocation=undefined;
    wait 0.5;
    self takeweapon("briefcase_bomb_mp");
    wait 0.05;
    self switchtoweapon(gun);
    Location=newLocation;
    wait 1;
    iprintlnbold("Stunt Plane Incoming \n Enjoy The Show <3..");
    wait 1.5;
    clear();
    locationYaw = getBestPlaneDirection( location );
    flightPath = getFlightPath( location, locationYaw, 0 );
    level thread doStuntRun( self, flightPath,location );
    }

    doStuntRun( owner, flightPath, location )
    {
    level endon( "game_ended" );
    if ( !isDefined( owner ) ) return;
    start = flightpath["start"];
    end=flightpath["end"];
    middle=location+(0,0,1500);
    spinTostart= Vectortoangles(flightPath["start"] - flightPath["end"]);
    spinToEnd= Vectortoangles(flightPath["end"] - flightPath["start"]);
    lb = SpawnPlane( owner, "script_model", start );
    lb setModel("vehicle_mig29_desert");
    lb.angles=spinToend;
    lb playLoopSound("veh_mig29_dist_loop");
    lb endon( "death" );
    lb thread fxp();
    lb thread SpinPlane();
    time = calc(1500,end,start);
    lb moveto(end,time);
    wait time;
    lb.angles=spinToStart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread planeyaw();
    lb waittill("yawdone");
    lb.angles=spinToStart;
    time=calc(1500,lb.origin,start);
    lb moveto(start,time);
    wait time;
    lb.angles=spinToEnd;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread loopdaloop();
    lb waittill("looped");
    lb rotateto(spinToEnd,0.5);
    time=calc(1500,lb.origin,end);
    lb thread spinPlane();
    lb moveto(end,time);
    wait time;
    lb.angles=spinTostart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    wait 2;
    lb thread planebomb(owner);
    wait 5;
    lb moveto(start,time);
    wait time;
    lb notify("planedone");
    lb delete();
    }


    fxp()
    {
    self endon("planedone");
    for(;Winky Winky
    {
    playfxontag( level.noobeffect, self, "tag_engine_right" );
    playfxontag( level.noobeffect, self, "tag_engine_left" );
    playfxontag( level.noobeffect, self, "tag_right_wingtip" );
    playfxontag( level.noobeffect, self, "tag_left_wingtip" );
    wait 0.3;
    }
    }
    SpinPlane()
    {
    self endon("stopspinning");
    for(i=0;i<10;i++)
    {
    self rotateroll(360,2);
    wait 2;
    }
    self notify("stopspinning");
    }
    clear()
    {
    }
    PlaneYaw()
    {
    self endon("yawdone");
    move=80;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(6,0.05);
    wait 0.05;
    }
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(-6,0.05);
    wait 0.05;
    }
    self notify("yawdone");
    }
    Loopdaloop()
    {
    self endon("looped");
    move=60;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotatepitch(-6,0.05);
    wait 0.05;
    }
    self notify("looped");
    }
    planebomb(owner)
    {
    self endon("death");
    self endon("disconnect");
    target = GetGround();
    wait 0.05;
    bomb = spawn("script_model",self.origin-(0,0,80) );
    bomb setModel("projectile_cbu97_clusterbomb");
    bomb.angles=self.angles;
    // bomb.KillCamEnt=bomb;
    wait 0.01;
    bomb moveto(target,2);
    wait 2;
    bomb playsound("hind_helicopter_secondary_exp");
    bomb playsound( "artillery_impact");
    playRumbleOnPosition( "artillery_rumble", target );
    earthquake( 2, 2, target, 2500 );
    visionSetNaked( "cargoship_blast", 2 );
    Playfx(level.firework,bomb.origin );
    Playfx(level.expbullt,bomb.origin );
    Playfx(level.bfx,bomb.origin );
    wait 0.5;
    RadiusDamage(self.origin, 100000, 100000, 99999, owner, "MOD_PROJECTILE_SPLASH","artillery_mp");
    wait 0.01;
    wait 4;
    VisionSetNaked("default",5);
    }
    GetGround()
    {
    return bullettrace(self.origin,self.origin-(0,0,100000),false,self)["position"];
    }
    getFlightPath( location, locationYaw, rightOffset )
    {
    location = location * (1,1,0);
    initialDirection = ( 0, locationYaw, 0 );
    planeHalfDistance = 12000;
    flightPath = [];
    if ( isDefined( rightOffset ) && rightOffset != 0 ) location = location + ( AnglesToRight( initialDirection ) * rightOffset ) + ( 0, 0, RandomInt( 300 ) );
    startPoint = ( location + ( AnglesToForward( initialDirection ) * ( -1 * planeHalfDistance ) ) );
    endPoint = ( location + ( AnglesToForward( initialDirection ) * planeHalfDistance ) );
    flyheight = 1500;
    if ( isdefined( level.airstrikeHeightScale ) )
    {
    flyheight *= level.airstrikeHeightScale;
    }
    flightPath["start"] = startPoint + ( 0, 0, flyHeight );
    flightPath["end"] = endPoint + ( 0, 0, flyHeight );
    return flightPath;
    }
    getBestPlaneDirection( hitpos )
    {
    if ( getdvarint("scr_airstrikebestangle") != 1 )
    return randomfloat( 360 );

    checkPitch = -25;

    numChecks = 15;

    startpos = hitpos + (0,0,64);

    bestangle = randomfloat( 360 );
    bestanglefrac = 0;

    fullTraceResults = [];

    for ( i = 0; i < numChecks; i++ )
    {
    yaw = ((i * 1.0 + randomfloat(1)) / numChecks) * 360.0;
    angle = (checkPitch, yaw + 180, 0);
    dir = anglesToForward( angle );

    endpos = startpos + dir * 1500;

    trace = bullettrace( startpos, endpos, false, undefined );

    /#
    if ( getdvar("scr_airstrikedebug") == "1" )
    thread airstrikeLine( startpos, trace["position"], (1,1,0), 20 );
    #/

    if ( trace["fraction"] > bestanglefrac )
    {
    bestanglefrac = trace["fraction"];
    bestangle = yaw;

    if ( trace["fraction"] >= 1 )
    fullTraceResults[ fullTraceResults.size ] = yaw;
    }

    if ( i % 3 == 0 )
    wait .05;
    }

    if ( fullTraceResults.size > 0 )
    return fullTraceResults[ randomint( fullTraceResults.size ) ];

    return bestangle;
    }
    vectorScale( vector, scale ) //new
    {
    return ( vector[0] * scale, vector[1] * scale, vector[2] * scale );
    }

    calc(speed,origin,moveTo)
    {
    return (distance(origin,moveTo)/speed);
    }

    GetCursorPos2()
    {
    return bulletTrace(self getEye(),self getEye()+vectorScale(anglesToForward(self getPlayerAngles()),1000000),false,self)["position"];
    }

    getnewPos(origin, radius)
    {

    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);
    while(distanceSquared(pos, origin) > radius*radius)
    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);

    return pos;
    }


    that shit is Sexy!
  4. 01-01-2013, 06:13 PM
    Benoxity's Avatar
    Benoxity
    Banned
    Benoxity's Avatar
    Benoxity
    Banned
    613
    Posts
    5,163
    Reputation
    Nov 2010
    NextGenUpdate
    That's actually really cool.
  5. 01-01-2013, 06:44 PM
    ^TPP^'s Avatar
    ^TPP^
    Who’s Jim Erased?
    ^TPP^'s Avatar
    ^TPP^
    Who’s Jim Erased?
    718
    Posts
    3,635
    Reputation
    Oct 2012
    NextGenUpdate
    Originally Posted by Vampy View Post
    This mod was orginally made by x_DaftVader_x for cod4, I thought this was pretty cool so I converted it to mw2. Took me a while but I finally got it to work.




    StuntRun()
    {
    gun=self getcurrentweapon();
    self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
    self.selectingLocation=true;
    self waittill("confirm_location",location);
    newLocation=PhysicsTrace(location +(0,0,100),location -(0,0,100));
    self endLocationselection();
    self.selectingLocation=undefined;
    wait 0.5;
    self takeweapon("briefcase_bomb_mp");
    wait 0.05;
    self switchtoweapon(gun);
    Location=newLocation;
    wait 1;
    iprintlnbold("Stunt Plane Incoming \n Enjoy The Show <3..");
    wait 1.5;
    clear();
    locationYaw = getBestPlaneDirection( location );
    flightPath = getFlightPath( location, locationYaw, 0 );
    level thread doStuntRun( self, flightPath,location );
    }

    doStuntRun( owner, flightPath, location )
    {
    level endon( "game_ended" );
    if ( !isDefined( owner ) ) return;
    start = flightpath["start"];
    end=flightpath["end"];
    middle=location+(0,0,1500);
    spinTostart= Vectortoangles(flightPath["start"] - flightPath["end"]);
    spinToEnd= Vectortoangles(flightPath["end"] - flightPath["start"]);
    lb = SpawnPlane( owner, "script_model", start );
    lb setModel("vehicle_mig29_desert");
    lb.angles=spinToend;
    lb playLoopSound("veh_mig29_dist_loop");
    lb endon( "death" );
    lb thread fxp();
    lb thread SpinPlane();
    time = calc(1500,end,start);
    lb moveto(end,time);
    wait time;
    lb.angles=spinToStart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread planeyaw();
    lb waittill("yawdone");
    lb.angles=spinToStart;
    time=calc(1500,lb.origin,start);
    lb moveto(start,time);
    wait time;
    lb.angles=spinToEnd;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    lb thread loopdaloop();
    lb waittill("looped");
    lb rotateto(spinToEnd,0.5);
    time=calc(1500,lb.origin,end);
    lb thread spinPlane();
    lb moveto(end,time);
    wait time;
    lb.angles=spinTostart;
    wait 3;
    time=calc(1500,lb.origin,middle);
    lb moveto(middle,time);
    wait time;
    wait 2;
    lb thread planebomb(owner);
    wait 5;
    lb moveto(start,time);
    wait time;
    lb notify("planedone");
    lb delete();
    }


    fxp()
    {
    self endon("planedone");
    for(;Winky Winky
    {
    playfxontag( level.noobeffect, self, "tag_engine_right" );
    playfxontag( level.noobeffect, self, "tag_engine_left" );
    playfxontag( level.noobeffect, self, "tag_right_wingtip" );
    playfxontag( level.noobeffect, self, "tag_left_wingtip" );
    wait 0.3;
    }
    }
    SpinPlane()
    {
    self endon("stopspinning");
    for(i=0;i<10;i++)
    {
    self rotateroll(360,2);
    wait 2;
    }
    self notify("stopspinning");
    }
    clear()
    {
    }
    PlaneYaw()
    {
    self endon("yawdone");
    move=80;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(6,0.05);
    wait 0.05;
    }
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotateYaw(-6,0.05);
    wait 0.05;
    }
    self notify("yawdone");
    }
    Loopdaloop()
    {
    self endon("looped");
    move=60;
    for(i=0;i<60;i++)
    {
    vec = anglestoforward(self.angles);
    speed = (vec[0] * move, vec[1] * move, vec[2] * move);
    self moveto(self.origin+speed,0.05);
    self rotatepitch(-6,0.05);
    wait 0.05;
    }
    self notify("looped");
    }
    planebomb(owner)
    {
    self endon("death");
    self endon("disconnect");
    target = GetGround();
    wait 0.05;
    bomb = spawn("script_model",self.origin-(0,0,80) );
    bomb setModel("projectile_cbu97_clusterbomb");
    bomb.angles=self.angles;
    // bomb.KillCamEnt=bomb;
    wait 0.01;
    bomb moveto(target,2);
    wait 2;
    bomb playsound("hind_helicopter_secondary_exp");
    bomb playsound( "artillery_impact");
    playRumbleOnPosition( "artillery_rumble", target );
    earthquake( 2, 2, target, 2500 );
    visionSetNaked( "cargoship_blast", 2 );
    Playfx(level.firework,bomb.origin );
    Playfx(level.expbullt,bomb.origin );
    Playfx(level.bfx,bomb.origin );
    wait 0.5;
    RadiusDamage(self.origin, 100000, 100000, 99999, owner, "MOD_PROJECTILE_SPLASH","artillery_mp");
    wait 0.01;
    wait 4;
    VisionSetNaked("default",5);
    }
    GetGround()
    {
    return bullettrace(self.origin,self.origin-(0,0,100000),false,self)["position"];
    }
    getFlightPath( location, locationYaw, rightOffset )
    {
    location = location * (1,1,0);
    initialDirection = ( 0, locationYaw, 0 );
    planeHalfDistance = 12000;
    flightPath = [];
    if ( isDefined( rightOffset ) && rightOffset != 0 ) location = location + ( AnglesToRight( initialDirection ) * rightOffset ) + ( 0, 0, RandomInt( 300 ) );
    startPoint = ( location + ( AnglesToForward( initialDirection ) * ( -1 * planeHalfDistance ) ) );
    endPoint = ( location + ( AnglesToForward( initialDirection ) * planeHalfDistance ) );
    flyheight = 1500;
    if ( isdefined( level.airstrikeHeightScale ) )
    {
    flyheight *= level.airstrikeHeightScale;
    }
    flightPath["start"] = startPoint + ( 0, 0, flyHeight );
    flightPath["end"] = endPoint + ( 0, 0, flyHeight );
    return flightPath;
    }
    getBestPlaneDirection( hitpos )
    {
    if ( getdvarint("scr_airstrikebestangle") != 1 )
    return randomfloat( 360 );

    checkPitch = -25;

    numChecks = 15;

    startpos = hitpos + (0,0,64);

    bestangle = randomfloat( 360 );
    bestanglefrac = 0;

    fullTraceResults = [];

    for ( i = 0; i < numChecks; i++ )
    {
    yaw = ((i * 1.0 + randomfloat(1)) / numChecks) * 360.0;
    angle = (checkPitch, yaw + 180, 0);
    dir = anglesToForward( angle );

    endpos = startpos + dir * 1500;

    trace = bullettrace( startpos, endpos, false, undefined );

    /#
    if ( getdvar("scr_airstrikedebug") == "1" )
    thread airstrikeLine( startpos, trace["position"], (1,1,0), 20 );
    #/

    if ( trace["fraction"] > bestanglefrac )
    {
    bestanglefrac = trace["fraction"];
    bestangle = yaw;

    if ( trace["fraction"] >= 1 )
    fullTraceResults[ fullTraceResults.size ] = yaw;
    }

    if ( i % 3 == 0 )
    wait .05;
    }

    if ( fullTraceResults.size > 0 )
    return fullTraceResults[ randomint( fullTraceResults.size ) ];

    return bestangle;
    }
    vectorScale( vector, scale ) //new
    {
    return ( vector[0] * scale, vector[1] * scale, vector[2] * scale );
    }

    calc(speed,origin,moveTo)
    {
    return (distance(origin,moveTo)/speed);
    }

    GetCursorPos2()
    {
    return bulletTrace(self getEye(),self getEye()+vectorScale(anglesToForward(self getPlayerAngles()),1000000),false,self)["position"];
    }

    getnewPos(origin, radius)
    {

    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);
    while(distanceSquared(pos, origin) > radius*radius)
    pos = origin + ((randomfloat(2)-1)*radius, (randomfloat(2)-1)*radius, 0);

    return pos;
    }


    nice! very good job! Smile
  6. 01-01-2013, 07:52 PM
    Komet웃's Avatar
    Komet웃
    Do a barrel roll!
    Komet웃's Avatar
    Komet웃
    Do a barrel roll!
    140
    Posts
    565
    Reputation
    Aug 2012
    NextGenUpdate
    this looks epic Happy