Unlocking chapters in your mod: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Tutorial finished being written)
mNo edit summary
Line 1: Line 1:
[[Category:Level Design]] [[Category:Tutorials]] [[Category:Programming]]This tutorial will demonstrate one way to unlock chapters for your game mods using entities. If you are unfamilair with adding chapters to your mod read and review the [[Adding chapters to your mod]] tutorial before this one.
[[Category:Level Design]] [[Category:Tutorials]] [[Category:Programming]]


== STEP 1: Create the trigger once brush ==
=VALVe Approach=
== Renaming ==
Your maps should be renamed to conform to a pattern
== Updating ==
In <code>gameinterface.cpp</code>, modify code>void UpdateChapterRestrictions( const char *mapname )</code> to conform to your maps' naming format.
=Map Hack Approach=
This tutorial will demonstrate one way to unlock chapters for your game mods using entities. If you are unfamilair with adding chapters to your mod read and review the [[Adding chapters to your mod]] tutorial before this one.
 
== Create the trigger once brush ==
Create a '''trigger_once''' brush in Map2. This will be used as the trigger that will begin the process of unlocking a chapter. Map2 is the map that will be considered the first map for the second chapter. Be sure to give the trigger_once brush a name, something like '''Trigger001_UnlockChapter2''' for example.
Create a '''trigger_once''' brush in Map2. This will be used as the trigger that will begin the process of unlocking a chapter. Map2 is the map that will be considered the first map for the second chapter. Be sure to give the trigger_once brush a name, something like '''Trigger001_UnlockChapter2''' for example.


== STEP 2: Create the point entities ==
== Create the point entities ==
Use the entity tool the create a '''logic_relay''' entity. Set the name of the logic_relay entity to '''Logic001_UnlockChapter2'''. Set the logic_relay '''Start Disabled''' property to Yes.
Use the entity tool the create a '''logic_relay''' entity. Set the name of the logic_relay entity to '''Logic001_UnlockChapter2'''. Set the logic_relay '''Start Disabled''' property to Yes.


Now use the entity tool to create a '''point_clientcommand''' entity, and set the name to '''UnlockChapter2'''.
Now use the entity tool to create a '''point_clientcommand''' entity, and set the name to '''UnlockChapter2'''.


== STEP 3: Add the outputs for the logic relay ==
== Add the outputs for the logic relay ==
Open the object properties dialog for the '''logic_relay''' entity we created earlier, and select the Outputs tab.
Open the object properties dialog for the '''logic_relay''' entity we created earlier, and select the Outputs tab.
Now add a output using the add button and fill in the info as it appears in the picture below...<br>
Now add a output using the add button and fill in the info as it appears in the picture below...<br>
[[Image:UnlockChapObjectProps.png]]
[[Image:UnlockChapObjectProps.png]]


== STEP 4: Add the outputs for the trigger_once brush entity ==
== Add the outputs for the trigger_once brush entity ==
Next open the object properties dialog box for the trigger_once entity we created earlier called '''Trigger001_UnlockChapter2''', and select the Outputs tab. Now add a output using the add button and fill in the info as it appears in the picture below...<br>
Next open the object properties dialog box for the trigger_once entity we created earlier called '''Trigger001_UnlockChapter2''', and select the Outputs tab. Now add a output using the add button and fill in the info as it appears in the picture below...<br>
[[Image:UnlockChapObjectProps2.png]]
[[Image:UnlockChapObjectProps2.png]]


== STEP 5: Testing ==
== Testing ==
Now save and compile your map. And run your mod. After your mod is loaded play the map and walk thru the invisible '''trigger_once''' entity. After you have walked through it press escape and select '''New Game''' from the game menu. You should that chapter 2 in your mod has been unlocked.  
Now save and compile your map. And run your mod. After your mod is loaded play the map and walk thru the invisible '''trigger_once''' entity. After you have walked through it press escape and select '''New Game''' from the game menu. You should that chapter 2 in your mod has been unlocked.  


After you quit the game open up the <code>yourmodfolder/cfg/config.cfg</code> file and scroll down near the botton of the file and you will notice that the line that used to read <code>sv_unlockedchapters "1"</code> now reads <code>sv_unlockedchapters "2".</code>
After you quit the game open up the <code>yourmodfolder/cfg/config.cfg</code> file and scroll down near the botton of the file and you will notice that the line that used to read <code>sv_unlockedchapters "1"</code> now reads <code>sv_unlockedchapters "2".</code>

Revision as of 18:58, 9 September 2005


VALVe Approach

Renaming

Your maps should be renamed to conform to a pattern

Updating

In gameinterface.cpp, modify code>void UpdateChapterRestrictions( const char *mapname ) to conform to your maps' naming format.

Map Hack Approach

This tutorial will demonstrate one way to unlock chapters for your game mods using entities. If you are unfamilair with adding chapters to your mod read and review the Adding chapters to your mod tutorial before this one.

Create the trigger once brush

Create a trigger_once brush in Map2. This will be used as the trigger that will begin the process of unlocking a chapter. Map2 is the map that will be considered the first map for the second chapter. Be sure to give the trigger_once brush a name, something like Trigger001_UnlockChapter2 for example.

Create the point entities

Use the entity tool the create a logic_relay entity. Set the name of the logic_relay entity to Logic001_UnlockChapter2. Set the logic_relay Start Disabled property to Yes.

Now use the entity tool to create a point_clientcommand entity, and set the name to UnlockChapter2.

Add the outputs for the logic relay

Open the object properties dialog for the logic_relay entity we created earlier, and select the Outputs tab. Now add a output using the add button and fill in the info as it appears in the picture below...
UnlockChapObjectProps.png

Add the outputs for the trigger_once brush entity

Next open the object properties dialog box for the trigger_once entity we created earlier called Trigger001_UnlockChapter2, and select the Outputs tab. Now add a output using the add button and fill in the info as it appears in the picture below...
UnlockChapObjectProps2.png

Testing

Now save and compile your map. And run your mod. After your mod is loaded play the map and walk thru the invisible trigger_once entity. After you have walked through it press escape and select New Game from the game menu. You should that chapter 2 in your mod has been unlocked.

After you quit the game open up the yourmodfolder/cfg/config.cfg file and scroll down near the botton of the file and you will notice that the line that used to read sv_unlockedchapters "1" now reads sv_unlockedchapters "2".