0 votes
by (8.9k points)

In my game I'd like to unlock all the weapons for players who enter the cheat code idkfa.

Unlocking the weapons in the game is easy enough with an IF statement:

<<if $idkfa == true>>
  <<set $playerHasChainsaw to true>>
  <<set $playerHasPistol to true>>
  <<set $playerHasShotgun to true>>
  <<set $playerHasChaingun to true>>
  <<set $playerHasRocketLauncher to true>>
  <<set $playerHasPlasmaGun to true>>
  <<set $playerHasBFG9000 to true>>
<</if>>

But what's the best way to actually set $idkfa to true?  My ideal method would be:

  • Obscure to casual players, so they're not aware of a text box designed to receive cheat codes
  • Able to report to the player, perhaps via a dialogue box, that they'd entered the cheat code successfully

1 Answer

+1 vote
by (23.6k points)
selected by
 
Best answer

You could hide your cheat input on a screen where the player would naturally type something into a textbox. If you for example start off your game by allowing your players to name their character you could do something like this:

<<set $name to "John Smith">>
<<set $idkfa to false>>

<span id = "test">Enter your name:</span>
<<textbox "$name" $name autofocus>>

<<button "Continue">>
	<<nobr>>
	<<if $name == "">>
		<<replace "#test">><span style="color:red">Enter a name before proceeding:</span><</replace>>
	<<elseif $name == "supersecretpassword"  and not $idkfa>>
		<<prepend "#test">><span style="color:red">Super Secret Cheat unlocked! </span><</prepend>>
		<<set $idkfa to true>>
	<<else>>
		<<goto "Intro">>
	<</if>>
	<</nobr>>
<</button>>

 

by (8.9k points)
That works perfectly, thanks :-)
...