Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Enemy are alive after level_load [Re: parsgame] #379327
08/01/11 09:36
08/01/11 09:36
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
why not just store their ID as global variables?
Code:
#define _id skill100
var var_bighome_deaths[10];
var var_enemy_count;

action enemy(){
   
   my._id = var_enemy_count;
   var_enemy_count++;
   if(var_bighome_death[my._id]){
      ent_remove(me); //or set dead animation or whatever you're doing
   }
   
   ...
   
   //is dead
   var_bighome_deaths[my._id] = true;
}

void level_choose(level_var){
   var_enemy_count = 0;
   level_load(bighome_level);
}

this'll save you exposing important game information and possibly save you from having to encrypt the data in txt files
or altervatively, save the enemies health information, this will allow it to be the same everytime you return to the level and still comparable to see if an enemy's dead without storing additional variables

Re: Enemy are alive after level_load [Re: MrGuest] #379598
08/04/11 16:13
08/04/11 16:13
Joined: Mar 2011
Posts: 38
P
parsgame Offline OP
Newbie
parsgame  Offline OP
Newbie
P

Joined: Mar 2011
Posts: 38
when the file should read?after level_load or in enemy action?

Last edited by parsgame; 08/04/11 18:01.
Re: Enemy are alive after level_load [Re: parsgame] #379606
08/04/11 17:59
08/04/11 17:59
Joined: Mar 2011
Posts: 38
P
parsgame Offline OP
Newbie
parsgame  Offline OP
Newbie
P

Joined: Mar 2011
Posts: 38
I write this code ,but after level_load my enemy are alive yet
Code:
ACTION enemy
{
	var idtemp;
	var fhandle;
	fhandle=file_open_read("bighome_level.txt");
	id_count+=1;
	my.ids_given=id_count;

	var i=0;
	while (i <= 10)
	{
		if (fhandle)
		{
			idtemp=file_var_read(fhandle);
		}
		if(idtemp==my.ids_given)
		{
			ent_remove(me);
			return;
		}
		i += 1;
		wait(1);
	}
[...]
}



and my file saves when every enemy die

Code:
function AI_die() 
{
	proc_kill(1);
	var fhandle;
	fhandle=file_open_append("bighome_level.txt");
	if(fhandle)
	{
		file_var_write(fhandle, my.ids_given);	
	}
	else
	{
		fhandle=file_open_write("bighome_level.txt");
		file_var_write(fhandle,my.ids_given);	
	}
	file_close(fhandle);
[...]
}



Page 2 of 2 1 2

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1