Continue Time

gabo-hanzo

Well-known member
Hi to everybody.
the regressive time can be increased in continues after the player dies?

Thank you and sorry for my english
 
Gabo Hanzo said:
Hi to everybody.
the regressive time can be increased in continues after the player dies?

Thank you and sorry for my english

Hi Gabo Hanzo
Yes, the continue timer can be increased after player dies. you need to change the game timer, like this:
Code:
changeopenborvariant("game_time", addTime); //CHANGE CONTINUE TIMER

If you want an example, I made a small code to use in your game. First, you will need two files, updated.c and timetick.c, both created at the folder "data/scripts"

Once you created these files, open your script.txt file in your main "data" folder and add the command "alwaysupdate 1". If you don't have this file, create one.

Open the file updated.c and copy the following code:
Code:
void main()
{//Draw custom continue counter
	float time = openborvariant("game_time");
	
	//LOAD BACKGROUND
	if(getlocalvar("background") == NULL()){
		void background = loadsprite("data/sprites/background.gif");
		setlocalvar("background", background);
	}
	
	//CONTINUE TIMER
	if(getglobalvar("continueCount") == 1){
		if(time <= 3960 && time > 0){
			setdrawmethod(NULL(),1,256,256,0,0,0,2);
			drawsprite(getlocalvar("background"), 0, 0, 1000000001);
			drawstring(169, 120, 7, "CONTINUE?", 1000000003);
			drawstring(233, 138, 7, time/400, 1000000003);
		}else{
			setglobalvar("continueCount", 0);
		}
	}
}

Note that you need to have a background image in your "sprites" folder. If you don't want it, simply remove all background lines and the drawmethod line (used if you want the background to be transparent). I'm using a gray empty image but it is up to you.

Now, open the timetick.c file and copy the following code:
Code:
void main()
{//Script to avoid engine "noshare" BUG that don´t give enough time to press start button and continue the game if the all players are dead
 //This bug happens only if "noshare" command is not present in "levels.txt". If it is present with flag 1, this bug not happens and the engine give you 10 seconds
	float addTime = 3960; //TIME TO BE ADDED IF ALL PLAYERS ARE DEAD BUT HAS CREDITS TO USE
	
	if(openborvariant("count_players") > 0){ //PLAYERS ARE IN THE SCREEN??
		if(getglobalvar("continueCount") != 0){
			setglobalvar("continueCount", 0); //DISABLE CONTINUE COUNTER
		}
	}
	
	if(openborvariant("count_players") <= 0){ //NO PLAYERS IN THE SCREEN??
		if(getplayerproperty(0, "credits") > 0){ //ALREADY HAVE CREDITS TO PLAY??
			if(getglobalvar("continueCount") != 1){ //CONTINUE SCREEN IS NOT BEING SHOWN??
				if(openborvariant("game_time") < addTime){ //CONTINUE COUNTER IS LESS THAN 10 SECONDS??
					changeopenborvariant("game_time", addTime); //CHANGE CONTINUE TIMER TO 10 SECONDS
					setglobalvar("continueCount", 1); //SET CONTINUE SCREEN FLAG TO 1
				}
			}
		}
	}
}

You can change the timer by increasing or decreasing the "addTime" value, change the position and check any condition before the timer is displayed, it is up to you. This is a basic example and I don't know if it will fit to your game, but please let me know if need more help
 
Kratus said:
Gabo Hanzo said:
Hi to everybody.
the regressive time can be increased in continues after the player dies?

Thank you and sorry for my english

Hi Gabo Hanzo
Yes, the continue timer can be increased after player dies. you need to change the game timer, like this:
Code:
changeopenborvariant("game_time", addTime); //CHANGE CONTINUE TIMER

If you want an example, I made a small code to use in your game. First, you will need two files, updated.c and timetick.c, both created at the folder "data/scripts"

Once you created these files, open your script.txt file in your main "data" folder and add the command "alwaysupdate 1". If you don't have this file, create one.

Open the file updated.c and copy the following code:
Code:
void main()
{//Draw custom continue counter
	float time = openborvariant("game_time");
	
	//LOAD BACKGROUND
	if(getlocalvar("background") == NULL()){
		void background = loadsprite("data/sprites/background.gif");
		setlocalvar("background", background);
	}
	
	//CONTINUE TIMER
	if(getglobalvar("continueCount") == 1){
		if(time <= 3960 && time > 0){
			setdrawmethod(NULL(),1,256,256,0,0,0,2);
			drawsprite(getlocalvar("background"), 0, 0, 1000000001);
			drawstring(169, 120, 7, "CONTINUE?", 1000000003);
			drawstring(233, 138, 7, time/400, 1000000003);
		}else{
			setglobalvar("continueCount", 0);
		}
	}
}

Note that you need to have a background image in your "sprites" folder. If you don't want it, simply remove all background lines and the drawmethod line (used if you want the background to be transparent). I'm using a gray empty image but it is up to you.

Now, open the timetick.c file and copy the following code:
Code:
void main()
{//Script to avoid engine "noshare" BUG that don´t give enough time to press start button and continue the game if the all players are dead
 //This bug happens only if "noshare" command is not present in "levels.txt". If it is present with flag 1, this bug not happens and the engine give you 10 seconds
	float addTime = 3960; //TIME TO BE ADDED IF ALL PLAYERS ARE DEAD BUT HAS CREDITS TO USE
	
	if(openborvariant("count_players") > 0){ //PLAYERS ARE IN THE SCREEN??
		if(getglobalvar("continueCount") != 0){
			setglobalvar("continueCount", 0); //DISABLE CONTINUE COUNTER
		}
	}
	
	if(openborvariant("count_players") <= 0){ //NO PLAYERS IN THE SCREEN??
		if(getplayerproperty(0, "credits") > 0){ //ALREADY HAVE CREDITS TO PLAY??
			if(getglobalvar("continueCount") != 1){ //CONTINUE SCREEN IS NOT BEING SHOWN??
				if(openborvariant("game_time") < addTime){ //CONTINUE COUNTER IS LESS THAN 10 SECONDS??
					changeopenborvariant("game_time", addTime); //CHANGE CONTINUE TIMER TO 10 SECONDS
					setglobalvar("continueCount", 1); //SET CONTINUE SCREEN FLAG TO 1
				}
			}
		}
	}
}

You can change the timer by increasing or decreasing the "addTime" value, change the position and check any condition before the timer is displayed, it is up to you. This is a basic example and I don't know if it will fit to your game, but please let me know if need more help
Thank you very much for the help
 
Back
Top Bottom