Hello everyone, this is a Tutorial for .gsc modding. This tutorial is for people who have NO idea how to mod, and want to learn themselves . Anyways, in this tutorial we will learn:
☻.Gsc Files
☻ How a .Gsc works
☻ How to call in commands and threads on _rank.gsc
☻ .Gsc Commands
☻ "Advanced" Code
First of all, if you do not know how to run a mod, this isn't a tutorial for you. This tutorial is for people who already have experience in hosting a mod, but really want to do a mod themselves. This tutorial is also for educational purposes only, Josephlittle is not responsible for any bans or something bad happening to your game. Sources where information has been gathered:
.gsc Codes
Private Server Section
Discussion section
Anyways, lets get back to the tutorial shall we :D?
.Gsc Files:
As probably many of you know, you can run a mod as a .gsc file. But those .gsc files are all part of .ff files, think of it as a giant folder with loads of papers, the folder is the .ff files. Also, modders usually use _rank.gsc because it contains the OnPlayerSpawned thread (we will go over this later) and also deals with player Connect, which is kind of important.
Anyways, there are many .gsc files you can use out there, and every single one has a function to make the game work. We, modders, just modify them to suit our needs :)
How a .Gsc file works:
There are 2 ways of loading a .gsc file. One is saving the patch_mp.ff with your .gsc files (which is the most horrible thing you can do, probably causing you to be banned) and there is injecting. Of course, both probably get you banned, but this is only a tutorial for people who are willing to take the risk (aIW doesnt ban people who host mods as lots of you know)
anyways, a .gsc file always has somewhat of a loop function. For example, in _rank.gsc there is a command that waits untill you spawn, and does another command. That is also a "loop". We will go over more information in the next Subject.
How to call in commands and threads on _rank.gsc
Let's go deeper in the _rank.gsc file. Open it and you will see lots of code. Don't worry, we will go over them later. Now, with your magical Control + F button(search), put in: OnPlayerSpawned
you will see this code over here:
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
}
}
That whole "paragraph" (a.k.a a thread) is what makes the .gsc file works. Threads are very easily found by:
The name of the thread followed by 2 parenthesis( eg.: onPlayerSpawned()
then there are brackets for code. Brackets are important when you are going to start a code, without them you are pretty much screwed /baba.
Note that this code here: self waittill("spawned_player");
has a semi colon after the command(;;;;;;;). This semi colon is to end a command, and you need them after every "game" command (not a syntax code like For(;;) )
We will modify that thread with the commands in the next Subject
.Gsc Commands:
See this thread by Abstract for .gsc codes: .gsc codes
lets say i want to add a wallhack SO much. so what we do is we get the command from the huge list (might take a while to find it)
and here, the command to activate the wallhack is:
self ThermalVisionFOFOverlayOn();
now you are probably wondering, what do I do with this? lets go back to our onplayerspawned() and find out:
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self ThermalVisionFOFOverlayOn();
}
}
As you can see, I implemented the code after the player is spawned, so whenever I spawn I get wallhack.
Anyways, lets say i want to add a weapon. the code to add a weapon is:
self giveWeapon(<name of the weapon>, <camouflage>, <I think this is akimbo, but put 0 in here so you dont mess up your code> );
Now lets say I want to add an ak-47 after I respawn. So, we fill in the blanks:
self giveWeapon("ak47_mp", 0 , 0 );
PS: Every weapon name you put in HAS to be between quotes, and also every weapon for multiplayer has _mp after the weapon name.
so, we add that command to the onPlayerSpawned thread:
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self ThermalVisionFOFOverlayOn();
self giveWeapon("ak47_mp", 0 , 0 );
}
}
There you go, you now have Wallhack and an ak-47!
Next Subject we will cover up False, True codes and Loops
"Advanced" Codes:
After you've did some things to your code, you want to add a loop function so that the player never looses something. The loop code is:
This may sound very simple, and it is! this in english means:
Code:
While true(true is 1, false is 0), we do this code
So, lets say I want to keep setting the ak-47 ammo to it's max capacity. So we add:
Code:
while(1) {
self GiveMaxAmmo("ak47_mp");
}
This will keep giving you unlimited ammo untill you die :D
So lets add this in the onplayerspawned thread:
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
self ThermalVisionFOFOverlayOn();
self giveWeapon("ak47_mp", 0 , 0 );
while(1) {
self GiveMaxAmmo("ak47_mp");
}
}
}
And that's it, you just learned the BASIC of mods, good job!
Stay tuned for part 2 that will probably come out next week