This tutorial will show you how to make limited cheat codes (a cheat code that will stop working if you put it in too many times).
Simply create the events and add the GML codes in the events. Put this in a "main" object. (If you don't know. A main is an object that has no sprite. Its only purpose is to set variable to complete a task in a room.)
Create Event
global.code1=0;
global.code2=0;
global.code3=0;
//this sets our limiting variables so that nobody goes past the limit
Any Key Press Event or something else
global.code=get_string("Please enter code","");
//asks the player to enter a code
{{
if (global.code="hey" && global.code1 < 3)
//if the person enters hey as the code and our limit var is less than 3
{
lives+=2;
//add two lives
sound_play(good_code);
//play a sound
global.code1+=1;
//raise the limit
}
else
if (global.code="ok" && global.code2 < 1)
//if the person enters ok as the code and our limit var is less than 1
{
health=100;
//set our health to 100
sound_play(good_code);
//play a sound
global.code2+=1;
//raise the limit
}
else
if (global.code="score" && global.code3 < 5)
//if the person enters score as the code and our limit var is less than 5
{
score+=50;
//add 50 points to the score
sound_play(good_code);
//play a sound
global.code3+=1;
//raise the limit
}
else
{
show_message("Too Bad")
//if the player did not enter any of the above codes show a message that says Too Bad
}}}
If you have any questions please post them below and I don't ask for any credit for this. Also, I hope you come up with better cheat codes than I did!
