You are viewing our Forum Archives. To view or take place in current topics click here.

Should this be sticky?

Yes
0.00% (0 votes)
No
0.00% (0 votes)

Total Votes: 0

COD: Scripting & Binding Tutorial (Tutorial for all CoD's)!
Posted:

COD: Scripting & Binding Tutorial (Tutorial for all CoD's)!Posted:

Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
| ||| | Fails Script & Binds Tutorial | ||| |

IF you have any question's, PM ME.








Subjects mentioned in this thread are:

  • Making a .cfg
  • Learning Colors
  • Binding Basics
  • Names
  • VSTR's (Smaller Scripts)
  • Name Scripts
  • Commands






Learning Colors:


Colors are the most easiest thing to learn about.. Which can be very useful to the developers and programmers that make the game. Lets take an example of what to know..

Example:

Adding Colors


To add a color you need to put

^ColorNumberHere - [Shift+6=^]


So for example if you wanted a Red name you would put, ^1YourNameHere.

^1 = Red
^2 = Green
^3 = Yellow
^4 = Blue
^5 = Turquoise
^6 = Pink
^7 = White
^8 = Purple
^9 = Grey
^0 = Black





DevKit/ Jtag Functions:


say "Insert text here" \\Uses the developer console to display text, only possible for multiplayer
toggle "dvar here" \\Toggles values for dvars, must be used with binds, remove the quotes
setviewpos x y z \\Adjust the x y and z values to force player models into a position ( Semi Teleport ) 
exec "insert here" \\Executes a function/cfg
statwriteddl playerstatslist "stat type" "value" \\Used to automatically set stats remove the quotes
updategamerprofile \\Updates profile with recent statistics
uploadstats \\Uploads stat changes server side
wait "time ammount here" \\Game will wait a certain duration before execution of the next function remove the quotes
statsetbyname \\Used to set your online statistics
give "Weapon name" \\Gives the weapon depending on the mode and gametype ( List further down ) remove the quotes
set/seta "Function Value" \\Used to set as constant
vstr "letter here" \\Used to create a static function, remove the quotes

unbind "Insert button here" \\Unbinds the designated button remove the quotes
bind "Insert button here" \\Binds the designated button remove the quotes



Leaderboards:

DoStats()
{
self maps\mp\gametypes\_persistence::statSet( "plevel", prestige, false );
self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
self maps\mp\gametypes\_persistence::statSet( "time_played_total", seconds, false );
self maps\mp\gametypes\_persistence::statSet( "kills", kills, false );
self maps\mp\gametypes\_persistence::statSet( "deaths", deaths, false );
self maps\mp\gametypes\_persistence::statSet( "headshots", headshots, false );
self maps\mp\gametypes\_persistence::statSet( "hits", bullet hit, false);
self maps\mp\gametypes\_persistence::statSet( "badhostcount", bad host counter, false);
self maps\mp\gametypes\_persistence::statSet( "misses", bullet miss, false);
self maps\mp\gametypes\_persistence::statSet( "total_shots", bullet counter, false);
self maps\mp\gametypes\_persistence::statSet( "accuracy", accuracy or KD, false);
}


Score Each Kill

registerScoreInfo()
{
   maps\mp\gametypes\_rank::registerScoreInfo( "kill", 100 );
   maps\mp\gametypes\_rank::registerScoreInfo( "headshot", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "assist_75", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "assist_50", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "assist_25", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "assist", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "dogkill", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "dogassist", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "helicopterkill", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "helicopterassist", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "helicopterassist_75", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "helicopterassist_50", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "helicopterassist_25", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "spyplanekill", 0 );
   maps\mp\gametypes\_rank::registerScoreInfo( "spyplaneassist", 0 );
}

Unlimited Ammo

CookiesandTricks()
{
   self endon ( "death" );
   self endon ( "disconnect" );
   
   for ( ;; )
   {
      clipAmmo = 999;
      stockAmmo = 999;
      weapon = self GetCurrentWeapon();
       
      self SetWeaponAmmoClip( weapon, clipAmmo );
      self SetWeaponAmmoStock( weapon, stockAmmo );
   }
}

Forge (Halo Replica)

pickup()
{
   self endon("death");
   for(;;)
   {
      while(self fragbuttonpressed())
      {
         trace = bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*1000000,true,self);
         while(self fragbuttonpressed())
         {
            trace["entity"] setorigin(self gettagorigin("j_head")+anglestoforward(self getplayerangles())*200);
            trace["entity"].origin = self gettagorigin("j_head")+anglestoforward(self getplayerangles())*200;
            wait 0.05;
         }
      }

Kamikaze Bomber


NukePlane()
{
self endon ("disconnect");
nuke = spawnStruct();
nuke.fx = loadfx( "maps/mp_maps/fx_mp_nuked_nuclear_explosion" );
for(;;)
{
if(self meleebuttonpressed())
{
napalmSelectorSize = getDvarIntDefault( #"scr_napalmSelectorSize", 3000 );
self beginLocationNapalmSelection( "map_napalm_selector", napalmSelectorSize, "killstreak_napalm" );
self.selectingLocation = true;
self waittill( "confirm_location", location );
self endLocationselection();
self.selectingLocation = false;
nuke.planemodel = spawn("script_model", self.origin + ( 24000, 15000, 25000 ) );
nuke.planemodel setModel( "t5_veh_air_b52" );
nuke.planemodel.angles = vectorToAngles( Location - ( self.origin + ( 8000, 5000, 10000 ) ) );
nuke.planemodel moveto( location + ( 0, 0, 200 ), 2.9 );
wait 2.8;
nuke.dropmodel = spawn("script_model", nuke.planemodel.origin );
nuke.dropmodel setModel( "mp_supplydrop_axis" );
nuke.dropmodel.angles = vectorToAngles( location - ( self.origin + ( 8000, 5000, 10000 ) ) );
nuke.planemodel delete();
PlaySoundAtPosition( "amb_end_nuke", location );
nuke.dropmodel moveto( location, .9 );
wait 1.2;
Earthquake( 0.4, 4, location, 800 );
playfx( nuke.fx, nuke.dropmodel.origin );
wait .05;
nuke.dropmodel delete();
radiusdamage( location, 999999999, 3000, 900, self );
}
wait .05;
}
}

Give, Take, Spawn Weapon.

self giveWeapon( "WEAPON NAME" );
 
self switchToWeapon( WEAPON NAME );
 
self setSpawnWeapon( WEAPON NAME );

Walking AC-130

walkingAc130Tgl()
{
        self endon( "death" );
        self endon( "disconnect" );
        self.inAc130 = 0;
        for(;;)
        {
                self waittill( "Left" );
                if(self.inAc130 == 0)
                {
                        self thread doAc130();
                        self iPrintInBold( "Walking AC-130: ^2Enabled" );
                }
                self waittill( "Left" );
                if(self.inAc130 == 1)
                {
                        self.inAc130 = 0;
                        self thread destroyCrossHairs();
                        self thread destroyNukeGun();
                        self notify( "endAc130" );
                        self iPrintlnBold( "Walking AC-130: ^1Disabled" );
                }
        }
}

doAc130()
{
        self endon( "death" );
        self endon( "disconnect" );
        self endon( "endAc130" );
        self.disabledWeapon = 1;
        self Hide();
        self thread doCrossHairs();
        self thread nukeGun();
        self thread maxAmmo();
}

doCrossHairs()
{
        self endon( "death" );
        self endon( "disconnect" );
        self endon( "endAc130" );
        crosshair1 = createFontString("objective", 5.0);
        crosshair1 setPoint("CENTER","CENTER",0,0.1);
        crosshair2 = createFontString("objective", 5.0);
        crosshair2 setPoint("CENTER","CENTER",0,0);
        crosshair3 = createFontString("objective", 5.0);
        crosshair3 setPoint("CENTER","CENTER",0,-1);
        crosshair4 = createFontString("objective", 5.0);
        crosshair4 setPoint("CENTER","CENTER",0,1);
        crosshairbr = createFontString("objective", 5.0 );
        crosshairbr setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT",0, 0);
        crosshairbl = createFontString("objective", 5.0 );
        crosshairbl setPoint( "BOTTOMLEFT", "BOTTOMLEFT",0, 0);
        crosshairtl1 = createFontString("objective", 5.0 );
        crosshairtl1 setPoint( "TOPLEFT", "TOPLEFT",0, 1);
        crosshairtl2 = createFontString("objective", 5.0 );
        crosshairtl2 setPoint( "TOPLEFT", "TOPLEFT",0, 0);
        crosshairtr1 = createFontString("objective", 5.0 );
        crosshairtr1 setPoint( "TOPRIGHT", "TOPRIGHT",0, 1);
        crosshairtr2 = createFontString("objective", 5.0 );
        crosshairtr2 setPoint( "TOPRIGHT", "TOPRIGHT",0, 0);
        for(;;)
        {
                crosshair4 setText("     _____     ");
                crosshair1 setText("____       ____");
                crosshair2 setText("    |  :]  |    ");
                crosshair3 setText("     _____     ");
                crosshairbr setText("_|");
                crosshairbl setText("|_");
                crosshairtl1 setText(" _");
                crosshairtl2 setText("|");
                crosshairtr1 setText("_");
                crosshairtr2 setText(" |");
        }
}

nukeGun()
{
        self endon("disconnect");
        self endon("death");
        self endon("endAc130");
        self endon("ngoff");
        for(;;)
        {
                self waittill("weapon_fired");
                trace=bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*100000,1,self)["position"];
                nuke=loadfx("maps/mp_maps/fx_mp_nuked_nuclear_explosion");
                playfx(nuke,trace);
                self playsound("amb_end_nuke");
                radiusdamage(trace,1000,2000,900,self);
        }
}

destroyNukeGun()
{
        self notify ( "ngoff" );
}
               
destroyCrossHairs()
{
        for(;;)
        {
                self waittill_any( "death", "disconnect", "endAc130" );
                crosshair4 destroy();
                crosshair1 destroy();
                crosshair2 destroy();
                crosshair3 destroy();
                crosshairbr destroy();
                crosshairbl destroy();
                crosshairtl1 destroy();
                crosshairtl2 destroy();
                crosshairtr1 destroy();
                crosshairtr2 destroy();
        }
}

maxAmmo()
{
        self setClientDvar( "player_sustainAmmo", "1" );
}

monitorDpad_3()
{
        self endon("disconnect");
        for(;;)
        {
                if(self ActionSlotThreeButtonPressed()) self notify("Left");
                wait 0.0001;
        }
}



This works for all. GPDS, Developer Kits, Jtags, Flashed Xbox's.





Binding Basics:


How you make a bind in game is rather simple! Just follow these instructions.
Open up your patch/gpd -
Type .bind
Now hit space, and type which button you would like to bind ( DPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT, etc.)
Now add what command you wish to have, We will have the bind say something. What we would use for a say command is:

set bind YOURBUTTONBIND "say YOURTEXTHERE"


I want to use DPAD UP so I use:

set bind DPAD_UP "say ^1The ^2Tech ^3Game"


There you go, now you have completed your first ever bind!




Names:


Modding your name is simple! When modding your name via Hex Editor where they don't have button's to click you would put:

^"YOURCOLORNUMBER"Fails

After: ^1Fails
Final: Fails





Making a CFG:


Here's how to make a .CFG (A script file)
Open notepad
Type all your stuff in it.
File&Save As>ALL FILES
For the name, type in a name and make sure to have .cfg at the end. (I.E. name.cfg crouch.cfg etc)


Example:

The example is from the PC version so just bare with me, As the examples are alike each other.

set drawLagometer "1" 
set com_maxfps "125"
set cl_maxpackets "100"
set snaps "30"


As you see the .cfg I'm using is to draw fps.

This example bellow show's the main/default configs set. "config_mp.cfg"

seta ai_corpseCount "0"
seta cg_blood "0"
seta cg_brass "0"
seta cg_hudDamageIconInScope "1"
seta cg_hudGrenadeIconEnabledFlash "1"
seta cl_maxpackets "63"
seta com_maxfps "125"
seta fx_marks "0"
seta fx_marks_ents "0"
seta fx_marks_smodels "0"
seta r_aaAlpha "off"
seta r_altModelLightingUpdate "1"
seta r_dlightLimit "0"
seta r_drawSun "0"
seta r_drawWater "0"
seta r_fastSkin "1"
seta r_glow_allowed "0"
seta r_multiGpu "1"
seta r_texFilterAnisoMax "1"
seta sm_maxLights "0"
seta r_zFeather "0"
set snaps "30"








Name Scripts:


Have you ever been online with COD: W@W & Seen anyone with flashing name's/clantags? This is exactly how it was done..
Make a new .cfg file, named flashingname.cfg and open it.
Now look at this example.

I'm sure, this only works with ISO Mods/Jtags.

name "^1Fails"
wait 5.5
name "^2Fails"
wait 5.5
name "^3Fails"
wait 5.5
name "^4Fails"
wait 5.5
name "^5Fails"
wait 5.5
name "^6Fails"
wait 5.5
name "^7Fails"
wait 5.5
name "^8Fails"


Make something similar to this, in your file.
(When opening/creating your own flashingname.cfg make sure the wait timing is between 5-20 seconds for the best. Anything under/above will cause scripted/cfg errors.)
Make sure the name your using will be the current name the script is being ran on.
Save the file.
After saving a file, Extract the .cfg file to the bind you want it at.






VSTR's (Mini Scripts):


What a VSTR is, technically is a What a VSTR is, technically is a exec'ing a command, in a script. They are very useful if you understand them. Here are some examples.

Lets say I do:

 set BO1 DPAD_DOWN "say ^1Welcome ^3to ^2our ^515th ^6Lobby!; scr_xpscale 256000; wait 7; say Hell Yea, Level ^150!"


So, BO1 is now set to everytime someone clicks dpad up it will say "Welcome to our 15th Lobby!, Set XP to 256000, wait 7 seconds, Say Hell yea, Level 50!"






[ Register or Signin to view external links. ] [ Register or Signin to view external links. ] [ Register or Signin to view external links. ]


Last edited by cigg ; edited 7 times in total

The following 4 users thanked cigg for this useful post:

dajuggernaut96 (06-07-2011), br0k3n731 (06-05-2011), einhander (06-03-2011), MrZombeez (02-16-2011)
#2. Posted:
TTG_iMatrix
  • TTG Natural
Status: Offline
Joined: Dec 31, 201013Year Member
Posts: 942
Reputation Power: 50
Status: Offline
Joined: Dec 31, 201013Year Member
Posts: 942
Reputation Power: 50
nice post should start to edit
#3. Posted:
TTGProudGlitcher
  • Ladder Climber
Status: Offline
Joined: Nov 30, 201013Year Member
Posts: 311
Reputation Power: 12
Status: Offline
Joined: Nov 30, 201013Year Member
Posts: 311
Reputation Power: 12
nicepost!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#4. Posted:
M0D1F13D
  • TTG Senior
Status: Offline
Joined: Sep 06, 201013Year Member
Posts: 1,069
Reputation Power: 47
Status: Offline
Joined: Sep 06, 201013Year Member
Posts: 1,069
Reputation Power: 47
Nice post, but the title is kind of misleading, It makes you expect to see gsc scripting stuff. And then its all cfg stuff.
#5. Posted:
TTG-CHUCKY
  • New Member
Status: Offline
Joined: Feb 11, 201113Year Member
Posts: 22
Reputation Power: 0
Status: Offline
Joined: Feb 11, 201113Year Member
Posts: 22
Reputation Power: 0
this should be a sticky

keep up the good work

TTG CHUCKY
#6. Posted:
zurree
  • Challenger
Status: Offline
Joined: Sep 04, 201013Year Member
Posts: 111
Reputation Power: 4
Status: Offline
Joined: Sep 04, 201013Year Member
Posts: 111
Reputation Power: 4
Wow...very nice post
#7. Posted:
Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
Thanks a-lot for everyone's comments!
I appreciate the positive replies!
I will be updating this very soon
#8. Posted:
Carlooch
  • TTG Addict
Status: Offline
Joined: Oct 08, 201013Year Member
Posts: 2,310
Reputation Power: 10427
Status: Offline
Joined: Oct 08, 201013Year Member
Posts: 2,310
Reputation Power: 10427
NICE POST FAILS, GOOD ISH
#9. Posted:
Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
Status: Offline
Joined: Sep 01, 201013Year Member
Posts: 1,121
Reputation Power: 60
TTG_Carlooch9 wrote NICE POST FAILS, GOOD ISH


Thanks alot broski!
I just updated it too not that long ago.
Someone was talking about the .cfg section, so I added more details.
#10. Posted:
Portland
  • TTG Addict
Status: Offline
Joined: Aug 12, 201013Year Member
Posts: 2,671
Reputation Power: 280
Status: Offline
Joined: Aug 12, 201013Year Member
Posts: 2,671
Reputation Power: 280
Nice post, quite informative.
Good job, probably took a little bit of time to organize it to look good!


Last edited by Portland ; edited 1 time in total
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.