Tutorial Black Ops 3: GSC Modding - Create uiElements (createText, createRectangle) Functions +Source

Do you want more Black Ops 3 Tutorials?


  • Total voters
    17

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,421
Points
553
Hello everyone,
today I will share some 3 example Create-uiElements-Functions developed by me! Because at the start there are some changes on bo3 to call the normal ui functions.. :grinning: Feel free to use them in your project with credits! :grinning:


Source of this Test Project:
You have to be logged in to view links Log in or register now.

createText
Create a String/Text uiElement
Example:
Code:
self.element_2 = self createText("default", 1.5, 0, "Join CabConModding", "CENTER", "CENTER", -250, 0, 1,(1,1,1));
Code:
function createText(font,fontSize, sorts, text, align, relative, x, y, alpha, color)
{
    uiElement = hud::createFontString(font, fontSize);
    uiElement hud::setPoint(align, relative, x, y);
    uiElement settext(text);
    uiElement.sort = sorts;
    uiElement.hidewheninmenu = true;
    if( isDefined(alpha) )
        uiElement.alpha = alpha;
    if( isDefined(color) )
        uiElement.color = color;
    return uiElement;
}

createRectangle
Create a Rectangle uiElement
Example:
Code:
self.element_3 = self createRectangle("CENTER", "CENTER", 0, 0, 100, 100, (1,0,0), 1, 1, "white");
Code:
function createRectangle(align, relative, x, y, width, height, color, sort, alpha, shader)
{
    uiElement = newClientHudElem( self );
    uiElement.elemType = "bar";
    uiElement.width = width;
    uiElement.height = height;
    uiElement.xOffset = 0;
    uiElement.yOffset = 0;
    uiElement.hidewheninmenu = true;
    uiElement.children = [];
    uiElement.sort = sort;
    uiElement.color = color;
    uiElement.alpha = alpha;
    uiElement hud::setParent( level.uiParent );
    uiElement setShader( shader, width , height );
    uiElement.hidden = false;
    uiElement hud::setPoint(align,relative,x,y);
    return uiElement;
}

createValueElement
Create a Value uiElement
Example:
Code:
self.element = self createValueElement(1.5, 0, 1337, "CENTER", "CENTER", 250, 0, 1, (1,1,1));
Code:
function createValueElement(fontSize, sorts, value, align, relative, x, y, alpha, color)
{
    uiElement = hud::createFontString("default", fontSize);
    uiElement hud::setPoint(align, relative, x, y);
    uiElement setvalue(value);
    uiElement.sort = sorts;
    uiElement.hidewheninmenu = true;
    if( isDefined(alpha) )
        uiElement.alpha = alpha;
    if( isDefined(color) )
        uiElement.color = color;
    return uiElement;
}
Credits
CabCon​


Regards,
CabCon.
 
Last edited:

Joker

Insane-Known Member
Messages
50
Points
368
an example on createValueElement would be nice, And the other ones for new people?
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,421
Points
553
an example on createValueElement would be nice, And the other ones for new people?
Thank you, I will add some examples into it! You can see examples also here in the source which I linked:
You have to be logged in to view links Log in or register now.
 

Joker

Insane-Known Member
Messages
50
Points
368
Nice, Thanks, But what is the difference from setText and createValue? Like what is this used for in game? And how would you use this in an option? Is it like the ammo count etc or?
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,421
Points
553
Nice, Thanks, But what is the difference from setText and createValue? Like what is this used for in game? And how would you use this in an option? Is it like the ammo count etc or?
To create strings like texts or messages... you use createText, to display a variable (int, flout) you use createValueElement because It won't cause a string overflow and it is perfect optimized for it. :smile: Just take a look into mt example code there you see:
You have to be logged in to view links Log in or register now.
 

Top