Mini-mod tutorial:fr

From Valve Developer Community
Jump to: navigation, search
English (en)français (fr)русский (ru)中文 (zh)
... Icon-Important.png
Info content.png
This page has not been fully translated.

You can help by finishing the translation.

Also, please make sure the article tries to comply with the alternate languages guide.

Half-Life 2 Créer votre propre mini-mod

D'accord, vous n'avez pas d'experience en C++ et aucune idée sur le fichiers cpp, mais vous n'avez pas à vous limiter au style d'Half-Life² sur vos maps solo.

Ce tutoriel va vous expliquer comment créer un fichierGFC et comment l'utilise dans votre map.

La première chose à savoir est que vous êtes seulement limité aux commandes que vous pouvez taper dans la console. Cela étant dit, il y a beaucoup de petites choses que vous pouvez faire pour rendre votre map différente des autres.

Par exemple, vous pouvez changer la distance à laquelle le gravity gun peut envoyer des objets, vous pouvez changer la quantité de munitions qu'une arme peut garder, activer la collision avec des corps, ou modifier les dommages qu'une arme peut faire. Tout ce que vous pouvez faire avec la console. Commencez à regarder ces commandes (les sites de codes triche peuvent convenir).

Premièrement

Ouvrez le bloc-notes.

Maintenant pour tout ce qui va se passer dans votre map, vous aurez à le taper dans la console. Dans notre cas nous lirons 2 lignes:

sv_cheats 1

bind "tab" "incrementvar host_timescale 0.25 1 0.75; incrementvar mat_yuv 0 1 1"

That's the command to bind that action to the 'tab' key. It will act like bullet time and switch on/off. Try not to bind anything that is already used like 'e' or 'z.' That would be a silly thing to do.

To string commands together use the ; character.

If there is any thing else particular to your map that you want to add do that too. Mine looks like this:

sv_cheats 1

bind "tab" "incrementvar host_timescale 0.25 1 0.75; incrementvar mat_yuv 0 1 1"

cl_ragdoll_collide 1

sk_max_ar2_altfire 10

When you go to save, make sure you have "all files" selected in the 'save as type' drop down, and save it as X.cfg (where X is the name you want it to be) in the following directory:

\steam\SteamApps\[user name]\half-life 2\hl2\cfg

Créer une map

Ajoutez un logic_auto dans votre map. Maintenant ajoutez un point_clientcommand à coté du logic_auto, et nommez-le "console".

Ensuite, dans les Outputs du logic_auto, créez un output comme celui-ci:

Output: OnMapSpawn

Target entites named: console

Via this input: Command

With a parameter override of: exec VOTREFICHIERCFG

Cela chargera et exécutera le fichier de commandes CFG quand vitre map ce chargera, comme si vous aviez tapé les lignes du CFG dans la console.

That's it.. all your changes should be loaded for your player. For added professionalism you could add some game_text entities with little messages like "'tab' bullet time on/off" So your player knows about the new button changes.

Distribution

All you have to do is make sure you add the cfg file to your map folder containing your bsp files and stuff. And make sure you give instructions on moving it to the cfg folder.

Uninstall

Because the bind command is actually binding commands to a key, even without the cfg file in your HL2 directory those commands will be kept.

Make a new cfg file called uninstallyourmapname.cfg And make sure all the key you binded are removed i.e:

bind "tab" ""

That will remove that binding in my example. Distribute this file with you map, and write instructions on performing the uninstall.

Downside

The downside is, your commands will stay loaded even when the player stops playing your map and plays another one like an official HL2 map, or even quits HL2. So use the uninstall method to clean things up.

Alternativement

Alternativement, vous pouvez simplement créer un point_clientcommand. Et dans les Outputs d'un objet, ajouter un output comme ceci:

Via this input: Command

With a parameter override of: COMMANDE Différence: Vous n'avez pas à créer de fichier CFG, vous avez simplement à créer un output pour chaque commande.