Unlocking chapters in your mod: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (fixed code tags)
Line 5: Line 5:
Your maps should be renamed to conform to a pattern
Your maps should be renamed to conform to a pattern
== Updating ==
== Updating ==
In <code>gameinterface.cpp</code>, modify code>void UpdateChapterRestrictions( const char *mapname )</code> to conform to your maps' naming format.
In <code>gameinterface.cpp</code>, modify <code>void UpdateChapterRestrictions( const char *mapname )</code> to conform to your maps' naming format.
 
=Map Hack Approach=
=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.
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.

Revision as of 11:10, 10 September 2005


VALVe Approach

Renaming

Your maps should be renamed to conform to a pattern

Updating

In gameinterface.cpp, modify 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".