Modding changes from MW2 to Black Ops

Posts 14 of 4 · Page 1 of 1
Modding changes from MW2 to Black Ops
As some of you may have already known, there have been some slight alterations to modding and coding in GSCs. Some functions and some have been removed. Here are some significant changes in Black Ops.

notifyOnPlayerCommand is no longer supported. In MW2 this was a good way to open custom menus and do custom functions but this was removed in Black Ops possibly because it served no pupose. Now, you have to use a while statement with an if statement saying if the button was pressed or not. This can be inconvenient if a somethingbuttonPressed() wasn't created for the thing you wanted. Like if I wanted to use weapnext, there's no such thing as weapnextButtonPressed().

Example:
Code:
Modern Warfare 2:
self notifyOnPlayerCommand("frag", "+frag");
while(1) {
    self waittill("frag");
    //Do functions here
}

Black Ops:
while(1) {
    if(self fragButtonPressed()) {
        //Whatever functions here
    }
    wait 0.01;
}
Here a list of buttonPressed functions you can use:
Code:
AdsButtonPressed()
AttackButtonPressed()
MeleeButtonPressed()
UseButtonPressed()
ActionSlotOneButtonPressed() //X
ActionSlotTwoButtonPressed() //not sure do they exist (7)
ActionSlotThreeButtonPressed() // not sure do they exist (5)
actionSlotFourButtonPressed() //6
ThrowButtonPressed() //uhhhhh, +speed_throw? That would be MOUSE2 then.
changeSeatButtonPressed() //wut?
jumpButtonPressed() //space
fragButtonPressed() //G/MOUSE3
secondaryOffhandButtonPressed() //4
Thanks Deathmax!

foreach has also been removed in Black Ops. This was useful in MW2 if you wanted to do something like foreach(player in level.players) but this function doesn't exist any longer, possibly because it is a 'lazy' way or shortcut to using a for statement.

Example:
Code:
Modern Warfare 2:
foreach(player in level.players) {
    player suicide();
}

//===============

weaponsList = self getWeaponsListAll();
foreach(weapon in weaponsList) {
    self setWeaponAmmoStock(weapon, 99999);
    self setWeaponAmmoClip(weapon, 99999);
}

Black Ops:
for(i = 0; i < level.players.size; i++) {
    level.players[i] suicide();
}

//===============

weaponsList = self getWeaponsList();
for(i = 0; i < weaponsList.size; i++) {
    self setWeaponAmmoStock(weaponsList[i], 99999);
    self setWeaponAmmoClip(weaponsList[i], 99999);
}
Using a function on a variable that hasn't been declared (even if it has self.whatever) now generates syntax errors, in MW2 this was useful in creating or 'refreshing' font strings over and over again.

Example:
Code:
Modern Warfare 2:
self.someText destroy();
self.someText = self createFontString("default", 2);
self.someText setPoint("CENTER", "CENTER", "CENTER", "CENTER");
self.someText setText("This is a test!");

Black Ops:
if(isDefined(self.someText)) {
    self.someText destroy();
}
self.someText = self createFontString("default", 2);
self.someText setPoint("CENTER", "CENTER", "CENTER", "CENTER");
self.someText setText("This is a test!");
Just a mini-note, setPoint seems to be a little buggy on Black Ops so you can use the following instead:
Code:
Using codes only:
self.someText.alignX = "CENTER"; //X position
self.someText.alignY = "CENTER"; //Y position
self.someText.X = 0; //X offset
self.someText.Y = 0; //Y offset

Using a function:
setPosition(alignX, alignY, X, Y)
{
    if(!isDefined(X)) {
        X = 0;
    }
    if(!isDefined(Y)) {
        Y = 0;
    }
    self.alignX = alignX;
    self.alignY = alignY;
    self.X = X;
    self.Y = Y;
}

//How to use:
//self.someText setPosition("CENTER", "CENTER");
//or
//self.someText setPosition("CENTER", "CENTER", -20, 10);
Any more changes? Let me know here, kinda got this all from the top of my head since I'm not at home.
self _setPerk("perk_name");
self _unsetPerk("perk_name");
no longer works.

self _clearPerks();
doesn't either, you can use self clearPerks(); but i can't confirm if it works.


If anyone figures this out, PLEASE tell me!

Edit: Found out. Silly me


Line 910: self setPerk( perk );
Line 914: self unsetPerk( perk );
Quote Originally Posted by AZUMIKKEL View Post
self _setPerk("perk_name");
self _unsetPerk("perk_name");
no longer works.

self _clearPerks();
doesn't either, you can use self clearPerks(); but i can't confirm if it works.


If anyone figures this out, PLEASE tell me!
I thought they did work, just remove the underscore from _setPerk and _unsetPerk.
cool thanks for the info champ!
Posts 14 of 4 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?