Pt/My First Mod: Difference between revisions
NunoRamiro (talk | contribs) No edit summary |
NunoRamiro (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{translationupdate}} | |||
{{Language:pt}} | |||
== Introdução == | == Introdução == | ||
Revision as of 12:04, 5 June 2008
Template:Translationupdate Template:Language:pt
Introdução
Este tutorial vai-lhe ensinar como criar, configurar e compilar a sua primeira versão simples de um MOD HL2. Neste MOD iremos mudar a velocidade na qual o foguete do Half-Life 2 viaja no mundo.
Criar o projecto do MOD
Para propósito deste tutorial nós vamos chamar ao nosso primeiro MOD, "MyMod". Quando criar o seu próprio MOD este pode ser o nome que quiser (i.e., "QuickMod", "TreasureTroll", etc.)
Por favor note que de modo a obter a última versão do código tem de refresh the SDK content.
Para criar um projecto do MOD:
- Abra a aplicação Source SDK no menu Tools do Steam.
- Abra o Create A Mod no grupo Utilities.
- Selecione ou Modify Half-Life 2 Single Player ou Modify Half-Life 2 Multiplayer
- Especifique onde quer que o seu projecto do MOD seja gravado (i.e.
C:\MyMod
). - Escolha o nome do seu MOD. Neste exemplo iremos utilizar "MyMod".
- O Vista pode necessitar de passos extra, dependendo das suas políticas de segurança. (veja os problemas conhecidos em baixo)
A aplicação do steam irá então copiar todos os ficheiros relevantes para a directoria destino que especificou. Agora já possui uma cópia do código do Half-Life 2 no destino que escolheu e que pode modificar.
Abra a solução do seu MOD
- Abra a sua cópia do Microsoft Visual Studio, o código foi desenhado originalmente para funcionar no 2003, mas foi rectificado de forma a funcionar noutras versões. No caso de possuir uma versão diferente do 2003 existem guias disponíveis para Compiling under VS2002 , Compiling under VS2005 e Compiling under VS2008
- Selecione File->Open Solution no menu e abra a solução Game_HL2-2003.sln ou Game_HL2-2005.sln que está localizada na directoria
src
do seu MOD, selecione a correspondente à sua versão do Microsoft Visual Studio. Note que a porção "HL2" vai corresponder à selecção efectuada no passo em que criou o seu MOD. Se selecionou mod from scratch, "Scratch" aparecerá.
Alterar a velocidade do foguete
Se está a editar o Half-life em modo jogador único, abra o hl2_dll/weapon_rpg.cpp
. Caso contrário, abra o hl2mp_dll/weapon_rpg.cpp
.
Nota: Se não encontrar o ficheiro, tente procurar na pasta server_hl2 > Source Files > HL2 DLL na janela do Solution Explorer no Microsoft Visual Studio.
No topo do ficheiro vai encontrar a linha:
#define RPG_SPEED 1500
Mude-a para:
#define RPG_SPEED 400
Ao alterar este número, nós dissemos ao foguete para viajar a 400 unidades por segundo (ou por volta de 33 pés por segundo, ou 10 metros por segundo). Anteriormente o foguete viajava a 1500 unidades por segundo (125 ft/s, 38m/s). A diferença na velocidade será bastante notada quando compilarmos e corrermos o MOD.
Altere a configuração
Nós necessitaremos de alterar a nossa configuration para "Release HL2".
Para fazer isto:
- Selecione Build->Configuration Manager.
- Altere a lista de drop-down Active Solution Configuration para "Release HL2"
- Selecione Close.
Para os utilizadores do Visual Studio 2005:
- Selecione Project -> Properties (A última entrada no menu)
- Selecione Configuration Manager (O botão do topo direito)
- Altere a lista de drop-down Active Solution Configuration para "Release"
Compilando o projecto
Now we are ready to build the solution. Choose Build->Build Solution to begin. When the requested compilation has completed there will be a server.dll
and client.dll
file in the MyMod/bin
directory (i.e. C:\MyMod\MyMod\Bin)
. This is the custom server and client DLL for our MOD and is one of the pieces that would be distributed to end-users.
Run the MOD
Now before you launch it's important to ensure you have something to launch. By default, new mods will use the 215 appid. This loads the Source SDK Base. This is not a bad thing; in fact, it's the best version of the engine available. The only problem it does have is that it has no game specific content. Global resources like textures and models available to all games will be present; however, levels will not be. You will either need to change the appid to use different game engines and load content from that game, or instead copy content out of that game into your mod. GCFScape can allow you to copy that content into your mod, but this content cannot be legally redistributed with your mod. The other approach is simply finding your .../steamapps/sourcemods/MyMod/gameinfo.txt
and changing the value to 220 for single player and 320 for multiplayer, although it's advisable to change it back to 215 later.
In the directory that you created your MOD, there will be a batch file called run_mod.bat
. Don't use the bat file to launch your mod, as it has not been updated for the SDK Base. The best way to launch your mod is to restart Steam and launch it from your Games list (where it should hopefully have appeared) or via the debugging option in vis (read how to debug the source code).
Now that there's content to load, start the game up. When the engine has loaded, you'll be taken to the title screen. If you are warned about missing content, such as maplist.txt
, ignore it.
In "Options", "Keyboard", and "Advanced", enable the Developer Console. Hit the tilde key (~) to bring up the Developer Console. This console will provide you with numerous tools to help you create content for the Source engine.
No maps are provided with your single player mod, so copy a map from the HL2 maps with GCFScape to your mod's /maps/ directory inside of SteamApps/SourceMods. Load a map by typing "map " (including the space) into the console and select from the list (e.g. "map d1_canals_01
") then type "impulse 101
" to give yourself a load of weapons.

sv_cheats 1
" na consola (~) e execute o comando "impulse 101
"Selecione e dispare o RPG para ver as alterações efectuadas.
Voce compilou o seu primeiro MOD
Voce configurou e compilou o seu primeiro MOD.
- See Category:Modding for articles to help you add more features to your MOD.
- See Category:Programming for a listing of programmer-specific documentation.
- See Category:Level_Design for articles on populating your mod with levels.
- See Category:Modeling for articles to help you add models to your MOD.
Template:Otherlang:en Template:Otherlang:en:de, Template:Otherlang:en:pl, Template:Otherlang:en:ru, Template:Otherlang:en:pt