4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ERROR! ERROR! ERROR... good!
#338074
08/15/10 14:53
08/15/10 14:53
|
Joined: Dec 2009
Posts: 361
rtsgamer706
OP
Senior Member
|
OP
Senior Member
Joined: Dec 2009
Posts: 361
|
I am a programmer working with the free version of lite-c In my game I want it to be that when my enemies have a collision my game over entity appears, I am using the code below:
var g_over = 0;
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); ent_remove(ship); 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() { ship = me; c_setminmax(me); my.emask |= (ENABLE_ENTITY); // my.event = frag; while(my) { if (g_over == 1) { wait(1); ent_remove(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); } }
action invader_two() { ship = me; c_setminmax(me); my.emask |= (ENABLE_ENTITY); //my.event = frag; while(my) { if (g_over == 1) { wait(1); ent_remove(me); } my.pan += 0.7; c_move (my, vector(imiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action wait(1); } }
action invader_three() { ship = me; c_setminmax(me); my.emask |= (ENABLE_ENTITY); // my.event = frag; my.event = game_over; while(my) { if (g_over == 1) { wait(1); ent_remove(me); } my.pan += 0.7; c_move (my, vector(imiiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action wait(1); } }
When my invaders have a collision t_bod and t_gun disappear. Then I get: "Crash in invader_one" (the message pops up the amount of times equal to the remaining invaders running invader_one) "Crash in invader_two" (the message pops up the amount of times equal to the remaining invaders running invader_two) "Crash in invader_three" (the message pops up the amount of times equal to the remaining invaders running invader_three) The weird part is if I repeatedly press ok then its good! Please help rtsgamer706
|
|
|
Re: ERROR! ERROR! ERROR... good!
[Re: rtsgamer706]
#338077
08/15/10 15:37
08/15/10 15:37
|
Joined: May 2010
Posts: 48
Ich_bin_Batman
Newbie
|
Newbie
Joined: May 2010
Posts: 48
|
You removed them twice.
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); ent_remove(ship); ent_create("invader_over.mdl", vector (1000, 50, 20), NULL); //create lose frame } } action invader_one() { ship = me; c_setminmax(me); my.emask |= (ENABLE_ENTITY); // my.event = frag; while(my) { if (g_over == 1) { wait(1); ent_remove(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); } } Delete the first.
Last edited by Ich_bin_Batman; 08/15/10 15:37.
|
|
|
Re: ERROR! ERROR! ERROR... good!
[Re: rtsgamer706]
#338114
08/15/10 20:41
08/15/10 20:41
|
Joined: May 2010
Posts: 48
Ich_bin_Batman
Newbie
|
Newbie
Joined: May 2010
Posts: 48
|
Maybe with this code? var g_over = 0;
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); 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.emask |= (ENABLE_ENTITY); // my.event = frag; while(1) { if (g_over == 1) { wait(1); ent_remove(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); } }
action invader_two() { c_setminmax(me); my.emask |= (ENABLE_ENTITY); //my.event = frag; while(1) { if (g_over == 1) { wait(1); ent_remove(me); } my.pan += 0.7; c_move (my, vector(imiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action wait(1); } }
action invader_three() { c_setminmax(me); my.emask |= (ENABLE_ENTITY); // my.event = frag; my.event = game_over; while(1) { if (g_over == 1) { wait(1); ent_remove(me); } my.pan += 0.7; c_move (my, vector(imiiix, imiy, imiz), vector(imiax, imiay, imiaz), IGNORE_PASSABLE); // move the invader according to the ai action wait(1); } }
|
|
|
Re: ERROR! ERROR! ERROR... good!
[Re: rtsgamer706]
#338136
08/16/10 05:46
08/16/10 05:46
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
This one works (TESTED), when you are making multiply entities, and need pointers for them, better use defines, not var and ENTITY*. Look all code careful, if you'll have any questions, ask me dude, I'll be happy to help. Here you go bro:
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
#define g_over skill10
#define ship 1
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////
function game_over()
{
if(event_type == EVENT_IMPACT || event_type == EVENT_ENTITY)
{
wait(1);
//UNCOMMENT THIS IN YOUR SCRIPT
//ent_remove(t_bod);
//ent_remove(t_gun);
my.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.g_over = 0; // the game isn't over for me yet
my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
my.event = game_over;
while(my.g_over != 1)
{
my.pan += 0.7;
//UNCOMMENT THIS IN YOUR SCRIPT
//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.g_over = 0; // the game isn't over for me yet
my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
my.event = game_over;
while(my.g_over != 1)
{
my.pan += 0.7;
//UNCOMMENT THIS IN YOUR SCRIPT
//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.g_over = 0; // the game isn't over for me yet
my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
my.event = game_over;
while(my.g_over != 1)
{
my.pan += 0.7;
//UNCOMMENT THIS IN YOUR SCRIPT
//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
|