Post: How to edit/make patch's.
10-04-2010, 10:08 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); THIS HAS TAKEN ME FOREVER TO MAKE, Please don't flame. I have copy and pasted nothing.


If I haven't explained a code enough, incorrectly or just haven't posted one that you would like to see, please contact me.


Big thanks to MecAj for helping!


Check out my all new thread! You must login or register to view this content.

Ok, so in this thread I will be talking about basic patch editing. I must inform you first, however, that I'm only just learning too. Somethings I may be little wrong with and will update it when I figure it out. There is no need to flame me saying "wow, you so stupid, that doesn't go there" as no one has ever really wrote a tut. I will try my best and update as I learn new things :y:

First is first. We will be editing the mission.gcs only, as this is the only thing I know how to edit :P

So we will first start out with the
    onPlayerConnect()
What this means is that everything here will happen when the player connects to the game.

You are going to want to place this
    {
under neath the onPlayerConnect().

this is the start of the code. now press "enter" once and then press "tab" to keep it nice and neat.

now type in
    for(;Winky Winky
and press enter.

this is what you should have so far. onPlayerConnect()
{
for(;Winky Winky



Now press tab twice, and add "
    level waittill( "connected", player );


This means: wait till the player has connected.

Now press enter twice. Then copy and paste this code: if ( !isDefined( player.pers["postGameChallenges"] ) )
player.pers["postGameChallenges"] = 0;

player thread onPlayerSpawned();
player thread initMissionData();


The reason that I have you copy and paste this code is due to the fact that I don't know what it means yet. :P

Now to get permanent text on the screen you are going to want to use this code.

player.permText = player createFontString( "objective", 1.3 );
player.permText setPoint( "TOPRIGHT", "TOPRIGHT", -10, 30 + 10 );
player.permText setText("^5FourzerotwoFAILS's Lobby");

This goes right under the last code we posted. Now I'm going to tell you how to edit this code to your liking.

    player.permText = player createFontString( "objective", 1.3 );
↑ ↑
Type of Font Font Size

     player.permText setPoint( "TOPRIGHT", "TOPRIGHT", -10, 30 + 10 );
↑ ↑
What the -10 belongs to What the 30 + 10 belongs to



To change what it says and what color it is you need this code:
    player.permText setText("^5FourzerotwoFAILS's Lobby");


Yes, the default isn't FourzerotwoFAILS's lobby, that's just what i put. To change the color you change the ^# like you would in the clantag hack in cod4. And to change what it says just change the text inside the "

Now one of the most important parts of the patch:

onPlayerSpawned()

This is what tells the game what to do. Lets start out writing the begging of the code. onPlayerSpawned()
{
self endon( "disconnect" );

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


What this says is "end when disconnected from the lobby. It's for the player. Then it tells the game to wait until the player has been spawned.

Now to get stuff like god mode you're going to need to create your own new section called "doGod" which will contain all the codes that will act together to create god mode, but for this to work you need to make it so that the patch will actually do that. So under the onPlayerSpawned code we just posted, you're going to need to post the title of the bunch of codes.

so if you named it doGod() the code you need to add is
     self thread doGod();


so it would look like this: onPlayerSpawned()
{
self endon( "disconnect" );

for(;Winky Winky
{
self waittill( "spawned_player" );
self thread doGod();


Now, if you want to add text that comes up when you join the game that says something like "Thanks for joining my lobby!" then you would use this.
    notifyData = spawnstruct();
notifyData.titleText = "^5Welcome To ^6FourzerotwoFAILS^5's Lobby!";
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );


To add more than one line of text that pops up you would change the
    notifyData.titleText

to
    notifyData.notifyText

and for 3 lines just use this
    notifyData.notifyText2

For more lines, just change the number after text.

Next up is our dvars! This is where I'm going to explain a lot.

We're going to want to start out by making a new section (thread) for this in the patch. It has to have a name, so lets just name it Dvars.

Now it has to know to do this so we are going to start it out by adding "do" to it without a space. So it should look like this:

doDvars()

now we need to go back to our onPlayerSpawned() section and add this to the menu. Remember, to do that you just put
    self thread doDvars();


now under doDvars you're going to place another one of these { then hit enter.

Now you have to know whether the dvar is a client dvar, server dvar, or just a dvar.

The code for a client dvar works like this
    self setClientDvar("dvar","value")

for a server dvar you need two codes. the first one is just the client dvar format, then you need to use this code
    MakeDvarServerInfo ("dvar","value");


under the {you're going to put your dvars in whatever order you want. Lets just add see-through walls, and super jump.

See-through walls is a client dvar so the code would be:
    self setClientDvar("r_znear","35");


For the super jump it's just
    setDvar( "bg_fallDamageMaxHeight", "999" );
setDvar( "bg_fallDamageMinHeight", "999" );


This is what you should have so far for the dvar section.
doDvars()
{
setClientDvar("r_znear","35");
setDvar( "bg_fallDamageMaxHeight", "999" );
setDvar( "bg_fallDamageMinHeight", "999" );

}


for the entire patch you should have something like this:
onPlayerConnect()
{
for(;Winky Winky
{
level waittill( "connected", player );

if ( !isDefined( player.pers["postGameChallenges"] ) )
player.pers["postGameChallenges"] = 0;

player thread onPlayerSpawned();
player thread initMissionData();

player.permText = player createFontString( "objective", 1.3 );
player.permText setPoint( "TOPRIGHT", "TOPRIGHT", -10, 30 + 10 );
player.permText setText("^5FourzerotwoFAILS's Lobby");

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

for(;Winky Winky
{
self waittill( "spawned_player" );
notifyData = spawnstruct();
notifyData.titleText = "^5Welcome To ^6FourzerotwoFAILS^5's Lobby!";
notifyData.notifyText = "^0Have Fun^1 <3";
notifyData.notifyText2 = "^0and don't spam me!";
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
self thread doDvars();

}
}
doDvars()
{
setClientDvar("r_znear","35");
setDvar( "bg_fallDamageMaxHeight", "999" );
setDvar( "bg_fallDamageMinHeight", "999" );

}



God mode! I'm going to start making things in spoilers so I don't create a super long thread. It will be by hack for now on. I will post the code, then go into further detail with it.

God mode:
Code:
    
[COLOR="Red"]doGod()
{
if(self.name == level.hostname)
{
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;
}
}
}[/COLOR]


Now I'm going to explain what each part of the code means:
    [COLOR="Red"]if(self.name == level.hostname)[/COLOR]

This is saying that If the users name is the same as the level's host name (the host) then it will preform the action.

    [COLOR="Red"]self endon ( "disconnect" );
self endon ( "death" );[/COLOR]

This is saying that it will stop when the player disconnects or dies.

    [COLOR="Red"]self.maxhealth = 90000;
self.health = self.maxhealth;[/COLOR]

This is saying the max health is 90000. then it says that the players health is equal to the max health.

    wait .4;

This is telling it to wait 0.4 (unknown unit of time) then it repeats itself. So it is constantly setting the players health to the max health.

    [COLOR="Red"]if ( self.health < self.maxhealth )
self.health = self.maxhealth;[/COLOR]


This says that if the players health is less than the max health, it will set the players health to the max health. So everytime you get hurt, it will put your health right back to the max health.


How to make something work for only a certain player!


This is how to make a thread work for only a certain person.

The code to make it host only is this:
    [COLOR="Red"]if(self.name == level.hostname)[/COLOR]


What it says is If players name is the same as the levels host name then it will work. So you can change this to specific people like:
    [COLOR="Red"]if(self.name == FourzerotwoFAILS)[/COLOR]


That means if the players name is the same as FourzerotwoFAILS, then it will work.


Unlimited Ammo!
Code:
    [COLOR="Red"]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;
}
}[/COLOR]

Now remember to add self thread doAmmo(); to the onPlayerSpawned()

Explanation:
Coming Soon :P


Rain Money!
code:
    [COLOR="Red"]rainMoney()
{
if(self.name == level.hostname)
{
self endon ( "disconnect" );
self endon ( "death" );
while (1)
{
playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );
wait 0.5;
}
}
}[/COLOR]


Explanation:
We know most of the code, so let's just do what we don't know.

    [COLOR="Red"]playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );[/COLOR]

This means. Play the special affect. Then it says, the level effect "money" then it says, put it on the j_spine4 which is the spine of the player. And then we know that the wait 0.5 means that it waits 0.5 before repeating.


Nuke Bullets!
Code:
    [COLOR="Red"]nukeBullets()
{
if(self.name == level.hostname)
{
for(;Winky Winky
{
self waittill ( "weapon_fired" );
forward = self getTagOrigin("j_head");
end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
SPLOSIONlocation = BulletTrace( forward, end, 0, self )[ "position" ];
level.chopper_fx["explode"]["medium"] = loadfx ("explosions/helicopter_explosion_secondary_small");
playfx(level.chopper_fx["explode"]["medium"], SPLOSIONlocation);
RadiusDamage( SPLOSIONlocation, 500, 1000, 500, self );
}
}
}[/COLOR]


Explination:
    [COLOR="Red"]self waittill ( "weapon_fired" );[/COLOR]

This says, wait until the player fires their weapon

    [COLOR="Red"]forward = self getTagOrigin("j_head");
end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000); [/COLOR]
This one is still unknown to me, will update once I figure it out.

    [COLOR="Red"]SPLOSIONlocation = BulletTrace( forward, end, 0, self )[ "position" ];[/COLOR]

This means that the explosion location is going to follow the bullet, then preform the foward code, then the end code(both are the code above) then 0 then self. which means that it's going to affect things in that order.

    [COLOR="Red"]level.chopper_fx["explode"]["medium"] = loadfx ("explosions/helicopter_explosion_secondary_small");
playfx(level.chopper_fx["explode"]["medium"], SPLOSIONlocation);
RadiusDamage( SPLOSIONlocation, 500, 1000, 500, self );
}
}[/COLOR]


That basicly means that it's going to load the fx then play the fx at the explosion location.


Colored Class Names!
This code goes in the onPlayerConnect() thread
Code:
    [COLOR="Red"]        player setPlayerData( "customClasses", 0, "name", "^1 Custom Class 1" );
player setPlayerData( "customClasses", 1, "name", "^2 Custom Class 2" );
player setPlayerData( "customClasses", 2, "name", "^3 Custom Class 3" );
player setPlayerData( "customClasses", 3, "name", "^5 Custom Class 4" );
player setPlayerData( "customClasses", 4, "name", "^6 Custom Class 5" );
player setPlayerData( "customClasses", 5, "name", "^1 Custom Class 6" );
player setPlayerData( "customClasses", 6, "name", "^2 Custom Class 7" );
player setPlayerData( "customClasses", 7, "name", "^3 Custom Class 8" );
player setPlayerData( "customClasses", 8, "name", "^5 Custom Class 9" );
player setPlayerData( "customClasses", 9, "name", "^6 Custom Class 10" );[/COLOR]


Explination:
    [COLOR="Red"] player setPlayerData

[/COLOR]
This is all pretty simple, it just says, set the players data then the code.
    [COLOR="Red"]( "customClasses", 8, "name", "^5 Custom Class 9" );[/COLOR]

This is self explanatory :P


Teleporting!
Code:
    [COLOR="Red"]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;
}
}
[/COLOR]


Explination:
    [COLOR="Red"]self beginLocationselection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );[/COLOR]

This means start Locationselection, then it opens the artillery selector and says the map size.

    [COLOR="Red"]self.selectingLocation = true;[/COLOR]

This means that it's allowing the player to select a location.

    [COLOR="Red"]self waittill( "confirm_location", location, directionYaw );[/COLOR]

This says wait until the player confirms the location.

    [COLOR="Red"]newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];[/COLOR]

This says set the new location equal to the selected location.

    [COLOR="Red"]self SetOrigin( newLocation );
self SetPlayerAngles( directionYaw );
self endLocationselection();
self.selectingLocation = undefined;[/COLOR]

This just says set the player in its new location.


Some cool looking text! Thanks to MecAj PressYou must login or register to view this content. to rep him!
code:
    [COLOR="Red"]doRainbow()
{

Rainbow = self createFontString( "objective", 3.0 );
Rainbow setPoint( "TOPLEFT", "TOPLEFT", 0, 30 + 100 );
Rainbow setText( "FourzerotwoFAILS" );
self thread destroyOnDeath( Rainbow );
for ( ;; )
{
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 1, 0, 0 );
wait 0.3;
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 0, 1, 0 );
wait 0.3;
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 0, 0, 1 );
wait 0.3;
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 1, 0, 1 );
wait 0.3;
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 1, 5, 5 );
wait 0.3;
Rainbow.fontScale = 3.0;
Rainbow FadeOverTime( 0.3 );
Rainbow.color = ( 1, 1, 0 );
wait 0.3;
}
}

destroyOnDeath( Rainbow )
{
self waittill ( "death" );
Rainbow destroy();
}[/COLOR]


Explanation:

It's all really self explanatory, however if you feel like you don't understand it, just let me know.



Verification!

Currently under construction!

For a complete tutorial on c++ visit this link:You must login or register to view this content.
And thanks to sOuLja_x023x for finding that link :P
MORE IS ON ITS WAY!
(adsbygoogle = window.adsbygoogle || []).push({});

The following 31 users say thank you to FourzerotwoFAILS for this useful post:

$oulja, angel_of_deth, Assassin, Blackstorm, charlie1234, Chronos, CleanMODSHD, Cyrious, DEREKTROTTER, DiJiTaLNiCk, Done #3, EZ., F_S_M, iJokaa, Judgement, Kameo, lilkiller6009, lmg123, malik-ramires, Man Dime, Mr. Wood, Norman, Quzit, RaD-SVT, CHAOZ, Sharpie, Shieldsy, Swifter, T-Icey, TehMike, Tupac17
10-04-2010, 11:31 PM #11
Assassin
Easter Egg!
nice work m8
finally , a thread with exact details Smile
10-04-2010, 11:32 PM #12
Originally posted by bob View Post
nice work m8
finally , a thread with exact details Smile


Yea, I have seen threads that just post the code and don't tell you where to put them or what they mean, which just confuses people even more.
10-04-2010, 11:36 PM #13
Assassin
Easter Egg!
i`ll try n make a patch , thanks to this thread , my jb some time this week Smile
10-04-2010, 11:45 PM #14
Originally posted by x023x View Post
Looks like a GREAT post & could possibly be stickied if you keep it updated & get someone like EliteMossy or xxprokillaxx to verify your methods are all correct. Well deserving of my thanks for this hard work


Well hopefully a mod see's it and thinks it's sticky worthy, however I haven't seen any stickies that are from non-premiums yet :(
10-04-2010, 11:51 PM #15
PS3LUV3R
Too Beast
I was about to groan this thread, but at least you put in you're time and effort into it.

Only reason I don't like this thread is, there are many good ones already, some even better than this one.
10-05-2010, 12:00 AM #16
Originally posted by PS3LUV3R View Post
I was about to groan this thread, but at least you put in you're time and effort into it.

Only reason I don't like this thread is, there are many good ones already, some even better than this one.


The only ones I've seen just post the code, they don't explain it or tell you where to put it. I'm explaining everything about it.
10-05-2010, 12:03 AM #17
AlabamaHit
ROLL TIDE!!!
Yeah, but don't you realize how hard it is going to be to try to teach 10 year old kids c++.

Your better off linking them to websites to teach them how to program.

But nice error though. Keep up the good work.

The following user thanked AlabamaHit for this useful post:

lilkiller6009
10-05-2010, 12:11 AM #18
Originally posted by AlabamaHit View Post
Yeah, but don't you realize how hard it is going to be to try to teach 10 year old kids c++.

Your better off linking them to websites to teach them how to program.

But nice error though. Keep up the good work.


This is the way I see things on this site. There are those that are natural programmers/patch makers, TheUnknown, elitemossy, havoc undead... Then there are the 10 year olds that will never be able to do this, then there are people like me. We can kind of do it, but we don't really know a lot about it. We really want to learn, but there is no one that can be bothered to teach us. It gets really annoying when people keep things to themselves so no one else can learn, as a matter of fact, it's pretty selfish to. That's why I created this thread.

The following user thanked FourzerotwoFAILS for this useful post:

Quzit
10-05-2010, 12:25 AM #19
AlabamaHit
ROLL TIDE!!!
Originally posted by FourzerotwoFAILS View Post
This is the way I see things on this site. There are those that are natural programmers/patch makers, TheUnknown, elitemossy, havoc undead... Then there are the 10 year olds that will never be able to do this, then there are people like me. We can kind of do it, but we don't really know a lot about it. We really want to learn, but there is no one that can be bothered to teach us. It gets really annoying when people keep things to themselves so no one else can learn, as a matter of fact, it's pretty selfish to. That's why I created this thread.


I understand fully. And I don't keep things to myself...(Not sure if you where trying to insinuate that or not.)

"We as a community" Can literally "Not" teach you a programming language. That would be like me trying to teach you how to speak another language. THere are Millions of tutorial to teach people that.

And those "Natural Programmer" Trust me they are not "Natural" they went to school or like I did, and Learnt from the same tutorial I was telling you about.

Now, you listed one in there..Not to take from him...but most is giving mossy tons of credit which he diserves. He did alot for community but people are mistaken some things. "Mossy patch" is the "Havoc patch" edited.

I know that has no point just stating it...cause seems no one has noticed....

But again..there is no "Natural Programmer" we all learnt somewhere.

And programming is way more indepth than you can imagine. That is why you can't be taught it from a person on a site.

You have to put together and learn from tutorials from 100s of sites. Taking parts from them all and putting them together.

If you took my post as disrespect, it wasn't ment like that..I was just telling you that your trying to start somethign that you honestly wont be able to finish.

Your just posting codes and 'kinda' explaining what the is.

But your not saying why are there () why are there ;

What is the for( ;; )

What is while()

WHat is a function?

What is a loop?

That is simple stuff...but that is just starting out..no point to that really just saying teling them that

isHost() means that the host will get it. Will not teach them programming.

Breaking that down would. Telling them that isHost() is a variable/function already been told what it is in another location. And how they are able to call that function on that page. etc...

I'm not trying to argue or discorage you, i was trying to let you know your probarly getting into somethign way to indepth.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo