Portal Challenge Script

From Valve Developer Community
Revision as of 12:41, 10 October 2007 by Gectou4 (talk | contribs) (Challenge scripting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

You have to got GCFScape first launch it and open portal.gcf on your steam account folders.

Extract the file : portal/scripts/challenges/challenges.bns

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 :

"#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"
		}
	}
}

Script Explained header

"#Bonus_Map_TC13Challenges"

it's a language tag, it's linked to the portal_<Steam_Language>.txt files on ressource folder of portal. You musn't have to edit this files. Put a sentence here than a tag (withdraw the # symbole).

"map"		"testchmb_a_08"

here is your map name. Replace testchmb_a_08 By your map name, without .bsp extension.


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

It's refer to a .cfg file on the portal/cfg folder.

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 prevent multinaming with other mapping members.

Your cfg have only one line :

map	your_map_name

Juste put your map name without the .bsp extension.

Now close your cfg. Come back to our script :

"image"		"bonusmaps/testchmb_a_08_challenges"

It's a picture on materials/VGUI/ 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.

"comment"	"#Bonus_Map_ChallengesComment"

A language tag about your challenge, describe your here.

"lock"		"1"

1 mean it's locked, 0 means it's unlocked

Script Explained Challenge type

Okay now you have to set your medal criteria. Three type challenge exist : Portal Step Time


Portal

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

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

The first line is a language tag. Same as "comment", this one is about max Portal challenge

The next line is the medal followed by the max number of portal required to earn the medal.

Step


"#Bonus_Map_ChallengeSteps"
		{
			"comment"	"#Bonus_Map_LeastStepsComment"

			"bronze"	"30"
			"silver"	"20"
			"gold"		"10"
		}

Same as before, but now it's about the max steps numbers to earn a medal.

Time

	
"#Bonus_Map_ChallengeTime"
		{
			"comment"	"#Bonus_Map_LeastTimeComment"

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

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 :

map map_name

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 Same as language file, you musn't have to edit the mod's files. Copy past the sample script, and replace the value by your challenges values.