• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help First Modding Attempts
In Java and all other OOP languages, you have to declare the data type of every variable. In GSC Scripting, you don't declare the data type since it automatically selects it for you if you haven't noticed already. Also, with variables if you want to declare it using a global scope you cant just put it floating outside the functions. You'd have to use something like: self.thisValue, player.thisValue, level.thisValue depending on who you want to globally assign the variable to. Notice the entity.variableName format when declaring global variables.

Declaring arrays in GSC Scripting is different aswell. In C++ if you wanted to create a dynamic array you'd have to use a vector but in GSC Scripting it's dead easy. Multi-dimensional arrays are also supported.

//C++ Version
int SomeArray[] = {15, 73, 45, 29};

//Java Version
int[] SomeArray = {15, 73, 45, 29};

//GSC Version
/* Dynamic version */
SomeArray = [];
SomeArray[SomeArray.size] = 15;
SomeArray[SomeArray.size] = 73;
SomeArray[SomeArray.size] = 45;
SomeArray[SomeArray.size] = 29;
/* Standard version */
SomeArray = [];
SomeArray[0] = 15;
SomeArray[1] = 73;
SomeArray[2] = 45;
SomeArray[3] = 29;

//Multi-dimensional GSC Array
SomeArray = [];
SomeArray["something"] = [];
SomeArray["something"][0] = "SomeStringValue";

It may seem more tedious declaring arrays in GSC Scripting but it's really handy. Resizing arrays is just the matter of pushing an object to the end of an array using arrayName.size as the index. You can even use strings as the array index!

The thread command (like CreateThread in C++) runs a function asynchronously/using multithreading without having to wait for the function to return a value or finish doing what is needs to do.

There are also a whole bunch of built in functions that vary in every COD game there is. There is a comprehensive function list here for COD4 but many of them work in Black Ops. The site provides details about what each function does, returns and all the arguments required for it to work.

You also may of noticed that some strings have an ampersand before the string like in: precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
What it basically does is get the localized string tied to that value which depends on what language the game is set to.
Example: If my game language was set to English then "RANK_PLAYER_WAS_PROMOTED_N" might mean "Player has been promoted to " but if my game language was set to German it might say "Player wurde gefördert, um " (Google Translate Smile) instead.

I hope you learnt something from this, good luck coding mods! If you have any questions just ask.
~ master131
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.
[-] The following 1 user says Thank You to master131 for this post:
  • OneThatWalks
not all OOP.

I thought I wrote most... :/ Oh well I probably didn't read over that part. Smile Thanks for the correction SuperNovaAO!
[Image: 30xhrep.png]

A casual conversation between barata and I about Nukem.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Request] Request for Assistance with Modding COD: BO using Mod Tools one1lion 9 1,972 09-17-2013, 21:04
Last Post: one1lion
  Help Modding Zombie Mode DarthKiller 3 1,579 07-09-2013, 21:08
Last Post: Nekochan
  Why there are no modding for Frostbite Engine RaZ 2 1,261 03-30-2013, 17:14
Last Post: Pozzuh
  Modding online custom classes? jarniboi 0 1,048 03-12-2013, 00:21
Last Post: jarniboi
  [Tutorial] Modding Terraria Pozzuh 5 7,520 01-12-2013, 22:27
Last Post: Xeramon
  How or why did you start modding COD games? Bloodfocus 12 2,499 12-25-2012, 13:08
Last Post: alvarogt95
Thumbs Down Help help Modding new fingerweak 1 654 10-11-2012, 23:18
Last Post: Rendflex
  Bo modding help needed SamuelGrund 6 1,437 08-30-2012, 15:39
Last Post: SamuelGrund
  Modding tools for BF3 are a scary business Pozzuh 12 3,345 08-18-2012, 15:35
Last Post: Arteq
  Not sure if glitch or modding :S Arteq 5 1,309 08-11-2012, 13:08
Last Post: Metro-Police#45

Forum Jump:

Users browsing this thread: 1 Guest(s)