2 registered members (Martin_HH, TipmyPip),
1,279
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
MrGuest
Serious User
|
Serious User
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
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
Senior Expert
|
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:
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
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);
}
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|