Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help First Modding Attempts
#11
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.

Code:
//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;
//OR
/* 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 gefrdert, 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.
Reply

#12
not all OOP.

http://www.scala-lang.org
Reply

#13
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.
Reply



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

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.