Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/26/26 12:17
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Grant, TipmyPip), 5,560 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
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 | 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