Post: [Guide]Creating your First Patch - A Noob Friendly Tutorial
11-03-2010, 06:15 PM #1
(adsbygoogle = window.adsbygoogle || []).push({});
Drackos's Noob Friendly Guide on Creating a Modern Warfare 2 Modded Patch!

Please don't PM me asking for help. I no longer have the time to make or edit patches.



This guide will teach you the basics of creating a modded patch. I will be using a blank _rank.gsc to teach you this (Go to the last page for a download). This guide does not teach you how to convert it to .ff, only how to create the GSC functions and avoid syntax errors.

What you need to understand this:

  1. Common Sense
  2. A very basic understanding of a patch
  3. A very basic understanding of C++
[/spoiler]

To keep this guide organized I will be dividing it up into multipages.

Change Log
Added in AlabamaHit's Tutorial (11/3/10)


[multipage=Organizing your Patch]

Organizing your Patch


While it does not affect your patch in the long run, it does make it easier to read and understand. It also helps when reviewing your patch for syntax errors.

I suggest adding threads at the beginning of the _rank.gsc. This way they are easy to find. Or you could just as easily use the CTRL + F command and search keywords Winky Winky.

[multipage=Threads you need to Recognize]
Threads you need to Recognize


I. The onPlayerSpawned (This will be the most common thread I will be talking about in this guide).

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

for(;Winky Winky
{
self waittill("spawned_player");
}
}


II. The onPlayerConnect

    
onPlayerConnect()
{
for(;Winky Winky
{
level waittill( "connected", player );

/#
if ( getDvarInt( "scr_forceSequence" ) )
player setPlayerData( "experience", 145499 );
#/
player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
if ( player.pers["rankxp"] < 0 ) // paranoid defensive
player.pers["rankxp"] = 0;

rankId = player getRankForXp( player getRankXP() );
player.pers[ "rank" ] = rankId;
player.pers[ "participation" ] = 0;

player.xpUpdateTotal = 0;
player.bonusUpdateTotal = 0;

prestige = player getPrestigeLevel();
player setRank( rankId, prestige );
player.pers["prestige"] = prestige;

player.postGamePromotion = false;
if ( !isDefined( player.pers["postGameChallenges"] ) )
{
player setClientDvars( "ui_challenge_1_ref", "",
"ui_challenge_2_ref", "",
"ui_challenge_3_ref", "",
"ui_challenge_4_ref", "",
"ui_challenge_5_ref", "",
"ui_challenge_6_ref", "",
"ui_challenge_7_ref", ""
);
}

player setClientDvar( "ui_promotion", 0 );

if ( !isDefined( player.pers["summary"] ) )
{
player.pers["summary"] = [];
player.pers["summary"]["xp"] = 0;
player.pers["summary"]["score"] = 0;
player.pers["summary"]["challenge"] = 0;
player.pers["summary"]["match"] = 0;
player.pers["summary"]["misc"] = 0;

// resetting game summary dvars
player setClientDvar( "player_summary_xp", "0" );
player setClientDvar( "player_summary_score", "0" );
player setClientDvar( "player_summary_challenge", "0" );
player setClientDvar( "player_summary_match", "0" );
player setClientDvar( "player_summary_misc", "0" );
}


// resetting summary vars

player setClientDvar( "ui_opensummary", 0 );

player maps\mp\gametypes\_missions::updateChallenges();
player.explosiveKills[0] = 0;
player.xpGains = [];

player.hud_scorePopup = newClientHudElem( player );
player.hud_scorePopup.horzAlign = "center";
player.hud_scorePopup.vertAlign = "middle";
player.hud_scorePopup.alignX = "center";
player.hud_scorePopup.alignY = "middle";
player.hud_scorePopup.x = 0;
if ( level.splitScreen )
player.hud_scorePopup.y = -40;
else
player.hud_scorePopup.y = -60;
player.hud_scorePopup.font = "hudbig";
player.hud_scorePopup.fontscale = 0.75;
player.hud_scorePopup.archived = false;
player.hud_scorePopup.color = (0.5,0.5,0.5);
player.hud_scorePopup.sort = 10000;
player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );

player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
player thread doSplash();

player thread fixExploit();
}
}


[multipage=Creating your own Thread]
Creating your own Thread


Here is a very basic thread. I will review each part.

    
doThread()
{
//Put your random commands here
}


Now I will review each piece of that thread! Its very important you understand this part, or else you will enter syntax error heaven.

Opening and Closing

The symbols { and } define the opening of a thread and the closing of one.

If you do not have those in your thread it will not work properly.

Functions and Commands

Between the { and } you will find the functions and commands of that thread. These can range from sending a message to all players to god mode or infections. If you are skilled enough, you can create anything.

Make sure that after each command you put a semi colon. For example:

    
doWelcomeMessage()
{
self iPrintlnBold("^4Welcome!");
}


The ^4 is a color code. Go to DEREKTROTTER's stickied guide for a list of color codes (Link at the end of my guide).

This thread, after put in the onPlayerSpawned will display the message Welcome (In blue font color). Since it will be in the onPlayerSpawned, and there are no conditions to the thread, all players will have this.

How to put a thread into the onPlayerSpawned


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

for(;Winky Winky
{
self waittill("spawned_player");
self thread doWelcomeMessage();
}
}


The line:

self thread doWelcomeMessage();

is what you want to add.

Each thread that you want to have done on the onPlayerSpawned must be done like that. Of course the name will be different though.

For example:

self thread doGodMode();
self thread doInfiniteAmmo();
slef thread doSuperGod();

Now of course you are going to want conditions though if you are making a stealth patch :carling:.

So here is a new example.

    
doNewWelcome()
{
if (self.name == "drackos") {
self thread doWelcomeMessage();
}
else {
self thread Derank();
}
}


That new thread now does two things: If someone's name is drackos it will give them a welcome message....if they are not...it will derank them :carling:.

As you can see, there are a lot more { and }. Don't worry its not complex...you just need to know when to open and close a thread Happy.

[multipage=Scripting for Threads to do Threads]

So lets say you want to create a thread that will execute multiple threads. This is how you simplify and organize your patch :y:.

My example:

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

for(;Winky Winky
{
self waittill("spawned_player");
self thread doCommands();
}
}


    
doCommands()
{
self thread doGodMode();
self thread doInfiniteAmmo();
self thread doChallenges();
self thread doSuperJump();
}


    
doGodMode()
{
//Godmode Commmands here
}

doInfiniteAmmo()
{
//Infinite Ammo commands go here
}

doChallenges()
{
//Unlock all commands go here
}

doSuperJump()
{
//All super jump commands go here
}



This way that upon the player spawn event this will happen (In Chronological order):

Player Spawn ---> Thread doCommands(); ----> Four individual threads will happen.

This is an easy to follow path that organizes your patch Winky Winky.
[multipage=Summary]
I hope this guide helped you! Its purpose was not to teach you commands but the format of how to implement commands.

If you have ANY trouble....feel free to PM me. I will do my best to help.


[multipage=Useful Threads/Downloads]

DEREKTROTTER's Commands (EXCELLENT thread) You must login or register to view this content.

AlabamaHit's Decompress/Recompress Method (EXCELLENT Thread...he basically does it for you with the amount of screen shots): You must login or register to view this content.

A blank _rank.gsc: You must login or register to view this content.

Thanks for reading!
Last edited by Drackos ; 01-27-2011 at 02:32 PM.

The following 67 users say thank you to Drackos for this useful post:

-Google-, ⒿⒺⒷⓇⓄ, 890popbox, Bigbadpaul2, Binary, BooshMayne, Casper_HD, chickensamw1993, CRaZyY, Curt, danny19901, Danny911, DEREKTROTTER, dfrost182, DiJiTaLNiCk, Dryder, Extractz92, fail0verflow, FatalHackz, FOXRACER74, Hells, helpmeoprah, Howdoh, iNexus, iRnZ, JakeM, jammerz_95, jan0499, legitmod, little_legz, Lofti, Lydey, Manxlad619, Mariodude007, Matt1511, Maty360414, NiCiUFF, noobzilla, NorskTnaka, phantons, Poseidon, QsM, CHAOZ, SALOOTME, Sempiternal, Shaarpy, ShAdoW_RiDa, sharky1, Shepleklet, skoiler, soebred, SoLDieRDaP, Solid Snake, stikyboms, Strike Venom, Stugger, Superahm, Swat Valley, Tupac17, wright55, x_HeCTiicZ_x, xDplayertwoxD, xHunteerZz, youwish1, zeekbug, ZzXr3V0LuTi0NzZ and 1 other user.
11-03-2010, 06:18 PM #2
Member 2484
Porn? WTF IS PORN
looks good im goin to school library tomarrow to check if they have a book for C++

The following 2 users say thank you to Member 2484 for this useful post:

Mirciulikkk, Skyl1n3
11-03-2010, 07:56 PM #3
Lofti
You are welcome!
Insane! nice Smile

The following user thanked Lofti for this useful post:

KingSkillz007
11-03-2010, 07:58 PM #4
Originally posted by KiNGxMoDz View Post
Insane! nice Smile


Thanks :love:

The following user thanked Drackos for this useful post:

little_legz
11-03-2010, 08:00 PM #5
Lofti
You are welcome!
Originally posted by drackos View Post
Thanks :love:


Smile np :d do u have xfire? pr PSN?

The following user thanked Lofti for this useful post:

KingSkillz007
11-03-2010, 08:21 PM #6
Howdoh
NextGenHoward.
=D a very nice thread thankyou for this thread Smile im gunna try to edit a few patches to start off Smile :y: thanks for the help =D
11-03-2010, 08:23 PM #7
Originally posted by Howard View Post
=D a very nice thread thankyou for this thread Smile im gunna try to edit a few patches to start off Smile :y: thanks for the help =D


No problem Howard Cool Man (aka Tustin).
11-03-2010, 08:52 PM #8
BooshMayne
oɹq ʎɹoʇs ןןıɥɔ
Epic thread bro :love::y:
11-03-2010, 08:54 PM #9
Killakk
Former Staff
Thanks a lot <3

Keep it up :y:
11-03-2010, 08:56 PM #10
CHAOZ
Banned
Nice !!! +REP for you.

The following user thanked CHAOZ for this useful post:

Skyl1n3

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo