[Tutorial] Gsc For Dummies

Posts 115 of 42 · Page 1 of 3
[Tutorial] Gsc For Dummies
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:
Code:
while(1) {
}
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

Nice I like your tut, good job
/Thanked
/Request Sticky
Quote Originally Posted by Mr.Mackey View Post
Nice I like your tut, good job
/Thanked
/Request Sticky
thanks... Actually this isnt really that advanced, i didnt even teach people how to make a thread
Quote Originally Posted by Josephlittle View Post
thanks... Actually this isnt really that advanced, i didnt even teach people how to make a thread
Yes but its usefull for ppl who dont know this yet.
Just like my How to make bunkers TUT.
I already knew those stuff.
I made 4 s and repeated what i said in previous threads xD.
So its kinda useful to stick it so everyone can see it
While true(true is 1, false is 0), we do this code
Would that mean 0.5 is 'sorta'?
Quote Originally Posted by AZUMIKKEL View Post
Would that mean 0.5 is 'sorta'?
0=false
1= true

lol xD?
Quote Originally Posted by Josephlittle View Post
0=false
1= true

lol xD?
Let me correct you here 0 == false
Anything that isn't 0 below or above is true.
Quote Originally Posted by rathynia View Post
Let me correct you here 0 == false
Anything that isn't 0 below or above is true.
/agree
I were just joking with him. Right?
I posted how to make bunkers first on this website. =(
Quote Originally Posted by soccerguy View Post
I posted how to make bunkers first on this website. =(
lol, but your directions i had no idea how to follow them
Soccerguy ur taking credits for what is already given in killings mod lol. All threads of the mapedit have the value meanings in (). The only thing that u did was write them again ^^
Quote Originally Posted by kerocx View Post
Soccerguy ur taking credits for what is already given in killings mod lol. All threads of the mapedit have the value meanings in (). The only thing that u did was write them again ^^
could we please get on topic??


check out my new avatar...matches my usertitle !
You dumbass
You KNEW i was making this...

PS: your color scheme sucks
:O You stole insane's idea? :O BAN HIM!
No joke. Theres just posted another tut xD.
So post yours to compare which is best xD
Posts 115 of 42 · Page 1 of 3

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?