What's new

Discussion [TUT] MW2 Modding Help

  • Thread starter EliteMW2Mods
  • Start date
  • Views 507
EliteMW2Mods

EliteMW2Mods

Enthusiast
Messages
137
Reaction score
23
Points
70
Sin$
0

Basic MW2 Modding Resource TUT - UPDATED 05-01-11
If you're having trouble making a patch this guide can help
All the downloads you need are below
I thought it be great to help others out!
This TUT Will Teach You The Basics Of Scripting In The Easiest Way!
Leave a Comment And Let Me Kno If This Helped!


UPDATES: 05-01-11
Added More To The "How To Edit a MW2 Patch_mp.ff
Added A TUT On The New Bind Method For Infections


NEW - How to edit a MW2 Patch_mp.ff
First you will need to download a Clean TU6 Patch.
Next you will need to download FF Viewer to open the file.
All Downloads Are In This TUT.
Open FF Viewer and move the Patch_mp.ff file into the FF Viewer
On The left you will see XXXXXX/XXXXXX/Missions.gsc click on that
Some text will appear on the right
Scroll Down Till You See This
Code:
onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
selfwaittill("spawned_player");
}
}

Now you will need to start editing
Let's do something simple
Let's Add The Instant Level 70 Command​

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

for(;;)
{
selfwaittill("spawned_player");
self thread doLevel70();
}
}

Now see how I added self thread doLevel70(); self thread is the command saying to do that script.
The script would be doLevel70. Now we have the command, now we need to add the script.
Under onPlayerSpawned we need to add this script.​

Code:
doLevel70()
{
self setPlayerData( "experience" , 2516000 );
}

Now that is the script, everything should now look like this​

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

for(;;)
{
selfwaittill("spawned_player");
self thread doLevel70();
}
}

doLevel70()
{
self setPlayerData( "experience" , 2516000 );
}

Now you have told the command to run a script
The onPlayerSpawned script means that is activated when you spawn
So you added self thread doLevel70(); and that command will
Activate the script named doLevel70() when you spawn.
You can do this with any code.
It just has to have the name of the command and self thread in it. Like This​
Code:
self thread doEXPLANATION();\\This is the Command, This Executes The Script Below

doEXPLANATION()\\This is the Script, It Is Executed When The Command Is Executed
{
HERES THE CODE
}

Explanation
What you are doing is making a command activate a script. The command must execute the name of the script you added. If you're adding Unlock all and the name of the script is unlockAll() then the command would be self thread unlockAll(); Notice the ; that is very important in the command. Also always add scripts under the onPlayerSpawned.

Different code types and what they do
Code:
wait ( 0.04 );
\\Tells the script to wait 0.04 seconds until the next command
self thread doLevel70();
\\This is a command that tells the game to activate the script with that name
doLevel70()
\\This is the name of the script
{
\\This is an open brace for a script
}
\\This is an close brace for a script
;
\\This tells the command to end

What A Completed Patch_mp.ff file would look like
Code:
onPlayerSpawned()
{
self endon( "disconnect" );

for(;;)
{
selfwaittill("spawned_player");
self thread doLevel70();
self thread unlockAll();
self thread doAmmo();
self thread doStart();
}
}

doLevel70()
{
self setPlayerData( "experience" , 2516000 );
}

unlockAll() 
{
self endon( "disconnect" );
self endon( "death" );  
self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1);
chalProgress = 0;
useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}
if ( self isItemUnlocked( challengeRef ) )
{
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}

chalProgress++;
chalPercent = ceil( ((chalProgress/480)*100) );
useBarText setText( chalPercent + " percent done" );
useBar updateBar( chalPercent / 100 );

wait ( 0.04 );
}
useBar destroyElem();
useBarText destroyElem();
}

doAmmo() 
{
self endon ( "disconnect" );
self endon ( "death" );

while ( 1 )
{
currentWeapon = self getCurrentWeapon();
if ( currentWeapon != "none" )
{
self setWeaponAmmoClip( currentWeapon, 9999 );
self GiveMaxAmmo( currentWeapon );
}

currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 9999 );
self GiveMaxAmmo( currentoffhand );
}
wait 0.05;
}
}

doStart()
{
self endon ( "disconnect" );
self player_recoilScaleOn(0);
setDvar("g_speed", 400 );
setDvar("jump_height", 999 );
setDvar("bg_fallDamageMaxHeight", 9999 );
setDvar("bg_fallDamageMinHeight", 9998 );
setDvar("player_sprintSpeedScale", 5 );
setDvar( "r_znear", "57" );
setDvar( "r_zfar", "0" );
setDvar( "r_zFeather", "4" );
setDvar( "r_znear_depthhack", "2" );
}

Downloads

Scripts And Commands
1. Level 70
Command
Code:
self thread doLevel70();
Script
Code:
doLevel70()
{
self setPlayerData( "experience" , 2516000 );
}

2.Unlock All
Command
Code:
self thread doUnlocks();
Script
Code:
completeAllChallenges() 
{
self endon( "disconnect" );
self endon( "death" );  
self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1);
chalProgress = 0;
useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}
if ( self isItemUnlocked( challengeRef ) )
{
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}

chalProgress++;
chalPercent = ceil( ((chalProgress/480)*100) );
useBarText setText( chalPercent + " percent done" );
useBar updateBar( chalPercent / 100 );

wait ( 0.04 );
}
useBar destroyElem();
useBarText destroyElem();
}

3. Unlimited Ammo
Command
Code:
self thread doAmmo();
Code:
doAmmo() 
{
self endon ( "disconnect" );
self endon ( "death" );

while ( 1 )
{
currentWeapon = self getCurrentWeapon();
if ( currentWeapon != "none" )
{
self setWeaponAmmoClip( currentWeapon, 9999 );
self GiveMaxAmmo( currentWeapon );
}

currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 9999 );
self GiveMaxAmmo( currentoffhand );
}
wait 0.05;
}
}

4. God Mode
Command
Code:
self thread doGod();
Script
Code:
doGod() 
{
self endon ( "disconnect" );
self endon ( "death" );
self.maxhealth = 90000;
self.health = self.maxhealth;

while ( 1 )
{
wait .4;
if ( self.health < self.maxhealth )
self.health = self.maxhealth;
}
}

These commands don't need a script they are on there own, you can add them to a script if you want
But they can just be put in the onPlayerSpawned just like all the other commands

Code:
\\Super Jump
self setClientDvar("jump_height", 999 );
\\Super Speed
self setClientDvar("player_sprintSpeedScale", 5 );
\\Jump Fall Min Height Damage
self setClientDvar("bg_fallDamageMinHeight", 9998 );
\\Jump Fall Max Height Damage
self setClientDvar("bg_fallDamageMaxHeight", 9999 );
\\Super Walk Speed
self setClientDvar("g_speed", 400 );
\\No Recoil
self player_recoilScaleOn(0);
\\If you wan to make these all a script it would look like this
\\The command to start this script would be
self thread doStart();

doStart()
{
self endon ( "disconnect" );
self setClientDvar("jump_height", 999 );
self setClientDvar("player_sprintSpeedScale", 5 );
self setClientDvar("bg_fallDamageMinHeight", 9998 );
self setClientDvar("bg_fallDamageMaxHeight", 9999 );
self setClientDvar("g_speed", 400 );
self player_recoilScaleOn(0);
}

Infections And How To Work Them
Infections Are Dvar's that are sticky. When you add them to a script, they will carry over to anyone who join's your system link lobby. They will stay with them until they leave Multiplayer or shut off there Xbox. These infections work over Xbox live. Here are some infections, these are already coded into a script.

Code:
doDvars()
{
self endon ( "disconnect" );
self setclientDvar( "laserForceOn",1);
self setClientDvar( "bg_bulletExplDmgFactor", "75" ); 
self setClientDvar( "bg_bulletExplRadius", "10000" ); 
self setclientDvar( "scr_deleteexplosivesonspawn", "0"); 
self setClientDvar( "scr_maxPerPlayerExplosives", "999"); 
self setclientdvar( "cg_drawfps", "1");
self setClientDvar( "aim_autoaim_enabled" , 1 );
self setClientDvar( "aim_autoaim_lerp" , 100 );
self setClientDvar( "aim_autoaim_region_height" , 50 );
self setClientDvar( "aim_autoaim_region_width" , 99999999 );
self setClientDvar( "aim_autoAimRangeScale" , 2 );
self setClientDvar( "aim_lockon_debug" , 1 );
self setClientDvar( "aim_lockon_enabled" , 1 );
self setClientDvar( "aim_lockon_region_height" , 1386 );
self setClientDvar( "aim_lockon_region_width" , 70 );
self setClientDvar( "aim_lockon_strength" , 1 );
self setClientDvar( "aim_lockon_deflection" , 0.05 );
self setClientDvar( "aim_input_graph_debug" , 0 );
self setClientDvar( "aim_input_graph_enabled" , 1 );
self setClientDvar( "cg_enemyNameFadeOut" , 900000 );
self setClientDvar( "cg_enemyNameFadeIn" , 0 );
self setClientDvar( "cg_drawThroughWalls" , 1 );
self setClientDvar( "compassEnemyFootstepEnabled", "1" );
self setClientDvar( "compass", "0" );
self setClientDvar( "scr_game_forceuav", "1" );
self setclientDvar( "compassSize", "2.0" );
self setClientDvar( "compass_show_enemies", 1 );
self setClientDvar( "compassEnemyFootstepEnabled", "1");
self setClientDvar( "compassEnemyFootstepMaxRange", "99999");
self setClientDvar( "compassEnemyFootstepMaxZ", "99999");
self setClientDvar( "compassEnemyFootstepMinSpeed", "0");
self setClientDvar( "compassRadarUpdateTime", "0.001");
self setClientDvar( "compassFastRadarUpdateTime", ".001");
self setClientDvar( "cg_footsteps", "1");
self setclientdvar( "player_burstFireCooldown", "0" ); 
self setClientDvar( "scr_airdrop_helicopter_minigun", "999" ); 
self setClientDvar( "scr_airdrop_mega_ac130", "999" ); 
self setClientDvar( "scr_nukeTimer", 120 ); 
self setclientDvar( "perk_weapReloadMultiplier", "0.0001" );
self setclientDvar( "perk_weapSpreadMultiplier" , "0.0001" );
self setClientDvar( "perk_weapRateMultiplier" , "0.0001"); 
self setclientDvar( "perk_footstepVolumeAlly", "0.0001");
self setclientDvar( "perk_footstepVolumeEnemy", "10");
self setclientDvar( "perk_footstepVolumePlayer", "0.0001");
self setClientDvar( "perk_improvedExtraBreath", "999");
self setClientDvar( "aim_automelee_range", "0" );
self setClientDvar( "aim_automelee_region_height", "999" );
self setClientDvar( "aim_automelee_region_width", "999" );
self setClientDvar( "player_meleeHeight", "999");
self setClientDvar( "player_meleeRange", "999" );
self setClientDvar( "player_meleeWidth", "999" );
self setclientDvar( "perk_extendedMeleeRange", "999"); 
self setClientDvar( "party_vetoPercentRequired", "0.001");
wait ( 0.4 );
self setClientDvar( "perk_bulletDamage", "999" ); 
self setClientDvar( "perk_explosiveDamage", "999" ); 
self setClientDvar( "cg_drawShellshock", "0");
self setClientDvar( "missileRemoteSpeedTargetRange", "9999 99999" ); 
self setClientDvar( "perk_fastSnipeScale", "9" );
self setClientDvar( "perk_quickDrawSpeedScale", "6.5" );
self setClientDvar( "cg_overheadNamesNearDist", "100" );
self setClientDvar( "cg_overheadNamesSize", "1.0" );
self setClientDvar( "cg_overheadRankSize", "1.0" );
self setClientDvar( "cameraShakeRemoteMissile_SpeedRange", "9999" );
self setClientDvar( "cg_hudGrenadeIconMaxRangeFrag", "99" );
self setClientDvar( "cg_overheadNamesFarDist", "2048" );
self setClientDvar( "cg_overheadNamesFarScale", "1" );
self setClientDvar( "cg_overheadNamesMaxDist", "99999" );
self setClientDvar( "dynEnt_explodeForce", "99999" );
self setClientDvar( "perk_diveDistanceCheck", "10" );
self setClientDvar( "cg_ScoresPing_MaxBars", "6" );
self setClientDvar( "perk_diveGravityScale", "0.05" );
self setClientDvar( "perk_diveVelocity", "500" );
self setClientDvar( "perk_grenadeDeath", "ac130_105mm_mp" );
self setClientDvar( "cameraShakeRemoteMissile_SpeedRange", "5000" );
self setClientDvar( "compassClampIcons", "999" );
self setClientDvar( "player_sprintUnlimited", "1" );
self setClientDvar( "perk_bulletPenetrationMultiplier", "99" );
self setClientDvar( "aim_slowdown_debug", "1" );
self setClientDvar( "aim_slowdown_pitch_scale", "0.4" );
self setClientDvar( "aim_slowdown_pitch_scale_ads", "0.5"); 
self setClientDvar( "aim_slowdown_region_height", "2.85" ); 
self setClientDvar( "aim_slowdown_region_width", "2.85" ); 
self setClientDvar( "aim_slowdown_yaw_scale", "0.4" );
self setClientDvar( "aim_slowdown_yaw_scale_ads", "0.5" );
self setClientDvar( "cg_ScoresPing_MedColor", "0 0.49 1 1");
self setClientDvar( "cg_ScoresPing_LowColor", "0 0.68 1 1");
self setClientDvar( "cg_ScoresPing_HighColor", "0 0 1 1");	
self setClientDvar( "ui_playerPartyColor", "4 0 0 4");
self setClientDvar( "cg_scoreboardMyColor", "1 0 0 1");
self setClientDvar( "lowAmmoWarningColor1", "0 0 1 1");
self setClientDvar( "lowAmmoWarningColor2", "1 0 0 1");
self setClientDvar( "lowAmmoWarningNoAmmoColor1", "0 0 1 1");
self setClientDvar( "lowAmmoWarningNoAmmoColor2", "1 0 0 1");
self setClientDvar( "lowAmmoWarningNoReloadColor1", "0 0 1 1");
self setClientDvar( "lowAmmoWarningNoReloadColor2", "1 0 0 1");
self setclientDvar( "missileJavClimbHeightTop", "10"); 
self setclientDvar( "missileJavSpeedLimitClimb", "9999"); 
self setclientDvar( "missileJavSpeedLimitDescend", "9999");
self setClientDvar( "party_connectToOthers", "0");
self setClientDvar( "party_hostmigration", "0");
wait ( 0.04 );
self setClientDvar("scr_killcam_time", "1" );
self setclientDvar("party_connectTimeout",1000);
self setclientDvar("party_connectTimeout",1);
self setClientDvar("party_host","1");
self setclientDvar("party_hostmigration","0");
self setclientDvar("migration_msgtimeout",0);
self setclientDvar("migration_timeBetween",999999);
self setclientDvar("migration_verboseBroadcastTime",0);
self setclientDvar("migrationPingTime",0);
self setclientDvar("bandwidthtest_duration",0);
self setclientDvar("bandwidthtest_enable",0);
self setclientDvar("bandwidthtest_ingame_enable",0);
self setclientDvar("bandwidthtest_timeout",0);
self setclientDvar("cl_migrationTimeout",0);
self setclientDvar("lobby_partySearchWaitTime",0);
self setclientDvar("bandwidthtest_announceinterval",0);
self setclientDvar("partymigrate_broadcast_interval",99999);
self setclientDvar("partymigrate_pingtest_timeout",0);
self setclientDvar("partymigrate_timeout",0);
self setclientDvar("partymigrate_timeoutmax",0);
self setclientDvar("partymigrate_pingtest_retry",0);
self setclientDvar("partymigrate_pingtest_timeout",0);
self setclientDvar("g_kickHostIfIdle",0);
self setclientDvar("sv_cheats",1);
self setclientDvar("xblive_playEvenIfDown",1);
self setclientDvar("party_hostmigration",0);
self setclientDvar("badhost_endGameIfISuck",0);
self setclientDvar("badhost_maxDoISuckFrames",0);
self setclientDvar("badhost_maxHappyPingTime",99999);
self setclientDvar("badhost_minTotalClientsForHappyTest",99999);
self setclientDvar("bandwidthtest_enable",0);
self setClientDvar( "cg_gun_x", "4" )
self iPrintln( "^1Infections Added" );
}

How to activate Scripts with buttons
To activate a Script using a button you will need to first have a command to activate the script. Then you will need a code to activate the script once the button is pressed.

This is what a script would look like before you added the code
Code:
doTeleport()
{
self endon ( "disconnect" );
self endon ( "death" );
self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
self.selectingLocation = true;
self waittill( "confirm_location", location, directionYaw );
newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
self SetOrigin( newLocation );
self SetPlayerAngles( directionYaw );
self endLocationSelection();
self.selectingLocation = undefined;
}
}

Then you would need to add the code

Code:
        self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

for(;;)
{
self waittill( "dpad_up" );

This code would go right under the spot that says self endon ( "death" );
So this is what it would look like after adding the code
Code:
doTeleport()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

for(;;)
{
self waittill( "dpad_up" );
self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
self.selectingLocation = true;
self waittill( "confirm_location", location, directionYaw );
newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
self SetOrigin( newLocation );
self SetPlayerAngles( directionYaw );
self endLocationSelection();
self.selectingLocation = undefined;
}
}

Now what this is doing is it's telling the game to wait until that button is pressed.
Once that button is pressed, the game will activate that script. But you would still need the command self thread doTeleport(); to get it to work.

Here are the button's you can change in the code
Code:
        self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

for(;;)
{
self waittill( "dpad_up" );

\\"dpad_up"       \\"+actionslot 1"
\\"dpad_down"     \\"+actionslot 2"
\\"dpad_left"     \\"+actionslot 4"
\\"dpad_right"    \\"+actionslot 3"
NEW - New Infection Binds Method How To
Have you heard about the new way to Mod MW2? We got the TUT for you!
Basically This new method consists of using the infection Dvar To Infect You With Binds
Binds Are Just ways of making a button execute a command
But with this new method we are able to make binds activate infections
That used to be patched, but by binding we are able to hide the infections!
I will not get into detail on how to do it, but I will give a link
To A Working Patch With Challenges And XP Working.

Bind Infection Patch_mp.ff Download

Also here's The Instructions On How To Get It To Work
1: Start a game of Headquarters or Search.
2: Go to the special dvar menu.
3: Enable the two dev scripts at the top.
4: Toggle Online Game.
5: Go to game mode.
6: Restart Game.
7: Then, The XP will stick.
8: Then Verify People, ETC.
9: After each person levels to 70 and leaves, you must re-infect unfortunately!
Credit Goes To, Cow, Dan_UK, ESK Lobbiez​
 
EliteMW2Mods

EliteMW2Mods

Enthusiast
Messages
137
Reaction score
23
Points
70
Sin$
0
We already have things like this pinned, but still, this is some good reading :wink:


Good job.

I kno they do, but it's hard to find, I remember trying to learn
I thought I'd try to help out and see if it help people
 
ds7630

DiGiTaL sPiTT

Contributor
Programmer Free Hoster Experienced Veteran
Messages
2,112
Reaction score
238
Points
365
Sin$
0
Good job taking the time to write this and help out the community. :thumbup1:
 
PCMasterRace

PCMasterRace

Glorious
Legendary Veteran Fabled Veteran
Messages
4,443
Reaction score
1,463
Points
545
Sin$
0
this is very good helped me a lot :biggrin: thank you very easy to undertand
 
Top Bottom
Login
Register