http://alteriw.net/viewtopic.php?f=79&t=15145外国论坛原创教程,照翻一下转发就成原创心得的了
Making your very first mod!
by iNuke » Wed Sep 01, 2010 3:36 am
If you reading this your probably very new to mods and are very interested to make one, well ill explain the basics here and explain you how to get your very first mod running.
Before we start, we will need to make sure we have some software installed.
I recommend (from experience) using Notepad ++, its a very good and user friendly text editor, and its free!
You can find it here: http://notepad-plus-plus.org/download
-
Install it and lets move on!
Now you should make sure you have either WinRar or 7Zip installed.
(Since im familiar with WinRar, i will be using that)
You can find WinRar at http://rarlab.com
-
As last you should have FFviewer (its not required to make mods, but i HIGHLY recommend downloading it if your new to modding, it lets you pretty much view every stock .gsc script in MW2, which you can learn alot from! )
You can find FFviewer here: (Please note that this an outdated version, but FFviewer has a build in auto-updater)
http://dev-il.com/xbox/ffViewer.zip
Now that we have all software, lets make our very first mod!
First off all find a stock _rank.gsc on the internet, or if you installed FFviewer before, we can easily grab it from our game.
Open FFviewer and open common_mp.ff with it. (This file can be found in MW2FOLDER/zone/english )
Now give FFviewer a few seconds to load, when its done, you should be able to see the _rank.gsc file on your left.
Right click it and click export.
Now you can close FFviewer and you should browse to the _rank.gsc we just exported.
Open it with the Notepad++ we installed before.
-
Now you will see alot of code which probably makes your brain hurt,
but dont worry, once you get it, its so easy!
Now lets write our very first block of code.
Beneath the references (that are the #include........ 's)
Add the folowing code:
DoStuff()
{
self takeAllWeapons();
self giveWeapon("deserteaglegold_mp", 0, false );
self giveMaxAmmo("deserteaglegold_mp");
self _clearPerks();
self maps\mp\perks\_perks::givePerk("specialty_fastreload");
}
Now after seeing that piece of code, you might feeling like taking a revolver and blowing your brains out, but its not as hard as it seems.
Let me explain each part of the code.
First we have DoStuff(), thats the name of our function.
Now we have a bracket '{', brackets ALWAYS come in a pair, so for each '{' there MUST be a '}'
So we get:
DoStuff()
{
}
Now, our 'main code' is located between our backets, this tells the game to execute that code.
So lets review it,
First we have:
self takeAllWeapons();
This explains itself i think, but if you don't understand it, it takes ALL the weapons from the player.
You probably also saw i ended with a semicolon ';' , you must ALWAYS end your lines with a semicolon! , if you don't you will just end up with a syntax error!
Next:
self giveWeapon("deserteaglegold_mp", 0, false );
self giveMaxAmmo("deserteaglegold_mp");
This will give the player a golden desert eagle, and give the maximum ammo for it.
Now we have:
self _clearPerks();
This will take all of the players perks away.
And as last:
self maps\mp\perks\_perks::givePerk("specialty_fastreload");
This gives the player the Seight of Hand perk ( fast reload ).
and then we end it with a bracket '}'
Congratulations! You've just written your first block of code, and actualy understand what it does!
Now, if we load our mod in MW2, it wouldn't work.
Because we haven't called the function we just wrote anywhere. (calling a function means telling MW2 to execute the code you wrote)
In this case, we should call our code when the player has spawned.
So go ahaid and search for:
onPlayerSpawned()
{
}
and add between the brackets:
self thread DoStuff();
This will tell MW2 to execute the function we just wrote!
Save the file, and your done!
Yep it was that easy!
Now if you want to load your mod, look at this topic on how to do so:
http://alteriw.net/viewtopic.php?f=72&t=8334
Ill continue with this tutorial later, this is all for now. Have fun modding! {:3_166:}
http://alteriw.net/viewtopic.php?f=79&t=15145
If you reading this your probably very new to mods and are very interested to make one, well ill explain the basics here and explain you how to get your very first mod running.
Before we start, we will need to make sure we have some software installed.
I recommend (from experience) using Notepad ++, its a very good and user friendly text editor, and its free!
You can find it here: http://notepad-plus-plus.org/download
-
Install it and lets move on!
Now you should make sure you have either WinRar or 7Zip installed.
(Since im familiar with WinRar, i will be using that)
You can find WinRar at http://rarlab.com
-
As last you should have FFviewer (its not required to make mods, but i HIGHLY recommend downloading it if your new to modding, it lets you pretty much view every stock .gsc script in MW2, which you can learn alot from! )
You can find FFviewer here: (Please note that this an outdated version, but FFviewer has a build in auto-updater)
http://dev-il.com/xbox/ffViewer.zip
Now that we have all software, lets make our very first mod!
First off all find a stock _rank.gsc on the internet, or if you installed FFviewer before, we can easily grab it from our game.
Open FFviewer and open common_mp.ff with it. (This file can be found in MW2FOLDER/zone/english )
Now give FFviewer a few seconds to load, when its done, you should be able to see the _rank.gsc file on your left.
Right click it and click export.
Now you can close FFviewer and you should browse to the _rank.gsc we just exported.
Open it with the Notepad++ we installed before.
-
Now you will see alot of code which probably makes your brain hurt,
but dont worry, once you get it, its so easy!
Now lets write our very first block of code.
Beneath the references (that are the #include........ 's)
Add the folowing code:
DoStuff()
{
self takeAllWeapons();
self giveWeapon("deserteaglegold_mp", 0, false );
self giveMaxAmmo("deserteaglegold_mp");
self _clearPerks();
self maps\mp\perks\_perks::givePerk("specialty_fastreload");
}
Now after seeing that piece of code, you might feeling like taking a revolver and blowing your brains out, but its not as hard as it seems.
Let me explain each part of the code.
First we have DoStuff(), thats the name of our function.
Now we have a bracket '{', brackets ALWAYS come in a pair, so for each '{' there MUST be a '}'
So we get:
DoStuff()
{
}
Now, our 'main code' is located between our backets, this tells the game to execute that code.
So lets review it,
First we have:
self takeAllWeapons();
This explains itself i think, but if you don't understand it, it takes ALL the weapons from the player.
You probably also saw i ended with a semicolon ';' , you must ALWAYS end your lines with a semicolon! , if you don't you will just end up with a syntax error!
Next:
self giveWeapon("deserteaglegold_mp", 0, false );
self giveMaxAmmo("deserteaglegold_mp");
This will give the player a golden desert eagle, and give the maximum ammo for it.
Now we have:
self _clearPerks();
This will take all of the players perks away.
And as last:
self maps\mp\perks\_perks::givePerk("specialty_fastreload");
This gives the player the Seight of Hand perk ( fast reload ).
and then we end it with a bracket '}'
Congratulations! You've just written your first block of code, and actualy understand what it does!
Now, if we load our mod in MW2, it wouldn't work.
Because we haven't called the function we just wrote anywhere. (calling a function means telling MW2 to execute the code you wrote)
In this case, we should call our code when the player has spawned.
So go ahaid and search for:
onPlayerSpawned()
{
}
and add between the brackets:
self thread DoStuff();
This will tell MW2 to execute the function we just wrote!
Save the file, and your done!
Yep it was that easy!
Now if you want to load your mod, look at this topic on how to do so:
http://alteriw.net/viewtopic.php?f=72&t=8334
Ill continue with this tutorial later, this is all for now. Have fun modding! 支持,等下试试看 来学习………… 强人技术贴,不得不顶 支持支持支持 啊我改写了rsev10的bot 仅仅加入了bot趴下动作和更改速度 其他最主要的行走无法解决:@ 不能下载了 楼主还在吗
妹子的技术贴
页:
1
[2]