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-06-2010, 07:22 PM #38
Originally posted by MecAj View Post
fixing post....


I have a few questions. First off, with the variables that you said I can change, where do they go in the patch? Like
    ChangeFontScaleOverTime( "value" );


Also where is this "heartElement"? And with the heartElement, where it says (thread Name) would that be the name of the thread that I want it to end, or is that just referring to the thread text?


Also, just wanted to let you know I'm going to be up-dating this thread soon with some of your info, which I will give all credit to you :P
10-07-2010, 03:23 AM #39
Blackstorm
Veni. Vidi. Vici.
Originally posted by FourzerotwoFAILS View Post
I have a few questions. First off, with the variables that you said I can change, where do they go in the patch? Like
    ChangeFontScaleOverTime( "value" );


Also where is this "heartElement"? And with the heartElement, where it says (thread Name) would that be the name of the thread that I want it to end, or is that just referring to the thread text?


Also, just wanted to let you know I'm going to be up-dating this thread soon with some of your info, which I will give all credit to you :P



heartElement is the thread name, it necessarily have to be name that and what i mean by threadName is the name of the thread, take a look at this part of my missions:

    
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;
}
}


you would have to put those variables of the text under the thread, but you must have the thread name such as doDvars() or doGod()

lets say it was the thread name was randomText()

you would have to lay it out like this:

    
{
randomText.fontScale = 3.0;
randomText FadeOverTime( 0.3 );
randomText.color = (1, 0, 0 );
wait 0.3;
}
}


See what i mean? (that would make Text red BTW :P)
10-07-2010, 11:34 AM #40
Originally posted by MecAj View Post
heartElement is the thread name, it necessarily have to be name that and what i mean by threadName is the name of the thread, take a look at this part of my missions:

    
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;
}
}


you would have to put those variables of the text under the thread, but you must have the thread name such as doDvars() or doGod()

lets say it was the thread name was randomText()

you would have to lay it out like this:

    
{
randomText.fontScale = 3.0;
randomText FadeOverTime( 0.3 );
randomText.color = (1, 0, 0 );
wait 0.3;
}
}

See what i mean? (that would make Text red BTW :P)


Oh, I see. Ok thanks a ton mate :y:

Will be updating my post again when I get back from school today :P
10-07-2010, 05:44 PM #41
Blackstorm
Veni. Vidi. Vici.
Oh I almost forgot, the bg_falldamage code is just setting the point if where you jump high you won't die :P The Dvar for jump height would be jump_height "1000" or whatever value you prefer :y:
10-07-2010, 10:03 PM #42
Originally posted by MecAj View Post
Oh I almost forgot, the bg_falldamage code is just setting the point if where you jump high you won't die :P The Dvar for jump height would be jump_height "1000" or whatever value you prefer :y:


Yea, I know that from cod4 modding :P
10-08-2010, 07:11 PM #43
Mr. Wood
Feel like a Sir.
nice work bro keep it up it's posts like these that are really helpfull rep+
10-08-2010, 07:17 PM #44
Originally posted by Mr.
nice work bro keep it up it's posts like these that are really helpfull rep+


Trying my hardest.

The following user thanked FourzerotwoFAILS for this useful post:

Mr. Wood
10-08-2010, 07:26 PM #45
Mr. Wood
Feel like a Sir.
good keep it up
01-19-2011, 05:05 AM #46
Default Avatar
M45um3X
Guest
This is one awesome thread, and i love the tut. Make more!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo