.gsc Scripting help needed

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: .gsc Scripting help needed

Post by F |Madness| U » June 12th, 2011, 9:08 pm

Okay I see, thanks. Do you know of any guide or so on how to go about this? I checked mappers united wiki and other places and couldn't find it. I assume you have to atleast make a "newgametype".gsc, similar to tdm.gsc for example, but other than that I have no idea.
-

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: .gsc Scripting help needed

Post by Drofder2004 » June 12th, 2011, 10:07 pm

cj.gsc is dm.gsc with two minors adjustments.

the <gametype>.gsc files are for gametype specific scripts.
the globallogic.gsc is where most of the major work takes place.

Usually however, a custom mod will simply create there own seperate gsc file (e.g codjumper.gsc) which hold thes majority of the info.

When I took over the modding on previous games, I organised everything in to its own file.
jumping - admin - voting - messages - punishments

With CoD4, there are only 5 gsc files that are not converted files that already existed.
"setup" - Initialise/Precache/Dvars
"punish" - punishments
"commands" - Menus/voting
"utility" - some common functions (and also, voting started and didnt not move from here)
"codjumper" - core functions

All other files are to remove the features that exist in stock games, such as 'hardpoints' (radar/airstrike)...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: .gsc Scripting help needed

Post by F |Madness| U » June 13th, 2011, 2:28 pm

Okay I understand how you layed it out etc, however how do you actually make the gametype, if you know what I mean?

For example I have all my code that runs my nadetraining mod inside the _rank.gsc. And I can load my nadetraining mod on any gametype and it will work. How would I go about creating a new gametype "nt" for example, that would be based on "dm" (no objectives or teamwork etc). -Thanks
-

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: .gsc Scripting help needed

Post by Drofder2004 » June 13th, 2011, 5:03 pm

Instead of loading it using your _rank files, you could put all that info into a "nt.gsc" file and load it that way.
Then add your new gametype to the bottom of "_gametypes.txt"

Compile and g_gametype nt.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: .gsc Scripting help needed

Post by F |Madness| U » June 13th, 2011, 5:11 pm

Thankyou very much!
-

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: .gsc Scripting help needed

Post by F |Madness| U » June 14th, 2011, 7:13 pm

I have a few small questions, and a problem :lol:

Firstly, when you're in the process of making a mod, once you edit your .gscs to test some new code etc, do you recompile the mod and load it up to see if it works? Because wouldn't that be quite time consuming having to re-compile every time you change the .gsc? Reason I was asking is because with Black Ops scripting official mod tools arn't released yet, so I can't compile the mod, I just have the .gsc in blackops/mods/mymod/maps/mp/gametypes/_rank.gsc. I tryed creating a nt.gsc and adding nt to bottom of _gametypes.txt and then running but it didn't work, so I guess you have to compile for a new gametype to work.

But yeah even with mod tools for cod4 for example, do you re-compile the mod each time you change some script?

And my problem, I found a dvar to remove the glare of the sun when you look at it, and added it into the .gsc (see code below).
The problem is however, the glare of the sun is removed for me. but any other players who connect can still see the sunglare.
If it makes any difference, I am the server host (but it's not like on cod4- I have no seperate window for the dedi server, only the window that I am playing on).

Code: Select all

visualdvars()
{
        setVolFog(0, 300, 2000, 3000, 0, 0, 0, 0.0);
        setDvar("r_sun_from_dvars", "1");
        setDvar("r_sunflare_max_size", "0" );     
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill( "connected", player );
                player thread visualdvars();
                                 ....
                 }
}
-

User avatar
Opel
CJ Fan
CJ Fan
Posts: 188
Joined: September 15th, 2008, 12:28 pm
Location: Scotland

Re: .gsc Scripting help needed

Post by Opel » June 14th, 2011, 7:32 pm

fs_usedevdir 1 will let you edit your scripts, all you have to do is edit them then devmap with your mod. Also try using setclientdvar for the sun glare.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: .gsc Scripting help needed

Post by Drofder2004 » June 14th, 2011, 7:42 pm

Compiling a mod takes seconds and combined with some custom cmd lines, you can compile+run the mod with one-click.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: .gsc Scripting help needed

Post by F |Madness| U » June 14th, 2011, 8:40 pm

I've never compiled a mod I didn't realise it would be that quick, I thought it would be like custom maps that take a few minutes to compile.

But yeah I made nt.gsc , and added nt to the bottom of _gametypes.txt, and so my mod folder structure is like:

blackops\mods\mymod\maps\mp\gametypes\_gametypes.txt
blackops\mods\mymod\maps\mp\gametypes\_nt.gsc

However if I do /g_gametype nt; map mp_cracked it just lags for a second, then loads the map in dm. Is this because it has to be compiled for a new gametype you think?

And if I use SetClientDvar, I get unknown function setDvar("r_sunflare_max_size", "0" );.
-

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests