GSC [CoD:MW (2019)] GSC Managed code list

HiNAtyu

Veteran
Messages
13
Reaction score
6
Points
783
Dear CabConModding
Hello, I'm HiNAtyu

I have recently created many GSC Mods for MW19.
As part of this, I would like to release the source code of one function.
I hope that this will lead to more people jumping into the new world of GSC development after BO4.

I will share the code from time to time, so please do so.

------------------------------

Give full random weapon

You do not have permission to view link Log in or register now.


・Multilingual language
・Give random weapon

 

JayCoder

Veteran
Staff member
Messages
369
Reaction score
152
Points
903
why u code it like that, iv not ever seen people code menus like that since like cod waw..
 

HiNAtyu

Veteran
Messages
13
Reaction score
6
Points
783
why u code it like that, iv not ever seen people code menus like that since like cod waw..
Do you mean GitHub?
My Menu source is already over 1000KB and it is difficult to manage with pastebin etc.
I use GitHub because I want to be able to see the changes at a glance as differences.
Is it rare?
 

JayCoder

Veteran
Staff member
Messages
369
Reaction score
152
Points
903
Do you mean GitHub?
My Menu source is already over 1000KB and it is difficult to manage with pastebin etc.
I use GitHub because I want to be able to see the changes at a glance as differences.
Is it rare?
it's like it's your first time making gsc ... like u came from a c-language, like c++ or c# possibly,
I'v not seen people really do case, breaking for menu's since waw and myself tho it's not a really officiant way....
and i think ur using iprintln for the text structure which is weird ... just use setText... unless u can't for cod mw,
it certain cases case breaking is good, but ur making a menu not a toggle or a function... so it's just gunna cause more code, script.

u could use this example:

function look up information:
C++:
void <hud_element> SetText(<text>)
[MANDATORY] <text> A localized text reference
CATEGORY: UI
CLIENT/SERVER: Server
SUMMARY: Set HUD text for this element.
EXAMPLE: level.introstring1 SetText(string1)

testfunction()
{
    self thread mytextExample(0.5,"menu name");
}

mytextExample(Time,MenuTitle)
{
    self.mytext          = [];
    self.mytextSet       = self hud::CreateFontString("default", "1");
    self.mytextSet.alpha = 1;
    text_spacing_x = 10;
    for(i=0;i<10;i++)
    {
        //varibles
        self.mytextSet["example_sub"+i].hideWhenInMenu = true;
        self.mytextSet["example_title"].hideWhenInMenu = true;
        self.mytextSet["example_title"].sort = 0;   
        self.mytextSet["example_sub"+i].sort  = i;
        self.mytextSet["example_sub"+i] hud::setPoint("CENTER", "CENTER", 0, text_spacing_x * i);
        self.mytextSet["example_title"] hud::setPoint("CENTER", "CENTER", 0, 0);
        //Structure
        self.mytextSet["example_title"] SetText(MenuTitle);
        self.mytextSet["example_sub"+i] SetText("Sub Option: " + i);
        //Color
        textElem.color = (1,1,1);
        wait time;
    }
    wait time;
    return self.mytextSet;
}

//menu would look something like this possibly

/*

menu name

sub option: 1
sub option: 2
sub option: 3
sub option: 4
sub option: 5
sub option: 6
sub option: 7
sub option: 8
sub option: 9
sub option: 10

*/

I don't know if that example works, but it should, if I we're creating text on cod mw that is something i would do possibly..

this is a super simple example for creating text as u can see,
I take the variable I and it 10 times using a for loop
and also make a title without the I so it doesn't make multiple titles,
then use it for the subtext to make a structure, by putting it into an array.

it just looks like c++ code,
C++:
 case "ModMenuOpenDescription":
            if (        selfLang == level.MODDEF.LN_EN ) { return "^3Give random weapon to press^1 [{+speed_throw}] + [{+melee}] ^3."; }
            else if (   selfLang == level.MODDEF.LN_JA ) { return "^3ランダム武器は^1 [{+speed_throw}] + [{+melee}] ^3で取得できます。"; }
            else if (   selfLang == level.MODDEF.LN_CN ) { return "^3随机武器^1 [{+speed_throw}] + [{+melee}] ^3你可以得到。"; }
            else if (   selfLang == level.MODDEF.LN_RU ) { return "^3случайное оружие ^1 [{+speed_throw}] + [{+melee}] ^3вы можете получить."; }
            break;

u can do an array for the language check too...
 
Last edited:

HiNAtyu

Veteran
Messages
13
Reaction score
6
Points
783
it's like it's your first time making gsc ... like u came from a c-language, like c++ or c# possibly,
I'v not seen people really do case, breaking for menu's since waw and myself tho it's not a really officiant way....
and i think ur using iprintln for the text structure which is weird ... just use setText... unless u can't for cod mw,
it certain cases case breaking is good, but ur making a menu not a toggle or a function... so it's just gunna cause more code, script.

u could use this example:

function look up information:
C++:
void <hud_element> SetText(<text>)
[MANDATORY] <text> A localized text reference
CATEGORY: UI
CLIENT/SERVER: Server
SUMMARY: Set HUD text for this element.
EXAMPLE: level.introstring1 SetText(string1)

mytextExample(Time,MenuTitle)
{
    self.mytext = [];
    for(i=0;i<10;i++)
    {
        self.mytextSet["example_title"] SetText(MenuTitle+"\n");
        self.mytextSet["example_sub"+i] SetText("Sub Option: " + i + "\n");
        self.mytextSet["example_sub"+i] hud::setPoint("CENTER", "CENTER", 0, 10 * i);
        wait time;
    }
    wait time;
}

I don't know if that example works, but it should, if I we're creating text on cod mw that is something i would do possibly..

this is a super simple example for creating text as u can see,
I take the variable I and it 10 times using a for loop
and also make a title without the I so it doesn't make multiple titles,
then use it for the subtext to make a structure, by putting it into an array.

it just looks like c++ code,
C++:
 case "ModMenuOpenDescription":
            if (        selfLang == level.MODDEF.LN_EN ) { return "^3Give random weapon to press^1 [{+speed_throw}] + [{+melee}] ^3."; }
            else if (   selfLang == level.MODDEF.LN_JA ) { return "^3ランダム武器は^1 [{+speed_throw}] + [{+melee}] ^3で取得できます。"; }
            else if (   selfLang == level.MODDEF.LN_CN ) { return "^3随机武器^1 [{+speed_throw}] + [{+melee}] ^3你可以得到。"; }
            else if (   selfLang == level.MODDEF.LN_RU ) { return "^3случайное оружие ^1 [{+speed_throw}] + [{+melee}] ^3вы можете получить."; }
            break;

u can do an array for the language check too...
Ah, it's true that building Menu text with iPrintln( ) is unusual for people from the old BO2 generation.

Are you sure it's after BO4?
It seems that CreateFontString() does not work for BO4, MW2019, MWII, and MWIII.
Looks like you'll need to apply a patch to make it usable.

As for BOCW, I don't know because probably no one has made a Mod menu from GSC yet.
DeathRGH's Menu is implemented from elf, and is probably an RPC, SPRX-like implementation.

Also, the version released this time does not include a Mod menu.
This is for demonstration purposes, so Bind only
 

JayCoder

Veteran
Staff member
Messages
369
Reaction score
152
Points
903
Ah, it's true that building Menu text with iPrintln( ) is unusual for people from the old BO2 generation.

Are you sure it's after BO4?
It seems that CreateFontString() does not work for BO4, MW2019, MWII, and MWIII.
Looks like you'll need to apply a patch to make it usable.

As for BOCW, I don't know because probably no one has made a Mod menu from GSC yet.
DeathRGH's Menu is implemented from elf, and is probably an RPC, SPRX-like implementation.

Also, the version released this time does not include a Mod menu.
This is for demonstration purposes, so Bind only
let me take a look at ur implementation again..... there is no includes in ur project....ummm that strange,

I recommend using something like infinity loader .. it well put together software for gsc on some new cods like ww2 and cod mwr tbh

u have legit no includes

#include scripts\codescripts\struct;
#include scripts\shared\callbacks_shared;
#include scripts\shared\clientfield_shared;
#include scripts\shared\math_shared;
#include scripts\shared\system_shared;
#include scripts\shared\util_shared;
#include scripts\shared\hud_util_shared;
#include scripts\shared\hud_message_shared;
#include scripts\shared\hud_shared;

ur not gunna get super far with no includes... i mean u can still access a bunch of functions, but stuff like creating text is gunna be difficult.

the documentation and presentation of the code is nice tho.

scripts\engine\utility::Array_Add clearly there are includes u didn't include any in ur project
 
Last edited:

HiNAtyu

Veteran
Messages
13
Reaction score
6
Points
783
let me take a look at ur implementation again..... there is no includes in ur project....ummm that strange,

I recommend using something like infinity loader .. it well put together software for gsc on some new cods like ww2 and cod mwr tbh

u have legit no includes

#include scripts\codescripts\struct;
#include scripts\shared\callbacks_shared;
#include scripts\shared\clientfield_shared;
#include scripts\shared\math_shared;
#include scripts\shared\system_shared;
#include scripts\shared\util_shared;
#include scripts\shared\hud_util_shared;
#include scripts\shared\hud_message_shared;
#include scripts\shared\hud_shared;

ur not gunna get super far with no includes... i mean u can still access a bunch of functions, but stuff like creating text is gunna be difficult.

the documentation and presentation of the code is nice tho.
The MW2019 GSC I'm running now is not going through tools like Infinity loader

Therefore, I think include is no longer necessary (I don't know the details of the client-side implementation, so I will omit it)

Honestly, if it were my current Full GSC Source, I'd like to split it into multiple source files, but that's not possible yet, so I'm sticking with just one file and proceeding with the implementation.

However, since it is a relatively new title, GSC is quite interesting.
 

JayCoder

Veteran
Staff member
Messages
369
Reaction score
152
Points
903
The MW2019 GSC I'm running now is not going through tools like Infinity loader

Therefore, I think include is no longer necessary (I don't know the details of the client-side implementation, so I will omit it)

Honestly, if it were my current Full GSC Source, I'd like to split it into multiple source files, but that's not possible yet, so I'm sticking with just one file and proceeding with the implementation.

However, since it is a relatively new title, GSC is quite interesting.
no we do not omit includes, if that was the case alot of things in ur menu would be broken... ur using namespaces and everything...
 

HiNAtyu

Veteran
Messages
13
Reaction score
6
Points
783
no we do not omit includes, if that was the case alot of things in ur menu would be broken... ur using namespaces and everything...
If so, the client side is probably automatically including it.

I only know the GSC implementation, so I don't currently understand things like include

All I can say for now is that I think include will be supported when Infinity Loader supports MW19.

Perhaps it may still be technically difficult to use include on this client
 
Top