• 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] Noob EMP
#1
This is another code I found on my PC, what this makes is that the EMP doesnt destroy any vehicles, save as maps\mp\killstreaks\_emp.gsc

Code:
#include maps\mp\_utility;
#include common_scripts\utility;


init()
{
    level._effect[ "emp_flash" ] = loadfx( "explosions/emp_flash_mp" );

    level.teamEMPed["allies"] = false;
    level.teamEMPed["axis"] = false;
    level.empPlayer = undefined;
    
    if ( level.teamBased )
        level thread EMP_TeamTracker();
    else
        level thread EMP_PlayerTracker();
    
    level.killstreakFuncs["emp"] = ::EMP_Use;
    
    level thread onPlayerConnect();
    
}



onPlayerConnect()
{
    for(;;)
    {
        level waittill("connected", player);
        player thread onPlayerSpawned();
    }
}


onPlayerSpawned()
{
    self endon("disconnect");

    for(;;)
    {
        self waittill( "spawned_player" );
        
        if ( (level.teamBased && level.teamEMPed[self.team]) || (!level.teamBased && isDefined( level.empPlayer ) && level.empPlayer != self) )
            self setEMPJammed( true );
    }
}


EMP_Use( lifeId, delay )
{
    assert( isDefined( self ) );

    if ( !isDefined( delay ) )
        delay = 5.0;

    myTeam = self.pers["team"];
    otherTeam = level.otherTeam[myTeam];
    
    if ( level.teamBased )
        self thread EMP_JamTeam( otherTeam, 60.0, delay );
    else
        self thread EMP_JamPlayers( self, 60.0, delay );

    self maps\mp\_matchdata::logKillstreakEvent( "emp", self.origin );
    self notify( "used_emp" );

    return true;
}


EMP_JamTeam( teamName, duration, delay )
{
    level endon ( "game_ended" );
    
    assert( teamName == "allies" || teamName == "axis" );

    //wait ( delay );

    thread teamPlayerCardSplash( "used_emp", self );

    level notify ( "EMP_JamTeam" + teamName );
    level endon ( "EMP_JamTeam" + teamName );
    
    foreach ( player in level.players )
    {
        player playLocalSound( "emp_activate" );
        
        if ( player.team != teamName )
            continue;
        
        if ( player _hasPerk( "specialty_localjammer" ) )
            player RadarJamOff();
    }
    
    visionSetNaked( "coup_sunblind", 0.1 );
    thread empEffects();
    
    wait ( 0.1 );
    
    // resetting the vision set to the same thing won't normally have an effect.
    // however, if the client receives the previous visionset change in the same packet as this one,
    // this will force them to lerp from the bright one to the normal one.
    visionSetNaked( "coup_sunblind", 0 );
    visionSetNaked( getDvar( "mapname" ), 3.0 );
    
    level.teamEMPed[teamName] = true;
    level notify ( "emp_update" );
    
    level destroyActiveVehicles( self );
    
    maps\mp\gametypes\_hostmigration::waitLongDurationWithHostMigrationPause( duration );
    
    level.teamEMPed[teamName] = false;
    
    foreach ( player in level.players )
    {
        if ( player.team != teamName )
            continue;
        
        if ( player _hasPerk( "specialty_localjammer" ) )
            player RadarJamOn();
    }
    
    level notify ( "emp_update" );
}

EMP_JamPlayers( owner, duration, delay )
{
    level notify ( "EMP_JamPlayers" );
    level endon ( "EMP_JamPlayers" );
    
    assert( isDefined( owner ) );
    
    //wait ( delay );
    
    foreach ( player in level.players )
    {
        player playLocalSound( "emp_activate" );
        
        if ( player == owner )
            continue;
        
        if ( player _hasPerk( "specialty_localjammer" ) )
            player RadarJamOff();
    }
    
    visionSetNaked( "coup_sunblind", 0.1 );
    thread empEffects();

    wait ( 0.1 );
    
    // resetting the vision set to the same thing won't normally have an effect.
    // however, if the client receives the previous visionset change in the same packet as this one,
    // this will force them to lerp from the bright one to the normal one.
    visionSetNaked( "coup_sunblind", 0 );
    visionSetNaked( getDvar( "mapname" ), 3.0 );
    
    level notify ( "emp_update" );
    
    level.empPlayer = owner;
    level.empPlayer thread empPlayerFFADisconnect();
    level destroyActiveVehicles( owner );
    
    level notify ( "emp_update" );
    
    maps\mp\gametypes\_hostmigration::waitLongDurationWithHostMigrationPause( duration );
    
    foreach ( player in level.players )
    {
        if ( player == owner )
            continue;
        
        if ( player _hasPerk( "specialty_localjammer" ) )
            player RadarJamOn();
    }
    
    level.empPlayer = undefined;
    level notify ( "emp_update" );
    level notify ( "emp_ended" );
}

empPlayerFFADisconnect()
{
    level endon ( "EMP_JamPlayers" );    
    level endon ( "emp_ended" );
    
    self waittill( "disconnect" );
    level notify ( "emp_update" );
}

empEffects()
{
    foreach( player in level.players )
    {
        playerForward = anglestoforward( player.angles );
        playerForward = ( playerForward[0], playerForward[1], 0 );
        playerForward = VectorNormalize( playerForward );
    
        empDistance = 20000;

        empEnt = Spawn( "script_model", player.origin + ( 0, 0, 8000 ) + Vector_Multiply( playerForward, empDistance ) );
        empEnt setModel( "tag_origin" );
        empEnt.angles = empEnt.angles + ( 270, 0, 0 );
        empEnt thread empEffect( player );
    }
}

empEffect( player )
{
    player endon( "disconnect" );

    wait( 0.5 );
    PlayFXOnTagForClients( level._effect[ "emp_flash" ], self, "tag_origin", player );
}

EMP_TeamTracker()
{
    level endon ( "game_ended" );
    
    for ( ;; )
    {
        level waittill_either ( "joined_team", "emp_update" );
        
        foreach ( player in level.players )
        {
            if ( player.team == "spectator" )
                continue;
                
            player setEMPJammed( level.teamEMPed[player.team] );
        }
    }
}


EMP_PlayerTracker()
{
    level endon ( "game_ended" );
    
    for ( ;; )
    {
        level waittill_either ( "joined_team", "emp_update" );
        
        foreach ( player in level.players )
        {
            if ( player.team == "spectator" )
                continue;
                
            if ( isDefined( level.empPlayer ) && level.empPlayer != player )
                player setEMPJammed( true );
            else
                player setEMPJammed( false );                
        }
    }
}

destroyActiveVehicles( attacker )
{
    if ( isDefined( attacker ) )
    {/*
        foreach ( heli in level.helis )
            radiusDamage( heli.origin, 384, 5000, 5000, attacker );
    
        foreach ( littleBird in level.littleBird )
            radiusDamage( littleBird.origin, 384, 5000, 5000, attacker );
        
        foreach ( turret in level.turrets )
            radiusDamage( turret.origin, 16, 5000, 5000, attacker );
    
        foreach ( rocket in level.rockets )
            rocket notify ( "death" );
        
        if ( level.teamBased )
        {
            foreach ( uav in level.uavModels["allies"] )
                radiusDamage( uav.origin, 384, 5000, 5000, attacker );
    
            foreach ( uav in level.uavModels["axis"] )
                radiusDamage( uav.origin, 384, 5000, 5000, attacker );
        }
        else
        {    
            foreach ( uav in level.uavModels )
                radiusDamage( uav.origin, 384, 5000, 5000, attacker );
        }
        
        if ( isDefined( level.ac130player ) )
            radiusDamage( level.ac130.planeModel.origin+(0,0,10), 1000, 5000, 5000, attacker );
    */}
    else
    {/*
        foreach ( heli in level.helis )
            radiusDamage( heli.origin, 384, 5000, 5000 );
    
        foreach ( littleBird in level.littleBird )
            radiusDamage( littleBird.origin, 384, 5000, 5000 );
        
        foreach ( turret in level.turrets )
            radiusDamage( turret.origin, 16, 5000, 5000 );
    
        foreach ( rocket in level.rockets )
            rocket notify ( "death" );
        
        if ( level.teamBased )
        {
            foreach ( uav in level.uavModels["allies"] )
                radiusDamage( uav.origin, 384, 5000, 5000 );
    
            foreach ( uav in level.uavModels["axis"] )
                radiusDamage( uav.origin, 384, 5000, 5000 );
        }
        else
        {    
            foreach ( uav in level.uavModels )
                radiusDamage( uav.origin, 384, 5000, 5000 );
        }
        
        if ( isDefined( level.ac130player ) )
            radiusDamage( level.ac130.planeModel.origin+(0,0,10), 1000, 5000, 5000 );
    */}
}
[Image: veovuq.png]
  Reply
#2
You should make something moar Nyan Cat
Or no more ideas Fuu ?!?!?!
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#3
(08-31-2011, 19:30)Se7en Wrote: You should make something moar Nyan Cat
Or no more ideas Fuu ?!?!?!

I try to think of my own ideas and dont copy other guys ideas.
[Image: veovuq.png]
  Reply
#4
Write noob on enemy player's screen if his kd is less than 1 when they are emp'd.
  Reply
#5
(08-31-2011, 19:38)Yamato Wrote:
(08-31-2011, 19:30)Se7en Wrote: You should make something moar Nyan Cat
Or no more ideas Fuu ?!?!?!

I try to think of my own ideas and dont copy other guys ideas.

OWNED!
  Reply
#6
Why did you comment the whole destroyActiveVehicles( attacker ) thread and not just comment out the function when it's called? lol
[Image: MaEIQ.png]
  Reply
#7
can't you make something more awesome with the emp...?
no offense its still cool and usefull
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Wink [Request] c# ++ help noob) ᵧₒᵤ funny 3 1,473 01-31-2013, 21:10
Last Post: 99IRock
  Super Noob Question kpoviv 5 1,860 07-09-2012, 11:56
Last Post: surtek
  Anti-Noob Mods setman 3 2,628 06-01-2012, 22:47
Last Post: setman
  Anti Noob setman 3 3,772 05-19-2012, 09:25
Last Post: OrangePL
  [News] Xbox Noob Reviewer Yamato 6 1,707 03-17-2012, 17:30
Last Post: SuperNovaAO
  Official out of hope noob post. READ please. tomgezen 15 5,090 02-18-2012, 20:33
Last Post: tomgezen
  im a noob caftdunt 7 1,597 12-18-2011, 14:05
Last Post: Romuald27
  Nother Noob eman71 8 1,940 12-10-2011, 00:24
Last Post: skata3000
  need help (noob) thethiny 13 2,367 10-17-2011, 16:58
Last Post: Tomsen1410
  Noob Cliff Jumping Yamato 4 1,650 09-12-2011, 19:42
Last Post: ddaavvee

Forum Jump:


Users browsing this thread: 1 Guest(s)