Portal Challenge Script: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Challenge scripting)
 
(major cleanup)
Line 1: Line 1:
How to make your own challenge with script
note:English may need to be more fluent.
Add a challenge isn't faire, that's suppose to edit a Portal files,
You can't add your files
==First Step==
==First Step==
You have to got [[GCFScape]] first
{{note|You will need to obtain [[GCFScape]] for this step.}}
launch it and open portal.gcf on your steam account folders.
* Launch GCFScape and open <tt>portal content.gcf</tt> in your SteamApps folder.
 
* Extract the file <tt>portal/scripts/challenges/challenges.bns</tt> and put it into <tt>Steam/SteamApps/your_account/portal/portal/scripts/challenges</tt>
Extract the file :
* Now, open the bns file with your favourite text editor.
portal/scripts/challenges/challenges.bns
==Inside the file==
 
* When you open the <tt>challenges.bns</tt> file you can see scripts similar to this one:
Put it in your steam/your_account/portal/portal/scripts/challenges/
 
Now open it with notepad, or your favorite text editor.
 
==Sample Script==
 
When you open the chalennges.bns file you can see this type of script :


<code><pre>"#Bonus_Map_TC13Challenges"
<code><pre>"#Bonus_Map_TC13Challenges"
Line 57: Line 43:
}
}
}</pre></code>
}</pre></code>
==Script Explained header==


<pre>"#Bonus_Map_TC13Challenges"</pre>
<pre>"#Bonus_Map_TC13Challenges"</pre>
it's a language tag, it's linked to the portal_<Steam_Language>.txt files on ressource folder of portal.
This piece of code denotes the name of the map. This is linked to the <tt>portal_yourlanguagehere.txt</tt> file in the game's resources folder. Note that this is language specific, and unless you plan to make your map multilingual, you can simply replace it with a string.
You musn't have to edit this files. Put a sentence here than a tag (withdraw the # symbole).


<pre>"map" "testchmb_a_08"</pre>
<pre>"map" "testchmb_a_08"</pre>
here is your map name. Replace ''testchmb_a_08'' By your map name, without .bsp extension.
This is the name of the map without the bsp extension, the one which you put in the game's maps folder.
 


<pre>"chapter" "chapter5.cfg" [$X360]</pre>
<pre>"chapter" "chapter5.cfg" [$X360]</pre>
It's refer to a .cfg file on the portal/cfg folder.
This line refers to the chapter the map belongs to. You can find these chapter files in your GCF file. Simply create a new chapter with any name and a cfg extension. Add a line for each map in your chapter in to the file in this format:  
 
<pre>map your_map_name</pre>
You have to make a cfg file (use notepad), I don't know at this time if you must keep "chapter" in the name, but try to make your own to
Now, put this cfg file into the <tt>steam\steamapps\your_account\portal\portal\cfg</tt> folder.
prevent multinaming with other mapping members.
 
Your cfg have only one line :
<pre>map your_map_name</pre>
Juste put your map name without the .bsp extension.
 
Now close your cfg.
Come back to our script :


<pre>"image" "bonusmaps/testchmb_a_08_challenges"</pre>
<pre>"image" "bonusmaps/testchmb_a_08_challenges"</pre>
It's a picture on materials/VGUI/
This is the thumbnail of the map, which is in fact a [[material]]. The root path for this is <tt>steam\steamapps\your_account\portal\portal\materials\VGUI</tt>.
that's call a .vmt file (tru to have your .vtf in the same folder to make it clean)
this picture is displayed in challenge panels to represent your challenge.
 
<pre>"comment" "#Bonus_Map_ChallengesComment"</pre>
A language tag about your challenge, describe your here.
 
<pre>"lock" "1"</pre>
1 mean it's locked, 0 means it's unlocked
 
==Script Explained Challenge type==


Okay now you have to set your medal criteria.  
<pre>"comment" "#Bonus_Map_ChallengesComment"</pre>
Three type challenge exist :
A language based description of your map. Again, unless you want to make the map multilingual, just replace it with a string.
Portal
Step
Time


<pre>"lock" "1"</pre>
A [[Boolean_datatype|boolean]] variable, which specifies if the map is locked or not until you complete the game.


'''Portal'''
==Challenge types==
You will also have to set the criteria of your map for
* Portals
* Steps
* Time


There are three similar sections at the end of each map. This one below is for portals. For steps or time, replace the "Portals" in each string with Steps or Time, accordingly.
<pre>
<pre>
"#Bonus_Map_ChallengePortals"
"#Bonus_Map_ChallengePortals"
Line 114: Line 82:
</pre>
</pre>


The first line is a language tag.
The first line, again, is a language-based string variable. You don't have to change it here.
Same as '''"comment"''', this one is about max Portal challenge
The following three lines specify the amount of Portals, Steps, or Time needed for each medal.
 
The next line is the medal followed by the max number of portal required to earn the medal.
 
'''Step'''
 
 
<pre>"#Bonus_Map_ChallengeSteps"
{
"comment" "#Bonus_Map_LeastStepsComment"
 
"bronze" "30"
"silver" "20"
"gold" "10"
}</pre>
Same as before, but now it's about the max steps numbers to earn a medal.
 
'''Time '''
 
<pre>
"#Bonus_Map_ChallengeTime"
{
"comment" "#Bonus_Map_LeastTimeComment"
 
"bronze" "40"
"silver" "30"
"gold" "19"
}
</pre>
The last challenge type define the max times (seconds) to earn a medal.
 
==Add your challenge==
 
 
1 - Make your maps
 
2 - Make your .cfg with this line :
<pre>map map_name</pre>
in portal/cfg
 
3 - Make your picture and put it in :
materials/VGUI/bonusmaps/ 


4 - Make a new .bns file in portal/script/challenges/ folder
==Adding your own challenge==
Same as language file, you musn't have to edit the mod's files.
Adding your own challenge is an easy, 3 to 4 step task.
Copy past the sample script, and replace the value by your challenges values.
* Make your map(s) and put them in <tt>Steam/SteamApps/your_account/portal/portal/maps</tt>
* Create a cfg file containing a line for each map which reads <tt>map map_name</tt> and put the file into the <tt>Steam/SteamApps/your_account/portal/portal/cfg</tt> directory.
* This is an optional step as you can reuse an old image, or create your own. If you created your own image, put it into the <tt>Steam/SteamApps/your_account/portal/portal/materials/VGUI</tt> directory or one of its subdirectories (recommended).
* Finally, create a new .bns file in the <tt>Steam/SteamApps/your_account/portal/portal/scripts/challenges</tt> folder and edit it with or without the help of this tutorial.

Revision as of 16:02, 13 October 2007

First Step

Note.pngNote:You will need to obtain GCFScape for this step.
  • Launch GCFScape and open portal content.gcf in your SteamApps folder.
  • Extract the file portal/scripts/challenges/challenges.bns and put it into Steam/SteamApps/your_account/portal/portal/scripts/challenges
  • Now, open the bns file with your favourite text editor.

Inside the file

  • When you open the challenges.bns file you can see scripts similar to this one:
"#Bonus_Map_TC13Challenges"
{
	"map"		"testchmb_a_08"
	"chapter"	"chapter5.cfg"	[$X360]
	"image"		"bonusmaps/testchmb_a_08_challenges"
	"comment"	"#Bonus_Map_ChallengesComment"
	"lock"		"1"

	"challenges"
	{
		"#Bonus_Map_ChallengePortals"
		{
			"comment"	"#Bonus_Map_LeastPortalsComment"

			"bronze"	"9"
			"silver"	"5"
			"gold"		"4"
		}
		"#Bonus_Map_ChallengeSteps"
		{
			"comment"	"#Bonus_Map_LeastStepsComment"

			"bronze"	"30"
			"silver"	"20"
			"gold"		"10"
		}
		"#Bonus_Map_ChallengeTime"
		{
			"comment"	"#Bonus_Map_LeastTimeComment"

			"bronze"	"40"
			"silver"	"30"
			"gold"		"19"
		}
	}
}
"#Bonus_Map_TC13Challenges"

This piece of code denotes the name of the map. This is linked to the portal_yourlanguagehere.txt file in the game's resources folder. Note that this is language specific, and unless you plan to make your map multilingual, you can simply replace it with a string.

"map"		"testchmb_a_08"

This is the name of the map without the bsp extension, the one which you put in the game's maps folder.

"chapter"	"chapter5.cfg"	[$X360]

This line refers to the chapter the map belongs to. You can find these chapter files in your GCF file. Simply create a new chapter with any name and a cfg extension. Add a line for each map in your chapter in to the file in this format:

map	your_map_name

Now, put this cfg file into the steam\steamapps\your_account\portal\portal\cfg folder.

"image"		"bonusmaps/testchmb_a_08_challenges"

This is the thumbnail of the map, which is in fact a material. The root path for this is steam\steamapps\your_account\portal\portal\materials\VGUI.

"comment"	"#Bonus_Map_ChallengesComment"

A language based description of your map. Again, unless you want to make the map multilingual, just replace it with a string.

"lock"		"1"

A boolean variable, which specifies if the map is locked or not until you complete the game.

Challenge types

You will also have to set the criteria of your map for

  • Portals
  • Steps
  • Time

There are three similar sections at the end of each map. This one below is for portals. For steps or time, replace the "Portals" in each string with Steps or Time, accordingly.

"#Bonus_Map_ChallengePortals"
		{
			"comment"	"#Bonus_Map_LeastPortalsComment"

			"bronze"	"9"
			"silver"	"5"
			"gold"		"4"
		}

The first line, again, is a language-based string variable. You don't have to change it here. The following three lines specify the amount of Portals, Steps, or Time needed for each medal.

Adding your own challenge

Adding your own challenge is an easy, 3 to 4 step task.

  • Make your map(s) and put them in Steam/SteamApps/your_account/portal/portal/maps
  • Create a cfg file containing a line for each map which reads map map_name and put the file into the Steam/SteamApps/your_account/portal/portal/cfg directory.
  • This is an optional step as you can reuse an old image, or create your own. If you created your own image, put it into the Steam/SteamApps/your_account/portal/portal/materials/VGUI directory or one of its subdirectories (recommended).
  • Finally, create a new .bns file in the Steam/SteamApps/your_account/portal/portal/scripts/challenges folder and edit it with or without the help of this tutorial.