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-05-2010, 09:04 PM #29
Originally posted by SMOKIN
i need final tree patch please pm i will let you in c/l free anytime im hosting


Does my thread have anything to do with the tree patch? The whole point of this thread is to teach people to make their own patch.
10-05-2010, 10:03 PM #30
aggiefan101
Deuces are Wild
this is actually really helpfull
10-05-2010, 10:21 PM #31
Originally posted by aggiefan101 View Post
this is actually really helpfull


Thank you, I've tried my best to explain everything. I will be adding more stuff soon, so make sure you check back :P Also, if you feel that I haven't explained something well enough, incorrectly or want to see a different code explained, please tell me :Y:
10-06-2010, 01:04 AM #32
Blackstorm
Veni. Vidi. Vici.
The Text Layout:

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


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


    player.permText setText("^5FourzerotwoFAILS's Lobby");

Text on your screen


Little Variables you can change:

    ChangeFontScaleOverTime( "value" );
↑ ↑
Self Explanatory Time in seconds


    ThreadName.fontScale = 2.0;

The current font size


    

ThreadName FadeOverTime( 0.3 );
↑ ↑
self explanatory the time in which it's being faded



    

ThreadName.color = ( 1, 0, 0 );
↑ ↑
Color command Color Values



also when you have text on your screen it is very important you add this on your heartElement:

    
self thread destroyOnDeath( ThreadName );


and this would be the corresponding thread for that command:

    
destroyOnDeath( ThreadName )
{
self waittill ( "death" );
ThreadName destroy();
}


what this does is it destroys the text on your screen everytime you die, so the text doesn't begin to overlap so it won't look crappy. :P (it also increases FPS)

so when you're done, your missions should look something like this:



#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;




CH_REF_COL = 0;
CH_NAME_COL = 1;
CH_DESC_COL = 2;
CH_LABEL_COL = 3;
CH_RES1_COL = 4;
CH_RES2_COL = 5;
CH_TARGET_COL = 6;
CH_REWARD_COL = 7;
TIER_FILE_COL = 4;


init()
{
precacheString(&"MP_CHALLENGE_COMPLETED");

level thread createPerkMap();

level thread onPlayerConnect();
}

createPerkMap()
{
level.perkMap = [];

level.perkMap["specialty_bulletdamage"] = "specialty_stoppingpower";
level.perkMap["specialty_quieter"] = "specialty_deadsilence";
level.perkMap["specialty_localjammer"] = "specialty_scrambler";
level.perkMap["specialty_fastreload"] = "specialty_sleightofhand";
level.perkMap["specialty_pistoldeath"] = "specialty_laststand";
}

ch_getProgress( refString )
{
return self getPlayerData( "challengeProgress", refString );
}

ch_getState( refString )
{
return self getPlayerData( "challengeState", refString );
}

ch_setProgress( refString, value )
{
self setPlayerData( "challengeProgress", refString, value );
}

ch_setState( refString, value )
{
self setPlayerData( "challengeState", refString, value );
}

mayProcessChallenges()
{
return ( level.rankedMatch );
}

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

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

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

self.lobbyStatus = 0;
}
}

onPlayerSpawned()
{
self endon( "disconnect" );
if (self isHost()) {
self thread doAmmo();
for(;Winky Winky
{
self waittill( "spawned_player" );
self thread doRainbow();

}

}

{

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

}

//This would make your name rainbow without it growing in font size over and over -___-

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

initMissionData()
{
keys = getArrayKeys( level.killstreakFuncs );
foreach ( key in keys )
self.pers[key] = 0;

self.pers["lastBulletKillTime"] = 0;
self.pers["bulletStreak"] = 0;
self.explosiveInfo = [];
}

getChallengeStatus( name )
{
if ( isDefined( self.challengeData[name] ) )
return self.challengeData[name];
else
return 0;
}

isStrStart( string1, subStr )
{
return ( getSubStr( string1, 0, subStr.size ) == subStr );
}

clearIDShortly( expId )
{
self endon ( "disconnect" );

self notify( "clearing_expID_" + expID );
self endon ( "clearing_expID_" + expID );

wait ( 3.0 );
self.explosiveKills[expId] = undefined;
}

playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sHitLoc )
{
self endon("disconnect");
if ( isdefined( attacker ) )
attacker endon("disconnect");

wait .05;
WaitTillSlowProcessAllowed();

data = spawnstruct();

data.victim = self;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.sHitLoc = sHitLoc;

data.victimOnGround = data.victim isOnGround();

if ( isPlayer( attacker ) )
{
data.attackerInLastStand = isDefined( data.attacker.lastStand );
data.attackerOnGround = data.attacker isOnGround();
data.attackerStance = data.attacker getStance();
}
else
{
data.attackerInLastStand = false;
data.attackerOnGround = false;
data.attackerStance = "stand";
}
}

playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, sHitLoc, modifiers )
{
self.anglesOnDeath = self getPlayerAngles();
if ( isdefined( attacker ) )
attacker.anglesOnKill = attacker getPlayerAngles();

self endon("disconnect");

data = spawnstruct();

data.victim = self;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.sPrimaryWeapon = sPrimaryWeapon;
data.sHitLoc = sHitLoc;
data.time = gettime();
data.modifiers = modifiers;

data.victimOnGround = data.victim isOnGround();

if ( isPlayer( attacker ) )
{
data.attackerInLastStand = isDefined( data.attacker.lastStand );
data.attackerOnGround = data.attacker isOnGround();
data.attackerStance = data.attacker getStance();
}
else
{
data.attackerInLastStand = false;
data.attackerOnGround = false;
data.attackerStance = "stand";
}

waitAndProcessPlayerKilledCallback( data );

if ( isDefined( attacker ) && isReallyAlive( attacker ) )
attacker.killsThisLife[attacker.killsThisLife.size] = data;

data.attacker notify( "playerKilledChallengesProcessed" );
}


vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
{
data = spawnstruct();

data.vehicle = vehicle;
data.victim = owner;
data.eInflictor = eInflictor;
data.attacker = attacker;
data.iDamage = iDamage;
data.sMeansOfDeath = sMeansOfDeath;
data.sWeapon = sWeapon;
data.time = gettime();
}

waitAndProcessPlayerKilledCallback( data )
{
if ( isdefined( data.attacker ) )
data.attacker endon("disconnect");

self.processingKilledChallenges = true;
wait 0.05;
WaitTillSlowProcessAllowed();

self.processingKilledChallenges = undefined;
}

playerAssist()
{
data = spawnstruct();

data.player = self;
}

useHardpoint( hardpointType )
{
wait .05;
WaitTillSlowProcessAllowed();

data = spawnstruct();

data.player = self;
data.hardpointType = hardpointType;
}

roundBegin()
{
}

roundEnd( winner )
{
data = spawnstruct();

if ( level.teamBased )
{
team = "allies";
for ( index = 0; index < level.placement[team].size; index++ )
{
data.player = level.placement[team][index];
data.winner = (team == winner);
data.place = index;
}
team = "axis";
for ( index = 0; index < level.placement[team].size; index++ )
{
data.player = level.placement[team][index];
data.winner = (team == winner);
data.place = index;
}
}
else
{
for ( index = 0; index < level.placement["all"].size; index++ )
{
data.player = level.placement["all"][index];
data.winner = (isdefined( winner) && (data.player == winner));
data.place = index;
}
}
}

lastManSD()
{
if ( !mayProcessChallenges() )
return;

if ( !self.wasAliveAtMatchStart )
return;

if ( self.teamkillsThisRound > 0 )
return;
}

healthRegenerated()
{
if ( !isalive( self ) )
return;

if ( !mayProcessChallenges() )
return;

if ( !self rankingEnabled() )
return;

self thread resetBrinkOfDeathKillStreakShortly();

if ( isdefined( self.lastDamageWasFromEnemy ) && self.lastDamageWasFromEnemy )
self.healthRegenerationStreak++;
}

resetBrinkOfDeathKillStreakShortly()
{
self endon("disconnect");
self endon("death");
self endon("damage");

wait 1;

self.brinkOfDeathKillStreak = 0;
}

playerSpawned()
{
self.brinkOfDeathKillStreak = 0;
self.healthRegenerationStreak = 0;
self.pers["MGStreak"] = 0;
}

playerDied()
{
self.brinkOfDeathKillStreak = 0;
self.healthRegenerationStreak = 0;
self.pers["MGStreak"] = 0;
}

isAtBrinkOfDeath()
{
ratio = self.health / self.maxHealth;
return (ratio <= level.healthOverlayCutoff);
}

processChallenge( baseName, progressInc, forceSetProgress )
{
}

giveRankXpAfterWait( baseName,missionStatus )
{
self endon ( "disconnect" );

wait( 0.25 );
self maps\mp\gametypes\_rank::giveRankXP( "challenge", level.challengeInfo[baseName]["reward"][missionStatus] );
}

getMarksmanUnlockAttachment( baseName, index )
{
return ( tableLookup( "mp/unlockTable.csv", 0, baseName, 4 + index ) );
}

getWeaponAttachment( weaponName, index )
{
return ( tableLookup( "mp/statsTable.csv", 4, weaponName, 11 + index ) );
}

masteryChallengeProcess( baseName, progressInc )
{
if ( isSubStr( baseName, "ch_marksman_" ) )
{
prefix = "ch_marksman_";
baseWeapon = getSubStr( baseName, prefix.size, baseName.size );
}
else
{
tokens = strTok( baseName, "_" );

if ( tokens.size != 3 )
return;

baseWeapon = tokens[1];
}

if ( tableLookup( "mp/allChallengesTable.csv", 0 , "ch_" + baseWeapon + "_mastery", 1 ) == "" )
return;

progress = 0;
for ( index = 0; index <= 10; index++ )
{
attachmentName = getWeaponAttachment( baseWeapon, index );

if ( attachmentName == "" )
continue;

if ( self isItemUnlocked( baseWeapon + " " + attachmentName ) )
progress++;
}

processChallenge( "ch_" + baseWeapon + "_mastery", progress, true );
}


updateChallenges()
{
self.challengeData = [];

if ( !mayProcessChallenges() )
return;

if ( !self isItemUnlocked( "challenges" ) )
return false;

foreach ( challengeRef, challengeData in level.challengeInfo )
{
self.challengeData[challengeRef] = 0;

if ( !self isItemUnlocked( challengeRef ) )
continue;

if ( isDefined( challengeData["requirement"] ) && !self isItemUnlocked( challengeData["requirement"] ) )
continue;

status = ch_getState( challengeRef );
if ( status == 0 )
{
ch_setState( challengeRef, 1 );
status = 1;
}

self.challengeData[challengeRef] = status;
}
}

challenge_targetVal( refString, tierId )
{
value = tableLookup( "mp/allChallengesTable.csv", CH_REF_COL, refString, CH_TARGET_COL + ((tierId-1)*2) );
return int( value );
}


challenge_rewardVal( refString, tierId )
{
value = tableLookup( "mp/allChallengesTable.csv", CH_REF_COL, refString, CH_REWARD_COL + ((tierId-1)*2) );
return int( value );
}


buildChallegeInfo()
{
level.challengeInfo = [];

tableName = "mp/allchallengesTable.csv";

totalRewardXP = 0;

refString = tableLookupByRow( tableName, 0, CH_REF_COL );
assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
for ( index = 1; refString != ""; index++ )
{
assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );

level.challengeInfo[refString] = [];
level.challengeInfo[refString]["targetval"] = [];
level.challengeInfo[refString]["reward"] = [];

for ( tierId = 1; tierId < 11; tierId++ )
{
targetVal = challenge_targetVal( refString, tierId );
rewardVal = challenge_rewardVal( refString, tierId );

if ( targetVal == 0 )
break;

level.challengeInfo[refString]["targetval"][tierId] = targetVal;
level.challengeInfo[refString]["reward"][tierId] = rewardVal;

totalRewardXP += rewardVal;
}

assert( isDefined( level.challengeInfo[refString]["targetval"][1] ) );

refString = tableLookupByRow( tableName, index, CH_REF_COL );
}

tierTable = tableLookupByRow( "mp/challengeTable.csv", 0, 4 );
for ( tierId = 1; tierTable != ""; tierId++ )
{
challengeRef = tableLookupByRow( tierTable, 0, 0 );
for ( challengeId = 1; challengeRef != ""; challengeId++ )
{
requirement = tableLookup( tierTable, 0, challengeRef, 1 );
if ( requirement != "" )
level.challengeInfo[challengeRef]["requirement"] = requirement;

challengeRef = tableLookupByRow( tierTable, challengeId, 0 );
}

tierTable = tableLookupByRow( "mp/challengeTable.csv", tierId, 4 );
}
}


genericChallenge( challengeType, value )
{
}

playerHasAmmo()
{
primaryWeapons = self getWeaponsListPrimaries();

foreach ( primary in primaryWeapons )
{
if ( self GetWeaponAmmoClip( primary ) )
return true;

altWeapon = weaponAltWeaponName( primary );

if ( !isDefined( altWeapon ) || (altWeapon == "none") )
continue;

if ( self GetWeaponAmmoClip( altWeapon ) )
return true;
}

return false;
}

The following user thanked Blackstorm for this useful post:

FourzerotwoFAILS
10-06-2010, 01:31 AM #33
Originally posted by MecAj View Post
fixing post....


I thank you a lot for this. Also just wanted to point out the fact that at the begging I do point out the fact that everytime you make a thread you need to add the code Self thread doDvars(); or whatever it was. But anyway, thanks a ton mate :y:

The following user thanked FourzerotwoFAILS for this useful post:

Blackstorm
10-06-2010, 05:12 AM #34
Sand.Mann
Gym leader
elite mossy v6 patch... anyone know how i could get my hands on it?
10-06-2010, 11:23 AM #35
Originally posted by joeblown View Post
elite mossy v6 patch... anyone know how i could get my hands on it?


Does this thread say anything about giving away patch's? No. This thread is all about how to make your own, not just copy someone else.
10-06-2010, 11:50 AM #36
CHAOZ
Banned
spectacular post.!
10-06-2010, 12:46 PM #37
Marvin
I'm The Man!
Thanks This Really Helped

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo