Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Martin_HH, TipmyPip), 1,279 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: ERROR! ERROR! ERROR... good! [Re: rtsgamer706] #338173
08/16/10 12:32
08/16/10 12:32
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
i'm unsure why you have seperate actions for each invader?

give each invader the same action and store each invader in an array
Code:
int int_invaderCount;
ENTITY* ent_invader[3]; //change 3 to max invaders as required

function game_over()
{
	if((event_type == EVENT_IMPACT) || (event_type == EVENT_ENTITY))
	{
		wait(1);
		g_over = 1;
		ent_remove(t_bod);
		ent_remove(t_gun);
		
		int i;
		for(i = 0; i < int_invaderCount; i++){
			ent_remove(ent_invader[i]);
			ent_invader[i] = NULL;
		}
		ent_create("invader_over.mdl", vector (1000, 50, 20), NULL); //create lose frame
	}
}

action invader_attack()
{
	var attack = 0;
	set(my, PASSABLE);
	while(my)
	{
		wait(-1);
	}
}

action invader_move()
{
	ent_invader[int_invaderCount] = me; //store each invader
	c_setminmax(me);
	my.event = game_over;
	my.emask |= ENABLE_ENTITY;
	
	int_invaderCount++;
	while(me)
	{
		my.pan += 0.7;
		c_move (my, vector(imix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
		wait(1);
	}
}

hope this helps
*untested*

Re: ERROR! ERROR! ERROR... good! [Re: MrGuest] #338213
08/16/10 16:43
08/16/10 16:43
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
OK, that is so easy, I just misunderstood you bro, just use var instead of the define, I thought you were trying to separate them, here is what you need:
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

var g_over;

////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

#define ship 1

////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

function game_over()
{
	if(event_type == EVENT_IMPACT || event_type == EVENT_ENTITY)
	{
		wait(1);
		ent_remove(t_bod);
		ent_remove(t_gun);
		g_over = 1;
		ent_create("invader_over.mdl", vector (1000, 50, 20), NULL); //create lose frame
	}
}

action invader_attack()
{
	var attack = 0;
	set(my, PASSABLE);
	while(my)
	{
		wait(-1);
	}
}

action invader_one()
{
	c_setminmax(me);
	my.skill47 = ship; // I'm the ship
	my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
	my.event = game_over;
	while(g_over != 1)
	{
		my.pan += 0.7;
		c_move (my, vector(imix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
		wait(1);
	}
	ent_remove(me);
}

action invader_two()
{
	c_setminmax(me);
	my.skill47 = ship; // I'm the ship
	my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
	my.event = game_over;
	while(g_over != 1)
	{
		my.pan += 0.7;
		c_move (my, vector(imix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
		wait(1);
	}
	ent_remove(me);
}

action invader_three()
{
	c_setminmax(me);
	my.skill47 = ship; // I'm the ship
	my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
	my.event = game_over;
	while(g_over != 1)
	{
		my.pan += 0.7;
		c_move (my, vector(imix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action
		wait(1);
	}
	ent_remove(me);
}




Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Page 2 of 2 1 2

Gamestudio download | chip programmers | 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