Create Account


Fast paced combat with goodies

#1
(This post was last modified: 07-19-2016, 05:46 PM by leiizko.)

Hello all.

This is something I made when I was learning how to script and maybe some of you find it useful. In a nutshell this modification aims to make combat fast paced with new killstreaks, b3 command support, new vision settings and more.
It also kinda looks like Iceops TDM modification just way more chaotic.

TDM features HighXP mode, a kill is worth 1000 points. Max score limit is 1000000 (one million - 1000 kills), default limit used on test servers was 300000.

Killstreaks are:
3KS (kill streak) - UAV
5KS - AGM (aka predator)
9KS - Artillery barage
12KS - Airstrike (extra: Bigger kill radius, planes now actually play FX)
18KS - Helicopter (extra: Heli now fires laser guided missiles, so expect to be hit by a missile if you stand still)
28KS - Predator drone (AGMs on a ammo system aka reaper)
40KS - AC130 (with all 3 cannons + different huds)
60KS - Tactical nuke (will end the game)

rcon commands (to be used with B3):
cmd fps:<Player_CID> (Disable/enable custom vision settings)
cmd fov:<Player_CID> (change Field of View settings - 1.0;1.125;1.25)

Scripts also include "SMART" spawn protection - If you move too far from your spawning point, it will auto disable.

Known bugs - note that at the time of scripting I was a complete newbie and a lot of the code is trashy.
-Auto team balance causes a lot of non-fatal script runtime errors - won't crash or lag the server but it will make your logfile extremely big over short periods of time (I had over 3GB log file in less than a month)
-Helicopter guided missiles sometimes fail to delete
-AGM, AC130 and predator drone killstreaks sometimes fail to hide you and to prevent you from being killed while using them
-AGM killstreaks sometimes fails to delete killmarkers, effectivly giving the person wallhack (may or may not happen with other killstreaks using killmarkers aswell - so far it never did)
-Only TDM was tested, so other modes might fail
-Do not go over 44 player slots; anything above that will eventually cause out of script variables critical error - This WILL crash the server
-Tactical nuke might kill you(this is not supposed to happen Tongue)
-If you respawn during active tactical nuke strike, you will be able to use weapon again aswell as having normal vision restored.

To change welcome message (big one that appears over the middle screen) go to _globallogic.gsc lines 696 and 719. Geowelcome and advs are located in main.gsc file, credits are in credit.gsc file (It's a BraXi DR script).


Extra goodies(not in the download):
-Randomised map rotation order (NOTE: Never tested on live server, was just an experiment of mine)
Code:
init()
{
    level endon( "game_ended" );

    if( !isDefined( game[ "randomised" ] ) )
        game[ "randomised" ] = false;
        
    if( game[ "randomised" ] )
        return;
        
    waittillframeend;
    
    if( getDvar( "sv_mapRotationCurrent" ) != "" )
        maplist = getDvar( "sv_mapRotationCurrent" );
    else
        maplist = getDvar( "sv_mapRotation" );
    
    wait .05;
    
    maplistarray = strtok( maplist, " " );
    pool = "";
    
    for( i=1; i<maplistarray.size; i+=2 )
    {
        pool += maplistarray[ i ] + ";";
        wait .05;
    }
    
    maplistarray = strtok( pool, ";" );
    
    if( !isDefined( maplistarray ) )
    {
        game[ "randomised" ] = true;
        return;
    }
    
    waittillframeend;
    
    while( 1 )
    {
        firstmap = maplistarray[ RandomIntRange( 0, maplistarray.size ) ];
        
        if( firstmap != getDvar( "mapname" ) )
            break;

        wait .05;
    }
    
    
    maplist = "map " + firstmap;
    
    for( i=0; i<maplistarray.size; i++ )
    {
        if( maplistarray[ i ] == firstmap )
            continue;
        
        maplist += " map " + maplistarray[ i ];
        
        wait .05;
    }
    
    setDvar( "sv_mapRotationCurrent", maplist );
    game[ "randomised" ] = true;
}

-script template for CoD4x client commands (commands with $ - Follow the official tutorial to add these in CoD4X wiki first)
Add the following lines at the end of "Callback_ScriptCommand(command, arguments)" function:
Code:
       waittillframeend;
    
    self notify( "cmd_executed", command, arguments );

then make a new script file and modify it to your preference (This script is from my other mod so it will not work out of the box with these scripts) - Follow the official CoD4X wiki tutorial on where to use addscriptcomand function (on game start), then thread commandhandler on connection for every player.
Code:
/*
    addScriptCommand( COMMAND_NAME, COMMAND_POWER )
    
    COMMAND_NAME = Command name, this is used to invoke the command ingame with $
    COMMAND_POWER = Power (integer) needed to invoke the command. Set to 1 if you want it to be usable by anyone. 0 will make it rcon only.

    --- commandHandler ---
    self = the player entity invoking the command
    cmd = command name from addScriptCommand
    arg = arguments supplied with command
*/
init()
{
    addscriptcommand( "fov", 1 );
    addscriptcommand( "fps", 1 );
    addscriptcommand( "music", 1 );
    
    thread plugins\plugins::eventHandler( ::commandHandler, "connect" );
}

commandHandler()
{
    self endon( "disconnect" );
    level endon( "game_ended" );
    
    for(;;)
    {
        self waittill( "cmd_executed", cmd, arg );
        
        waittillframeend;
        
        switch( cmd )
        {
            case "fps":
                if( self.pers["fullbright"] == 0 )
                {
                    self iPrintlnBold( "Fullbright ^2ON ^7" );
                    self setClientDvar( "r_fullbright", 1 );
                    self setstat(3155,1);
                    self.pers["fullbright"] = 1;
                }
                else
                {
                    self iPrintlnBold( "Fullbright ^1OFF" );
                    self setClientDvar( "r_fullbright", 0 );
                    self setstat(3155,0);
                    self.pers["fullbright"] = 0;
                }
                break;

            case "fov":
                if(self.pers["fov"] == 1 )
                {
                    self iPrintlnBold( "Field of View Scale: ^11.0" );
                    self setClientDvar( "cg_fovscale", 1.0 );
                    self setClientDvar( "cg_fov", 80 );
                    self setstat(3156,0);
                    self.pers["fov"] = 0;
                }
                else if(self.pers["fov"] == 0)
                {
                    self iPrintlnBold( "Field of View Scale: ^11.25" );
                    self setClientDvar( "cg_fovscale", 1.25 );
                    self setClientDvar( "cg_fov", 80 );
                    self setstat(3156,2);
                    self.pers["fov"] = 2;
                }
                else if(self.pers["fov"] == 2)
                {
                    self iPrintlnBold( "Field of View Scale: ^11.125" );
                    self setClientDvar( "cg_fovscale", 1.125 );
                    self setClientDvar( "cg_fov", 80 );
                    self setstat(3156,1);
                    self.pers["fov"] = 1;
                }
                break;
                
            case "music":
                if( !self.pers["disable_music"] )
                {
                    self.pers["disable_music"] = 1;
                    self iprintlnbold( "Killcam music ^1OFF" );
                    self setStat(3157,1);
                }
                else
                {
                    self.pers["disable_music"] = 0;
                    self iprintlnbold( "Killcam music ^2ON" );
                    self setStat(3157,0);
                }
                break;
                
            default:
                logPrint( "Unknown command invoked: " + cmd + " for player " + self.name + " with arguments: " + arg + "\n" );
                break;
        }
        
        waittillframeend;
    }
}

Credits:
-Parts of the code are from BraXi's Deathrun mod
-Parts of the code are from OpenWarfare mod

Use/edit this mod howerver you like, if you fix any of the bugs please upload the fixed version. If you have any questions I will do my best to answer them.

EDIT: Seems like the attachment isn't working so here is a mediafire link: Click me!
Reply

#2

very nice, thanks for sharing Smile
i'll have a closer look later
Reply

#3

ac130 i need it! ty Big Grin
Reply

#4

You might want to put this on something like Github and license it under an open-source license (although you have to check what is possible because you use parts of other mods with different licenses), so developers can easily help expand and improve it.
Good job though! A lot of people will enjoy this!
Reply

#5

tnx for share but those scripts is full of bugs,very strange coding man,tnx again!
Reply






ABOUT US
A client and server modification for Call of Duty: Modern Warfare with the aim to fix bugs and enhance gameplay!