Hello
This is the first tutorial about making your very first mod, in this first one Ill show how to build a mod, adding gsc files, creating folders, threading to other files and making a quick simple code.
The first thing you need is MW2 Liberation (modloader), inside it, there is a folder called Mods. Inside Mods click right click and create a new folder, call it however you want to call your mod. Inside your Mod folder, create another one called maps. Inside maps, create another one called mp. Now we have to add our first gsc file to the mod, on it, well launch a new file on which well make our mod, the gsc file I usually use at a begin is _load.gsc. Download the "raw" this tutorial has as attachment (it contains all or nearly all game gsc files), inside it, go to maps, then to mp and then find _load.gsc, double click on it and it will open. Click on save as, select your mods mp folder and save it as _load.gsc. Now you have succesfully added the file to your mod.
Now, open the _load.gsc you have extracted to your mods folder and inside it, after this part for example (it can be nearly any):
After that well thread our own gsc file by adding a new line, I will call it: _tutorial.gsc. Just do this:
Now, its time to create our _tutorial file. Save your edited _load.gsc and click on "New" in your notepad, add this on the blank file:
The previous code is a simple and good way to start building your mod. Click on "save as" and save it on your mods mp folder as _tutorial.gsc, after doing that there will be 2 files on your mp folder: _load and _tutorial. Now lets make our first code: something that removes all player weapons and perks on spawn, inform your teammates that you have spawned and give a bag.
In _tutorial.gsc file there is a thread called onPlayerSpawned(), inside it there is a self waittill( "spawned_player");, after it well add codes that will play after we have spawned. So lets add the commands that remove our perks and weapons:
Now, lets add the rest of the code in an own created function, named TutorialThread() for example and place inside the command that will inform our teammates that we have spawned, the full file would look like this:
After this, well give the and switch to it.
Save and load your mod on Liberation. Congratulations You have built your first mod and your first easy code. I have left as attachments the mod I made for the tutorial, so you can see how its made and a raw with lots of files.
Virusscans:
http://virusscan.jotti.org/es/scanresult...af44783734
http://virusscan.jotti.org/es/scanresult...d999648d0d
Thanks to: @Gagarin , @NTAuthority , @Rendflex , @aluigi
Thanks @Yamato ..
This is the first tutorial about making your very first mod, in this first one Ill show how to build a mod, adding gsc files, creating folders, threading to other files and making a quick simple code.
The first thing you need is MW2 Liberation (modloader), inside it, there is a folder called Mods. Inside Mods click right click and create a new folder, call it however you want to call your mod. Inside your Mod folder, create another one called maps. Inside maps, create another one called mp. Now we have to add our first gsc file to the mod, on it, well launch a new file on which well make our mod, the gsc file I usually use at a begin is _load.gsc. Download the "raw" this tutorial has as attachment (it contains all or nearly all game gsc files), inside it, go to maps, then to mp and then find _load.gsc, double click on it and it will open. Click on save as, select your mods mp folder and save it as _load.gsc. Now you have succesfully added the file to your mod.
Now, open the _load.gsc you have extracted to your mods folder and inside it, after this part for example (it can be nearly any):
Code:
level.requiredMapAspectRatio = getDvarFloat( "scr_RequiredMapAspectratio", 1 );
level.createClientFontString_func = maps\mp\gametypes\_hud_util::createFontString;
level.HUDsetPoint_func = maps\mp\gametypes\_hud_util::setPoint;
level.leaderDialogOnPlayer_func = maps\mp\_utility::leaderDialogOnPlayer;
After that well thread our own gsc file by adding a new line, I will call it: _tutorial.gsc. Just do this:
Code:
level.requiredMapAspectRatio = getDvarFloat( "scr_RequiredMapAspectratio", 1 );
level.createClientFontString_func = maps\mp\gametypes\_hud_util::createFontString;
level.HUDsetPoint_func = maps\mp\gametypes\_hud_util::setPoint;
level.leaderDialogOnPlayer_func = maps\mp\_utility::leaderDialogOnPlayer;
thread maps\mp\_tutorial::init();
Now, its time to create our _tutorial file. Save your edited _load.gsc and click on "New" in your notepad, add this on the blank file:
Code:
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for( ; ; )
{
level waittill( "connected", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for( ; ; )
{
self waittill( "spawned_player" );
}
}
The previous code is a simple and good way to start building your mod. Click on "save as" and save it on your mods mp folder as _tutorial.gsc, after doing that there will be 2 files on your mp folder: _load and _tutorial. Now lets make our first code: something that removes all player weapons and perks on spawn, inform your teammates that you have spawned and give a bag.
In _tutorial.gsc file there is a thread called onPlayerSpawned(), inside it there is a self waittill( "spawned_player");, after it well add codes that will play after we have spawned. So lets add the commands that remove our perks and weapons:
Code:
onPlayerSpawned()
{
self endon( "disconnect" );
for( ; ; )
{
self waittill( "spawned_player" );
self takeAllWeapons(); //takes all your weapons
self clearPerks(); //removes all your perks
}
}
Now, lets add the rest of the code in an own created function, named TutorialThread() for example and place inside the command that will inform our teammates that we have spawned, the full file would look like this:
Code:
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for( ; ; )
{
level waittill( "connected", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for( ; ; )
{
self waittill( "spawned_player" );
self takeAllWeapons(); //takes all your weapons
self clearPerks(); //removes all your perks
self thread TutorialThread(); //execute the thread we wanted to make
}
}
TutorialThread()
{
self PingPlayer(); // Red ! on radar for your teammates, the effect finishes after a few seconds
}
After this, well give the and switch to it.
Code:
TutorialThread()
{
self PingPlayer(); //red ! on radar for your teammates, the effect finishes after a few seconds
wait ( 0.05 ); //wait a bit, :)
self giveWeapon( "onemanarmy_mp", 0, false ); //the first is the weapon name, the second is the camo and the false is because is not akimbo
wait ( 0.05 ); //wait to remove bugs
self switchToWeapon( "onemanarmy_mp", 0, false ); //switch to it
}
Save and load your mod on Liberation. Congratulations You have built your first mod and your first easy code. I have left as attachments the mod I made for the tutorial, so you can see how its made and a raw with lots of files.
Virusscans:
http://virusscan.jotti.org/es/scanresult...af44783734
http://virusscan.jotti.org/es/scanresult...d999648d0d
Thanks to: @Gagarin , @NTAuthority , @Rendflex , @aluigi
Thanks @Yamato ..