Request for Assistance with Modding COD: BO using Mod Tools

Black Ops forum

Good day all,

I have recently been asked to look into modding for Black Ops multiplayer.  I am a C/C++, VB, .NET, and Java programmer who has little experience with game and graphics design/development.  I have taken classes in those topics, but my primary focus is on developing automated enterprise solutions.

Long story short, I spent the last few weeks reading sample mods, running tutorials that taught me some of the ins and outs of scripting.  Unfortunately, I didn't find any fully comprehensive tutorials that answered my more specific questions.  Nor one that taught me to create a fully functional mod that does the things that I want.  I would like to post the some questions, but also a culmination of the things that I have learned.

Other Preliminary Info:

I have purchased a copy of Call Of Duty: Black Ops for PC and downloaded Mod Tools as well.  I use Visual Studios 2k12 for script editing.  I setup a project with links to the files in <cod root>\raw and links to the files in <cod root>\mods.  I have the source for a fully functional mod that I’ve been using as reference.

What I’ve learned (In no particular order…or maybe somewhat organized):

-        To start a mod, create a folder in <cod root>\mods\mp_{mod name}

-        At this point, you can see the mod in mod tools (which, of course, on the first run I ran the converter), and you can click on Build (with options Link FastFile and Build IWD…which is just a compressed folder with all of the contents of the mod selected while building)

-        After building the mod, it is selectable from the MODS menu item in game

-        It uses everything from <cod root>\raw by default, so if you add stuff to your mod_root folder that mirror things in raw, it will read from your mod directory first, then use raw.  This occurs with import statements and function calls in script as well

-        Common tutorial was to create subdirectories to

o   maps

o   maps\mp

o   maps\mp\gametypes

-        Copy rank.gsc and modify the onPlayerSpawned function to do something like display text, or modify a gun, or give a gun or perk

-        The code files (script files) are extension “.gsc”.  They can be edited in a text editor

-        The code looks a lot like C/C++ and acts somewhat like javascript or vbscript

-        I read somewhere that COD uses QuakeC (which, again, I have not used)

-        Variables can just be created by assigned a value to a non-reserved word and are not declared with a type (e.g. instead of int a = 1;, you would just type a = 1Smiley Wink

-        What I would call “Global” variables (user-defined variables accessible from anywhere in the code) are actually created using the ‘Level’ entity (e.g. Level.a = 1Smiley Wink…I think, but am not sure, that these variables only exist on the client level.  That is, if I am running the mod on machine1 and machine2, variable level.a can be set for each of them individually.  Again, I could be wrong and would like to know if that is true or not.

-        What I would call “Shared” variables (user-defined variables that are set at the server level) are created using SetDvar({dvar_name_as_a_string}, {value_as_whatever_type}) with get methods (functions) of GetDvar, GetDvarInt, GetDvarFloat, etc.

-        Functions are much like variables: no return typing, and no parameter typing

-        Functions are called on entities like level, attacker, player, etc.  Self can be considered an entity, but from what I understand it takes on whatever entity a function was called with.  I don’t completely believe that.  I keep thinking that it goes back to a way to reference player, where ‘i’ is the index for your character.  Another thing I would like to have clarified

-        Entities are not treated like objects in java, where you call something like object.method(params) ;.  Instead, the syntax is entity function(params);

-        Functions from other gsc files are called by typing out the path starting from raw or mod (if you have it local to the mod, it checks mod first, then raw), followed by the gsc file name without the extension, followed by ‘::’ and the function name and any params

-        Running a function as a new process (thread) is done simply by calling it with thread (e.g. entity thread function(params);

-        There are lists of Dvars available (and I think I downloaded a fairly complete list) as well as weapon names and such

Questions, requests for further information, comments:

-        Being that gsc files, weapon files, etc are programming language, I assumed there would be a well-documented API, but have found no such thing.  One of the closest sites that I have found is  Does anyone have any other resources for something resembling an API?   Something that shows not only the function, and whether or not it can be used in MP, and what “module” it belongs to, but also the valid values for parameters, and either sample return values or the type of return we would expect from the function.  I’ve started doing this and am going to write code that reads through all of the GSC files to hopefully compile a database of functions and where they come from, but that still doesn’t give me as much information as I would like.

-        I am not understanding callbacks very much.  I know what a callback is, but I am not sure how to implement it.  Here is the sample problem: I would like to recreate a feature that this person was telling me about.  When a player dies during a game with a limited amount of respawns, and runs out of them, they pretty much become a spectator.  He would like to give the player a valkyrie rocket every 30 seconds until a new round begins or all players are dead.

I have written a function that is called onPlayerKilled if this was the last life (and they are not AI) using self thread spectatorMode();.  The code for the function is currently pseudo code, but the algorithm is to set the endon (self endon(“round_end”), where I believe self is referring to thread) .  Start an endless loop (while(1) or for(;Smiley Wink, whichever works fine).  The loop will: wait 30 seconds.  Check to see if the player is still spectating…ing and does not already have a round.  If both are true, then give the player a valkyrie rocket.  Lastly, waittill (“rocket_used”). 

I do not know how to do a notify (“rocket_used”) since I do not know how to write a callback that is linked to the rocket being fired.  I am more than happy to accept input on changing this algorithm, but my question still remains, how would I create a callback method that is triggered by specific events?

-        On top of this, I wanted to learn about how changing the parameters in setExpFog and SetClientDvar(“r_lightTweakSunColor”, r + “ “ + g + “ “ + b), "r_skycolorTemp", "r_heroLightColorTemp", so I started doing what I would do in any other environment: write code that lets me change the functions one variable at a time.  I wrote a mod that added hud elements to show far, half, r, g, b, delay, suncolor_r, suncolor_g, suncolor_b, skycolortmp, herolightcolortmp.  I wanted to assign an “increase far”, “decrease far” button.  I looked at binding, but only got tutorials on modding config files to have bound keys do pre-defined functions in game.  I would like to write something like a keylistener function that just sits and listens for keystrokes.

My overall goal with it is to have text boxes in which I can assign values to each of those (maybe in a custom menu so that I can learn how to make those, next.)  I saw some mod that was talking about a slider (which would also be something I would be willing to learn how to make), but, again, it was not something done using mod tools, gsc files, etc.  At least, not from what I could tell.  Does anyone have insight on how I might accomplish this?

-        I will eventually want to look into adding weapons.  I have modeled a weapon in Maya and found a tutorial on how to add the minimum ik handles and such to it to export to COD, does anyone know of more tutorials on how to add a custom weapon (using Maya with COD plugin, and mod tools)?  Same with maps and skyboxes.

I have more specific questions, but these are the general questions that I currently have.  I appreciate any assistance and will continue searching for resources on my own as well.

Likes: 0
Posts: 1
Registered: ‎12-09-2013