Close



Keep me logged in.

Forgot your password? | Register Now

Results 1 to 6 of 6
  1. Original Post
    Banned

    Default Flyable Helicopter with magic bullet rockets !




    First off, big thanks to Vader for the magic bullet script ! ( even though I did have to crawl through Google web cache to find it ).

    This mod was not created by me, it's a PC flyable helicopter mod which I have tweaked; I have removed nearly all of the unneeded parts of the code, fixed a few bugs and added a few new things, such as the magic bullet rockets =D

    Let me know if you find any bugs
    I know Vader has already made a flyable chopper but I felt like sharing it :fa:




    Call the init(); function to load it from your menu

    PHP Code:
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    #include common_scripts\utility;
    precachehelicopter(model,type)
    {
        if(!
    isdefined(type)) type "blackhawk";
        
    deathfx loadfx ("explosions/tanker_explosion");
        
    precacheModelmodel );
        
    level.vehicle_deathmodel[model] = model;
        
    precacheitem"cobra_FFAR_mp" );
        
    precacheitem"hind_FFAR_mp" );
        
    precacheitem"cobra_20mm_mp" );
        
    precachemodel("cobra_Hellfire");
        
    level.heli_sound["allies"]["hit"] = "cobra_helicopter_hit";
        
    level.heli_sound["allies"]["hitsecondary"] = "cobra_helicopter_secondary_exp";
        
    level.heli_sound["allies"]["damaged"] = "cobra_helicopter_damaged";
        
    level.heli_sound["allies"]["spinloop"] = "cobra_helicopter_dying_loop";
        
    level.heli_sound["allies"]["spinstart"] = "cobra_helicopter_dying_layer";
        
    level.heli_sound["allies"]["crash"] = "cobra_helicopter_crash";
        
    level.heli_sound["allies"]["missilefire"] = "weap_cobra_missile_fire";
        
    level.heli_sound["axis"]["hit"] = "hind_helicopter_hit";
        
    level.heli_sound["axis"]["hitsecondary"] = "hind_helicopter_secondary_exp";
        
    level.heli_sound["axis"]["damaged"] = "hind_helicopter_damaged";
        
    level.heli_sound["axis"]["spinloop"] = "hind_helicopter_dying_loop";
        
    level.heli_sound["axis"]["spinstart"] = "hind_helicopter_dying_layer";
        
    level.heli_sound["axis"]["crash"] = "hind_helicopter_crash";
        
    level.heli_sound["axis"]["missilefire"] = "weap_hind_missile_fire";
    }
    init()
    {
        
    level.fx_airstrike_contrail loadfx ("smoke/jet_contrail");
        
    path_start getentarray"heli_start""targetname" );
        
    loop_start getentarray"heli_loop_start""targetname" );
        if ( !
    path_start.size && !loop_start.size) return;
        
    precachehelicopter"vehicle_cobra_helicopter_fly" );
        
    precachehelicopter"vehicle_mi24p_hind_desert" );
        
    precachemodel("weapon_ac130_projectile");
        
    level.chopper undefined;
        
    level.heli_paths = [];
        
    level.heli_loop_paths = [];
        
    level.heli_leavenodes = [];
        
    level.heli_crash_paths = [];
        
    level.chopper_fx["explode"]["death"] = loadfx ("explosions/helicopter_explosion_cobra");
        
    level.chopper_fx["explode"]["large"] = loadfx ("explosions/aerial_explosion_large");
        
    level.chopper_fx["explode"]["medium"] = loadfx ("explosions/aerial_explosion");
        
    level.chopper_fx["smoke"]["trail"] = loadfx ("smoke/smoke_trail_white_heli");
        
    level.chopper_fx["fire"]["trail"]["medium"] = loadfx ("smoke/smoke_trail_black_heli");
        
    level.chopper_fx["fire"]["trail"]["large"] = loadfx ("fire/fire_smoke_trail_L");
        
    self thread watchDeath();
        
    self thread giveheli();
    }
    giveheli()
    {
        
    wait 0.05;
        
    destination 0;
        
    random_path randomintlevel.heli_paths[destination].size );
        
    startnode level.heli_paths[destination][random_path];
        
    self thread heli_thinkselfstartnodeself.pers["team"] );
    }

    spawn_helicopterowneroriginanglesmodeltargetname )
    {
        
    chopper spawnHelicopterowneroriginanglesmodeltargetname );
        
    chopper.attractor Missile_CreateAttractorEntchopperlevel.heli_attract_strengthlevel.heli_attract_range );
        return 
    chopper;
    }
    heli_thinkownerstartnodeheli_teamrequiredDeathCount )
    {
        
    heliAngles owner.angles;
        
    heliOrigin owner.origin + (0,0,2000);
        if( 
    heli_team == "allies" )
        {
            
    chopper spawn_helicopterownerheliOriginheliAngles"cobra_mp""vehicle_cobra_helicopter_fly" );
            
    chopper playLoopSound"mp_cobra_helicopter" );
        }
        else
        {
            
    chopper spawn_helicopterownerheliOriginheliAngles"cobra_mp""vehicle_mi24p_hind_desert" );
            
    chopper playLoopSound"mp_cobra_helicopter" );
        }
        
    chopper.requiredDeathCount owner.deathCount;
        
    chopper.team heli_team;
        
    chopper.pers["team"] = heli_team;
        
    chopper.owner owner;
        
    owner.choppa chopper;
        
    owner.choppa chopper;
        
    chopper thread heli_existance();
        if( 
    isDefinedlevel.firstchopper ) ) level.secondchopper chopper;
        else 
    level.firstchopper chopper;
        if( 
    isDefinedlevel.firstchopper ) && isDefinedlevel.secondchopper ) ) level.chopper chopper;
        
    chopper.reached_dest false;
        
    chopper.maxhealth level.heli_maxhealth;
        
    chopper.waittime level.heli_dest_wait;
        
    chopper.loopcount 0;
        
    chopper.health_bulletdamageble level.heli_armor;
        
    chopper.health_low level.heli_maxhealth*0.8;
        
    chopper.targeting_delay level.heli_targeting_delay;
        
    chopper.primaryTarget undefined;
        
    chopper.secondaryTarget undefined;
        
    chopper.attacker undefined;
        
    chopper.missile_ammo level.heli_missile_max;
        
    chopper.currentstate "ok";
        
    chopper.lastRocketFireTime = -1;
        
    chopper.angles owner.angles;
        
    chopper.origin owner.origin + (0,0,1000);
        
    owner hide();
        if( 
    owner.pers["team"] == "allies" )
        {
            
    heli_centroid chopper.origin + ( 00, -145 );
            
    heli_forward_norm anglestoforwardchopper.angles );
            
    heli_turret_point heli_centroid 110*heli_forward_norm;
        }
        else
        {
            
    heli_centroid chopper.origin + ( 00, -100 );
            
    heli_forward_norm anglestoforwardchopper.angles );
            
    heli_turret_point heli_centroid 120*heli_forward_norm;
        }
        
    owner setoriginheli_turret_point );
        
    owner.flyingheli true;
        
    self.zething spawn("script_origin"owner.origin);
        
    owner linktoself.zething );
        
    self.zething linktochopper );
        
    chopper thread heli_flyowner );
        
    chopper thread heli_damage_monitor();
        
    chopper thread heli_health();
    }
    heli_existance()
    {
        
    self waittill_any"death""crashing""leaving" );
        
    level notify"helicopter gone" );
    }
    heli_reset()
    {
        
    self clearTargetYaw();
        
    self clearGoalYaw();
        
    self setspeed6025 );
        
    self setyawspeed754545 );
        
    self setmaxpitchroll3030 );
        
    self setneargoalnotifydist256 );
        
    self setturningability(0.9);
    }
    heli_waitwaittime )
    {
        
    self endon "death" );
        
    self endon "crashing" );
        
    waitwaittime );
    }
    heli_hover()
    {
        
    self endon"death" );
        
    self endon"stop hover" );
        
    self endon"leaving" );
        
    self endon"crashing" );
        
    original_pos self.origin;
        
    original_angles self.angles;
        
    self setyawspeed104545 );
        
    0;
        
    0;
    }
    heli_damage_monitor()
    {
        
    self endon"death" );
        
    self endon"crashing" );
        
    self endon"leaving" );
        
    self.damageTaken 0;
        for(;;)
        {
            
    self waittill"damage"damageattackerdirection_vecPtype );
            if( !
    isdefinedattacker ) || !isplayerattacker ) ) continue;
            
    heli_friendlyfire maps\mp\gametypes\_weapons::friendlyFireCheckself.ownerattacker );
            if( !
    heli_friendlyfire ) continue;
            if( 
    isDefinedself.owner ) && attacker == self.owner ) continue;
            if ( 
    level.teamBased isValidAttacker = (isdefinedattacker.pers["team"] ) && attacker.pers["team"] != self.team);
            else 
    isValidAttacker true;
            if ( !
    isValidAttacker ) continue;
            
    attacker thread maps\mp\gametypes\_damagefeedback::updateDamageFee  dbackfalse );
            
    self.attacker attacker;
            if ( 
    type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" )
            {
                if( 
    self.damageTaken >= self.health_bulletdamageble self.damageTaken += damage;
                else 
    self.damageTaken += damage*level.heli_armor_bulletdamage;
            }
            else 
    self.damageTaken += damage;
            if( 
    self.damageTaken self.maxhealth attacker notify"destroyed_helicopter"self.owner );
        }
    }
    heli_health()
    {
        
    self endon"death" );
        
    self endon"leaving" );
        
    self endon"crashing" );
        
    self.currentstate "ok";
        
    self.laststate "ok";
        
    self setdamagestage);
        for (;;)
        {
            if ( 
    self.health_bulletdamageble self.health_low )
            {
                if ( 
    self.damageTaken >= self.health_bulletdamageble self.currentstate "heavy smoke";
                else if ( 
    self.damageTaken >= self.health_low self.currentstate "light smoke";
            }
            else
            {
                if ( 
    self.damageTaken >= self.health_low self.currentstate "heavy smoke";
                else if ( 
    self.damageTaken >= self.health_bulletdamageble self.currentstate "light smoke";
            }
            if ( 
    self.currentstate == "light smoke" && self.laststate != "light smoke" )
            {
                
    self setdamagestage);
                
    self.laststate self.currentstate;
            }
            if ( 
    self.currentstate == "heavy smoke" && self.laststate != "heavy smoke" )
            {
                
    self setdamagestage);
                
    self notify "stop body smoke" );
                
    self.laststate self.currentstate;
            }
            if ( 
    self.currentstate == "heavy smoke" )
            {
                
    self.damageTaken += level.heli_health_degrade;
                
    level.heli_rage_missile 20;
            }
            if ( 
    self.currentstate == "light smoke" )
            {
                
    self.damageTaken += level.heli_health_degrade/2;
                
    level.heli_rage_missile 10;
            }

            if( 
    self.damageTaken self.maxhealth self thread heli_crash();
            
    wait 1;
        }
    }
    heli_crash()
    {
        
    self notify"crashing" );
        
    self thread heli_spin180 );
        
    playfxontaglevel.chopper_fx["explode"]["large"], self"tag_engine_left" );
        
    self playSound level.heli_sound[self.team]["hitsecondary"] );
        
    self setdamagestage);
        
    self thread trail_fxlevel.chopper_fx["fire"]["trail"]["large"], "tag_engine_left""stop body fire" );
        
    self thread heli_explode();
    }
    heli_spinspeed )
    {
        
    self endon"death" );
        
    playfxontaglevel.chopper_fx["explode"]["medium"], self"tail_rotor_jnt" );
        
    self playSound level.heli_sound[self.team]["hit"] );
        
    self thread spinSoundShortly();
        
    self thread trail_fxlevel.chopper_fx["smoke"]["trail"], "tail_rotor_jnt""stop tail smoke" );
        
    self setyawspeedspeedspeedspeed );
        while ( 
    isdefinedself ) )
        {
            
    self settargetyawself.angles[1]+(speed*0.9) );
            
    wait );
        }
    }
    spinSoundShortly()
    {
        
    self endon("death");
        
    wait .25;
        
    self stopLoopSound();
        
    wait .05;
        
    self playLoopSoundlevel.heli_sound[self.team]["spinloop"] );
        
    wait .05;
        
    self playSoundlevel.heli_sound[self.team]["spinstart"] );
    }
    trail_fxtrail_fxtrail_tagstop_notify )
    {
        
    self notifystop_notify );
        
    self endonstop_notify );
        
    self endon"death" );
        for (;;)
        {
            
    playfxontagtrail_fxselftrail_tag );
            
    wait0.05 );
        }
    }
    heli_explode()
    {
        
    self notify"death" );
        
    forward = ( self.origin + ( 00100 ) ) - self.origin;
        
    playfx level.chopper_fx["explode"]["death"], self.originforward );
        
    self playSoundlevel.heli_sound[self.team]["crash"] );
        
    self.owner setclientdvar"cg_thirdperson""0" );
        
    self.owner setclientdvar"cg_thirdpersonrange""120" );
        
    self.owner [[level.onSpawnPlayer]]();
        
    self.owner maps\mp\gametypes\_class::giveLoadout(self.owner.p  ers["team"], self.owner.class);
        
    self.owner show();
        
    self.owner.flyingheli undefined;
        
    self.owner unlink();
        
    level.chopper undefined;
        if(
    isDefined(level.firstchopper ) )
        {
            if( 
    self == level.firstchopper level.firstchopper undefined;
        }
        if(
    isDefined(level.secondchopper ) )
        {
            if( 
    self == level.secondchopper level.secondchopper undefined;
        }
        if( 
    isDefinedself ) ) self delete();
    }
    heli_flyowner )
    {
        
    self endon"death" );
        
    self notify"flying");
        
    self endon"flying" );
        
    self endon"abandoned" );
        
    owner takeallweapons();
        
    self setturningability(1);
        
    self.reached_dest false;
        
    heli_reset();
        
    owner.isturretsafe true;
        
    owner.islinked true;
        
    self.ispitchedown false;
        
    pos self.origin;
            
    //change to 1 for third person
        
    owner setclientdvar"cg_thirdperson""0" );
        
    owner setclientdvar"cg_thirdpersonrange""620" );
        
    owner iprintlnbold"Flyable Chopper" );
        
    owner iprintlnbold"Press MELEE to move forward and FIRE to fire" );
        
    owner iprintlnbold"rockets." );
        
    wait);
        while( 
    isAliveowner ) )
        {
            
    angle owner getplayerangles();
            if( 
    owner meleebuttonpressed() ) owner thread moveonangleangle );
            else
            {
                
    distance vecscaleanglestoforwardangle ), 25 );
                if( 
    self.ispitchedown )
                {
                    
    self setvehgoalposself.origin distance);
                    
    self helirotateto( (self.angles[0], self.angles[1], self.angles[2] ), "up" );
                    
    self.ispitchedown false;
                }
                
    self.angles owner.angles;
            }
            if( 
    owner attackbuttonpressed() && owner.isturretsafe )
            {
                
    owner.isturretsafe false;
                
    owner thread maketurretsafe();
                
    owner thread GiveMagicBullets("projectile_hellfire_missile"level.heli_sound[self.team]["missilefire"], 100level.fx_airstrike_contrail"");
            }
            if( 
    owner fragbuttonpressed() )
            {
                
    owner heli_vertical"down" );
            }
            if( 
    owner SecondaryOffhandButtonPressed() )
            {
                
    owner heli_vertical"up" );
            }
            
    self.angles angle;
            
    wait 0.05;
        }
    }
    helirotatetovecdif )
    {
        if( 
    dif == "up" )
        {
            for( 
    0;10;i++ )
            {
                
    self.angles self.angles + ( 1.5,0,);
                
    wait 0.05;
            }
        }
        else
        {
            for( 
    0;10;i++ )
            {
                
    self.angles self.angles - ( 1.5,0,);
                
    wait 0.05;
            }
        }
    }
    heli_verticaldir )
    {
        if( 
    dir == "up" )
        {
            if( 
    bullettracepassedself.choppa.originself.choppa.origin + (0,0,25), falseself.choppa ) )
            {
                
    self.choppa setspeed100100 );
                
    self.choppa setvehgoalposself.choppa.origin + (0,0,50), );
            }
            else
            {
                
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
                
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
                
    self.choppa thread heli_explode();
            }
        }
        else
        {
            if( 
    bullettracepassedself.choppa.originself.choppa.origin - (0,0,25), falseself.choppa ) )
            {
                
    self.choppa setspeed100100 );
                
    self.choppa setvehgoalposself.choppa.origin - (0,0,50), );
            }
            else
            {
                
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
                
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
                
    self.choppa thread heli_explode();
            }
        }
    }
    maketurretsafe()
    {
        
    wait 3;
        
    self.isturretsafe true;
    }
    moveonangleangle )
    {
        
    distance vecscaleanglestoforwardangle ), 25 );
        if( 
    bullettracepassedself.originself.origin distancefalseself.choppa ) )
        {
            if( !
    isDefinedself.choppa ) ) return;
            if( !
    self.choppa.ispitchedown )
            {
                
    self helirotateto( (0,0,0), "down" );
                
    self.choppa.ispitchedown true;
            }
            
    self.choppa setspeed5050 );
            
    self.choppa SetTargetYawangle[1] );
            
    self.choppa SetYawSpeed1806060);
            
    self.choppa setvehgoalposself.choppa.origin distance);
        }
        else
        {
            
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
            
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
            
    self.choppa thread heli_explode();
        }
    }
    //stuff i've added... thanks vader 
    GiveMagicBullets(modelsoundmovegeotrailloop)
    {
        
    self endon("death");
        
    self endon("disconnect");
        
    self thread VaderBullet(modelsoundmovegeotrailloop);
    }
    VaderBullet(modelsoundmovegeotrailloop)
    {
        
    owner self;
        
    vec anglestoforward(self getPlayerAngles());
        
    bullet spawn("script_model"self.origin+(20,20,20));
        
    bullet setModel(model);
        
    bullet.angles self getPlayerAngles();
        
    bullet playsound(sound);
        
    bullet thread BulletFly(ownervecmovegeotrailloop);
    }
    BulletFly(ownervecmovegeotrailloop)
    {
        
    self endon("end");
        
    self playsound(loop);
        for (
    350;0;i--)
        {
            
    speed = (vec[0] * movevec[1] * movevec[2] * move)*2.3;
            if (
    bullettracepassed(self.originself.origin speedfalseundefined))
            {
                
    self moveto(self.origin speed0.1);
                
    playFxOnTaggeotrail self"tag_origin");
            }
            else
            {
                
    mark self.origin;
                
    self thread BulletExplode(ownermarkloop);
                
    self notify("end");
            }
            
    wait 0.01;
        }
        
    mark self.origin;
        
    self thread BulletExplode(ownermarkloop);
        
    self notify("end");
    }
    BulletExplode(ownermarkloop)
    {
        
    self stoploopsound(loop);
        
    wait 0.05;
        
    self playsound("rocket_explode_default");
        
    self playsound("car_explode");
        
    level.expbullt loadfx("explosions/aerial_explosion");
        
    Playfx(level.expbulltmark);
        
    RadiusDamage(mark35045025owner);
        
    self delete();
    }
    watchDeath()
    {
        
    self waittill("death");
        
    self.choppa thread heli_explode();
    }
    vecscale(vecscalar)
    {
        return (
    vec[0]*scalarvec[1]*scalarvec[2]*scalar);

    Note: if you shoot the rocket at the helicopter blades, it will kill you
    Last edited by CumGuzzler420; 05-20-2012 at 12:02 PM.
    Register or log in to view signatures.

  2. #2
    lovebros's Avatar

    Default


    0 Not allowed! Not allowed!
    very nice. the only thing i think that seems a little strange is that when you move, you kinda lag in the helicopter. But i do like the magic bullets!
    Register or log in to view signatures.

  3. #3
    I'm the Original
    Correy's Avatar

    Default


    0 Not allowed! Not allowed!
    pretty nice man, that is one long ass code though .
    Register or log in to view signatures.

  4. #4
    Ronald McDonald
    IELIITEMODZX's Avatar

    Default


    0 Not allowed! Not allowed!
    Quote Originally Posted by gizzi View Post
    First off, big thanks to Vader for the magic bullet script ! ( even though I did have to crawl through Google web cache to find it ).

    This mod was not created by me, it's a PC flyable helicopter mod which I have tweaked; I have removed nearly all of the unneeded parts of the code, fixed a few bugs and added a few new things, such as the magic bullet rockets =D

    Let me know if you find any bugs
    I know Vader has already made a flyable chopper but I felt like sharing it :fa:




    Call the init(); function to load it from your menu

    PHP Code:
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    #include common_scripts\utility;
    precachehelicopter(model,type)
    {
        if(!
    isdefined(type)) type "blackhawk";
        
    deathfx loadfx ("explosions/tanker_explosion");
        
    precacheModelmodel );
        
    level.vehicle_deathmodel[model] = model;
        
    precacheitem"cobra_FFAR_mp" );
        
    precacheitem"hind_FFAR_mp" );
        
    precacheitem"cobra_20mm_mp" );
        
    precachemodel("cobra_Hellfire");
        
    level.heli_sound["allies"]["hit"] = "cobra_helicopter_hit";
        
    level.heli_sound["allies"]["hitsecondary"] = "cobra_helicopter_secondary_exp";
        
    level.heli_sound["allies"]["damaged"] = "cobra_helicopter_damaged";
        
    level.heli_sound["allies"]["spinloop"] = "cobra_helicopter_dying_loop";
        
    level.heli_sound["allies"]["spinstart"] = "cobra_helicopter_dying_layer";
        
    level.heli_sound["allies"]["crash"] = "cobra_helicopter_crash";
        
    level.heli_sound["allies"]["missilefire"] = "weap_cobra_missile_fire";
        
    level.heli_sound["axis"]["hit"] = "hind_helicopter_hit";
        
    level.heli_sound["axis"]["hitsecondary"] = "hind_helicopter_secondary_exp";
        
    level.heli_sound["axis"]["damaged"] = "hind_helicopter_damaged";
        
    level.heli_sound["axis"]["spinloop"] = "hind_helicopter_dying_loop";
        
    level.heli_sound["axis"]["spinstart"] = "hind_helicopter_dying_layer";
        
    level.heli_sound["axis"]["crash"] = "hind_helicopter_crash";
        
    level.heli_sound["axis"]["missilefire"] = "weap_hind_missile_fire";
    }
    init()
    {
        
    level.fx_airstrike_contrail loadfx ("smoke/jet_contrail");
        
    path_start getentarray"heli_start""targetname" );
        
    loop_start getentarray"heli_loop_start""targetname" );
        if ( !
    path_start.size && !loop_start.size) return;
        
    precachehelicopter"vehicle_cobra_helicopter_fly" );
        
    precachehelicopter"vehicle_mi24p_hind_desert" );
        
    precachemodel("weapon_ac130_projectile");
        
    level.chopper undefined;
        
    level.heli_paths = [];
        
    level.heli_loop_paths = [];
        
    level.heli_leavenodes = [];
        
    level.heli_crash_paths = [];
        
    level.chopper_fx["explode"]["death"] = loadfx ("explosions/helicopter_explosion_cobra");
        
    level.chopper_fx["explode"]["large"] = loadfx ("explosions/aerial_explosion_large");
        
    level.chopper_fx["explode"]["medium"] = loadfx ("explosions/aerial_explosion");
        
    level.chopper_fx["smoke"]["trail"] = loadfx ("smoke/smoke_trail_white_heli");
        
    level.chopper_fx["fire"]["trail"]["medium"] = loadfx ("smoke/smoke_trail_black_heli");
        
    level.chopper_fx["fire"]["trail"]["large"] = loadfx ("fire/fire_smoke_trail_L");
        
    self thread watchDeath();
        
    self thread giveheli();
    }
    giveheli()
    {
        
    wait 0.05;
        
    destination 0;
        
    random_path randomintlevel.heli_paths[destination].size );
        
    startnode level.heli_paths[destination][random_path];
        
    self thread heli_thinkselfstartnodeself.pers["team"] );
    }

    spawn_helicopterowneroriginanglesmodeltargetname )
    {
        
    chopper spawnHelicopterowneroriginanglesmodeltargetname );
        
    chopper.attractor Missile_CreateAttractorEntchopperlevel.heli_attract_strengthlevel.heli_attract_range );
        return 
    chopper;
    }
    heli_thinkownerstartnodeheli_teamrequiredDeathCount )
    {
        
    heliAngles owner.angles;
        
    heliOrigin owner.origin + (0,0,2000);
        if( 
    heli_team == "allies" )
        {
            
    chopper spawn_helicopterownerheliOriginheliAngles"cobra_mp""vehicle_cobra_helicopter_fly" );
            
    chopper playLoopSound"mp_cobra_helicopter" );
        }
        else
        {
            
    chopper spawn_helicopterownerheliOriginheliAngles"cobra_mp""vehicle_mi24p_hind_desert" );
            
    chopper playLoopSound"mp_cobra_helicopter" );
        }
        
    chopper.requiredDeathCount owner.deathCount;
        
    chopper.team heli_team;
        
    chopper.pers["team"] = heli_team;
        
    chopper.owner owner;
        
    owner.choppa chopper;
        
    owner.choppa chopper;
        
    chopper thread heli_existance();
        if( 
    isDefinedlevel.firstchopper ) ) level.secondchopper chopper;
        else 
    level.firstchopper chopper;
        if( 
    isDefinedlevel.firstchopper ) && isDefinedlevel.secondchopper ) ) level.chopper chopper;
        
    chopper.reached_dest false;
        
    chopper.maxhealth level.heli_maxhealth;
        
    chopper.waittime level.heli_dest_wait;
        
    chopper.loopcount 0;
        
    chopper.health_bulletdamageble level.heli_armor;
        
    chopper.health_low level.heli_maxhealth*0.8;
        
    chopper.targeting_delay level.heli_targeting_delay;
        
    chopper.primaryTarget undefined;
        
    chopper.secondaryTarget undefined;
        
    chopper.attacker undefined;
        
    chopper.missile_ammo level.heli_missile_max;
        
    chopper.currentstate "ok";
        
    chopper.lastRocketFireTime = -1;
        
    chopper.angles owner.angles;
        
    chopper.origin owner.origin + (0,0,1000);
        
    owner hide();
        if( 
    owner.pers["team"] == "allies" )
        {
            
    heli_centroid chopper.origin + ( 00, -145 );
            
    heli_forward_norm anglestoforwardchopper.angles );
            
    heli_turret_point heli_centroid 110*heli_forward_norm;
        }
        else
        {
            
    heli_centroid chopper.origin + ( 00, -100 );
            
    heli_forward_norm anglestoforwardchopper.angles );
            
    heli_turret_point heli_centroid 120*heli_forward_norm;
        }
        
    owner setoriginheli_turret_point );
        
    owner.flyingheli true;
        
    self.zething spawn("script_origin"owner.origin);
        
    owner linktoself.zething );
        
    self.zething linktochopper );
        
    chopper thread heli_flyowner );
        
    chopper thread heli_damage_monitor();
        
    chopper thread heli_health();
    }
    heli_existance()
    {
        
    self waittill_any"death""crashing""leaving" );
        
    level notify"helicopter gone" );
    }
    heli_reset()
    {
        
    self clearTargetYaw();
        
    self clearGoalYaw();
        
    self setspeed6025 );
        
    self setyawspeed754545 );
        
    self setmaxpitchroll3030 );
        
    self setneargoalnotifydist256 );
        
    self setturningability(0.9);
    }
    heli_waitwaittime )
    {
        
    self endon "death" );
        
    self endon "crashing" );
        
    waitwaittime );
    }
    heli_hover()
    {
        
    self endon"death" );
        
    self endon"stop hover" );
        
    self endon"leaving" );
        
    self endon"crashing" );
        
    original_pos self.origin;
        
    original_angles self.angles;
        
    self setyawspeed104545 );
        
    0;
        
    0;
    }
    heli_damage_monitor()
    {
        
    self endon"death" );
        
    self endon"crashing" );
        
    self endon"leaving" );
        
    self.damageTaken 0;
        for(;;)
        {
            
    self waittill"damage"damageattackerdirection_vecPtype );
            if( !
    isdefinedattacker ) || !isplayerattacker ) ) continue;
            
    heli_friendlyfire maps\mp\gametypes\_weapons::friendlyFireCheckself.ownerattacker );
            if( !
    heli_friendlyfire ) continue;
            if( 
    isDefinedself.owner ) && attacker == self.owner ) continue;
            if ( 
    level.teamBased isValidAttacker = (isdefinedattacker.pers["team"] ) && attacker.pers["team"] != self.team);
            else 
    isValidAttacker true;
            if ( !
    isValidAttacker ) continue;
            
    attacker thread maps\mp\gametypes\_damagefeedback::updateDamageFee  dbackfalse );
            
    self.attacker attacker;
            if ( 
    type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" )
            {
                if( 
    self.damageTaken >= self.health_bulletdamageble self.damageTaken += damage;
                else 
    self.damageTaken += damage*level.heli_armor_bulletdamage;
            }
            else 
    self.damageTaken += damage;
            if( 
    self.damageTaken self.maxhealth attacker notify"destroyed_helicopter"self.owner );
        }
    }
    heli_health()
    {
        
    self endon"death" );
        
    self endon"leaving" );
        
    self endon"crashing" );
        
    self.currentstate "ok";
        
    self.laststate "ok";
        
    self setdamagestage);
        for (;;)
        {
            if ( 
    self.health_bulletdamageble self.health_low )
            {
                if ( 
    self.damageTaken >= self.health_bulletdamageble self.currentstate "heavy smoke";
                else if ( 
    self.damageTaken >= self.health_low self.currentstate "light smoke";
            }
            else
            {
                if ( 
    self.damageTaken >= self.health_low self.currentstate "heavy smoke";
                else if ( 
    self.damageTaken >= self.health_bulletdamageble self.currentstate "light smoke";
            }
            if ( 
    self.currentstate == "light smoke" && self.laststate != "light smoke" )
            {
                
    self setdamagestage);
                
    self.laststate self.currentstate;
            }
            if ( 
    self.currentstate == "heavy smoke" && self.laststate != "heavy smoke" )
            {
                
    self setdamagestage);
                
    self notify "stop body smoke" );
                
    self.laststate self.currentstate;
            }
            if ( 
    self.currentstate == "heavy smoke" )
            {
                
    self.damageTaken += level.heli_health_degrade;
                
    level.heli_rage_missile 20;
            }
            if ( 
    self.currentstate == "light smoke" )
            {
                
    self.damageTaken += level.heli_health_degrade/2;
                
    level.heli_rage_missile 10;
            }

            if( 
    self.damageTaken self.maxhealth self thread heli_crash();
            
    wait 1;
        }
    }
    heli_crash()
    {
        
    self notify"crashing" );
        
    self thread heli_spin180 );
        
    playfxontaglevel.chopper_fx["explode"]["large"], self"tag_engine_left" );
        
    self playSound level.heli_sound[self.team]["hitsecondary"] );
        
    self setdamagestage);
        
    self thread trail_fxlevel.chopper_fx["fire"]["trail"]["large"], "tag_engine_left""stop body fire" );
        
    self thread heli_explode();
    }
    heli_spinspeed )
    {
        
    self endon"death" );
        
    playfxontaglevel.chopper_fx["explode"]["medium"], self"tail_rotor_jnt" );
        
    self playSound level.heli_sound[self.team]["hit"] );
        
    self thread spinSoundShortly();
        
    self thread trail_fxlevel.chopper_fx["smoke"]["trail"], "tail_rotor_jnt""stop tail smoke" );
        
    self setyawspeedspeedspeedspeed );
        while ( 
    isdefinedself ) )
        {
            
    self settargetyawself.angles[1]+(speed*0.9) );
            
    wait );
        }
    }
    spinSoundShortly()
    {
        
    self endon("death");
        
    wait .25;
        
    self stopLoopSound();
        
    wait .05;
        
    self playLoopSoundlevel.heli_sound[self.team]["spinloop"] );
        
    wait .05;
        
    self playSoundlevel.heli_sound[self.team]["spinstart"] );
    }
    trail_fxtrail_fxtrail_tagstop_notify )
    {
        
    self notifystop_notify );
        
    self endonstop_notify );
        
    self endon"death" );
        for (;;)
        {
            
    playfxontagtrail_fxselftrail_tag );
            
    wait0.05 );
        }
    }
    heli_explode()
    {
        
    self notify"death" );
        
    forward = ( self.origin + ( 00100 ) ) - self.origin;
        
    playfx level.chopper_fx["explode"]["death"], self.originforward );
        
    self playSoundlevel.heli_sound[self.team]["crash"] );
        
    self.owner setclientdvar"cg_thirdperson""0" );
        
    self.owner setclientdvar"cg_thirdpersonrange""120" );
        
    self.owner [[level.onSpawnPlayer]]();
        
    self.owner maps\mp\gametypes\_class::giveLoadout(self.owner.p  ers["team"], self.owner.class);
        
    self.owner show();
        
    self.owner.flyingheli undefined;
        
    self.owner unlink();
        
    level.chopper undefined;
        if(
    isDefined(level.firstchopper ) )
        {
            if( 
    self == level.firstchopper level.firstchopper undefined;
        }
        if(
    isDefined(level.secondchopper ) )
        {
            if( 
    self == level.secondchopper level.secondchopper undefined;
        }
        if( 
    isDefinedself ) ) self delete();
    }
    heli_flyowner )
    {
        
    self endon"death" );
        
    self notify"flying");
        
    self endon"flying" );
        
    self endon"abandoned" );
        
    owner takeallweapons();
        
    self setturningability(1);
        
    self.reached_dest false;
        
    heli_reset();
        
    owner.isturretsafe true;
        
    owner.islinked true;
        
    self.ispitchedown false;
        
    pos self.origin;
            
    //change to 1 for third person
        
    owner setclientdvar"cg_thirdperson""0" );
        
    owner setclientdvar"cg_thirdpersonrange""620" );
        
    owner iprintlnbold"Flyable Chopper" );
        
    owner iprintlnbold"Press MELEE to move forward and FIRE to fire" );
        
    owner iprintlnbold"rockets." );
        
    wait);
        while( 
    isAliveowner ) )
        {
            
    angle owner getplayerangles();
            if( 
    owner meleebuttonpressed() ) owner thread moveonangleangle );
            else
            {
                
    distance vecscaleanglestoforwardangle ), 25 );
                if( 
    self.ispitchedown )
                {
                    
    self setvehgoalposself.origin distance);
                    
    self helirotateto( (self.angles[0], self.angles[1], self.angles[2] ), "up" );
                    
    self.ispitchedown false;
                }
                
    self.angles owner.angles;
            }
            if( 
    owner attackbuttonpressed() && owner.isturretsafe )
            {
                
    owner.isturretsafe false;
                
    owner thread maketurretsafe();
                
    owner thread GiveMagicBullets("projectile_hellfire_missile"level.heli_sound[self.team]["missilefire"], 100level.fx_airstrike_contrail"");
            }
            if( 
    owner fragbuttonpressed() )
            {
                
    owner heli_vertical"down" );
            }
            if( 
    owner SecondaryOffhandButtonPressed() )
            {
                
    owner heli_vertical"up" );
            }
            
    self.angles angle;
            
    wait 0.05;
        }
    }
    helirotatetovecdif )
    {
        if( 
    dif == "up" )
        {
            for( 
    0;10;i++ )
            {
                
    self.angles self.angles + ( 1.5,0,);
                
    wait 0.05;
            }
        }
        else
        {
            for( 
    0;10;i++ )
            {
                
    self.angles self.angles - ( 1.5,0,);
                
    wait 0.05;
            }
        }
    }
    heli_verticaldir )
    {
        if( 
    dir == "up" )
        {
            if( 
    bullettracepassedself.choppa.originself.choppa.origin + (0,0,25), falseself.choppa ) )
            {
                
    self.choppa setspeed100100 );
                
    self.choppa setvehgoalposself.choppa.origin + (0,0,50), );
            }
            else
            {
                
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
                
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
                
    self.choppa thread heli_explode();
            }
        }
        else
        {
            if( 
    bullettracepassedself.choppa.originself.choppa.origin - (0,0,25), falseself.choppa ) )
            {
                
    self.choppa setspeed100100 );
                
    self.choppa setvehgoalposself.choppa.origin - (0,0,50), );
            }
            else
            {
                
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
                
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
                
    self.choppa thread heli_explode();
            }
        }
    }
    maketurretsafe()
    {
        
    wait 3;
        
    self.isturretsafe true;
    }
    moveonangleangle )
    {
        
    distance vecscaleanglestoforwardangle ), 25 );
        if( 
    bullettracepassedself.originself.origin distancefalseself.choppa ) )
        {
            if( !
    isDefinedself.choppa ) ) return;
            if( !
    self.choppa.ispitchedown )
            {
                
    self helirotateto( (0,0,0), "down" );
                
    self.choppa.ispitchedown true;
            }
            
    self.choppa setspeed5050 );
            
    self.choppa SetTargetYawangle[1] );
            
    self.choppa SetYawSpeed1806060);
            
    self.choppa setvehgoalposself.choppa.origin distance);
        }
        else
        {
            
    self iprintlnbold("WTF? Crash the multi-million dollar chopper?!");
            
    self iprintlnbold("Jesus Christ, you suck at this stuff man.");
            
    self.choppa thread heli_explode();
        }
    }
    //stuff i've added... thanks vader 
    GiveMagicBullets(modelsoundmovegeotrailloop)
    {
        
    self endon("death");
        
    self endon("disconnect");
        
    self thread VaderBullet(modelsoundmovegeotrailloop);
    }
    VaderBullet(modelsoundmovegeotrailloop)
    {
        
    owner self;
        
    vec anglestoforward(self getPlayerAngles());
        
    bullet spawn("script_model"self.origin+(20,20,20));
        
    bullet setModel(model);
        
    bullet.angles self getPlayerAngles();
        
    bullet playsound(sound);
        
    bullet thread BulletFly(ownervecmovegeotrailloop);
    }
    BulletFly(ownervecmovegeotrailloop)
    {
        
    self endon("end");
        
    self playsound(loop);
        for (
    350;0;i--)
        {
            
    speed = (vec[0] * movevec[1] * movevec[2] * move)*2.3;
            if (
    bullettracepassed(self.originself.origin speedfalseundefined))
            {
                
    self moveto(self.origin speed0.1);
                
    playFxOnTaggeotrail self"tag_origin");
            }
            else
            {
                
    mark self.origin;
                
    self thread BulletExplode(ownermarkloop);
                
    self notify("end");
            }
            
    wait 0.01;
        }
        
    mark self.origin;
        
    self thread BulletExplode(ownermarkloop);
        
    self notify("end");
    }
    BulletExplode(ownermarkloop)
    {
        
    self stoploopsound(loop);
        
    wait 0.05;
        
    self playsound("rocket_explode_default");
        
    self playsound("car_explode");
        
    level.expbullt loadfx("explosions/aerial_explosion");
        
    Playfx(level.expbulltmark);
        
    RadiusDamage(mark35045025owner);
        
    self delete();
    }
    watchDeath()
    {
        
    self waittill("death");
        
    self.choppa thread heli_explode();
    }
    vecscale(vecscalar)
    {
        return (
    vec[0]*scalarvec[1]*scalarvec[2]*scalar);

    Note: if you shoot the rocket at the helicopter blades, it will kill you
    Abit big :carling: but still nice job.
    Register or log in to view signatures.

  5. #5
    Ragdoll

    Default


    0 Not allowed! Not allowed!
    Nice ima try this soon
    Register or log in to view signatures.

  6. #6
    Ragdoll
    TheHardyz's Avatar

    Default


    0 Not allowed! Not allowed!
    The Video is on Private- :jim:
    Register or log in to view signatures.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •