Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (ozgur, Ayumi, VHX, monarch), 1,161 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ERROR! ERROR! ERROR... good! #338074
08/15/10 14:53
08/15/10 14:53
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

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] #338075
08/15/10 14:59
08/15/10 14:59
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg

ship = me;

in all actions. but this is only ONE pointer, you can only assign one entity

Re: ERROR! ERROR! ERROR... good! [Re: Rei_Ayanami] #338076
08/15/10 15:17
08/15/10 15:17
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
i got rid of those lines but nothing changed.
thanks anyway though.

Re: ERROR! ERROR! ERROR... good! [Re: rtsgamer706] #338077
08/15/10 15:37
08/15/10 15:37
Joined: May 2010
Posts: 48
I
Ich_bin_Batman Offline
Newbie
Ich_bin_Batman  Offline
Newbie
I

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: Ich_bin_Batman] #338078
08/15/10 15:38
08/15/10 15:38
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
if(event_type == EVENT_IMPACT | event_type == EVENT_ENTITY)

is wrong also:

if((event_type == EVENT_IMPACT) || (event_type == EVENT_ENTITY))

Re: ERROR! ERROR! ERROR... good! [Re: Rei_Ayanami] #338105
08/15/10 19:20
08/15/10 19:20
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Again, thanks but still no change.

Re: ERROR! ERROR! ERROR... good! [Re: rtsgamer706] #338114
08/15/10 20:41
08/15/10 20:41
Joined: May 2010
Posts: 48
I
Ich_bin_Batman Offline
Newbie
Ich_bin_Batman  Offline
Newbie
I

Joined: May 2010
Posts: 48
Maybe with this code?

Click to reveal..
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: Ich_bin_Batman] #338118
08/15/10 21:38
08/15/10 21:38
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Thanks but still no change
(I have to say I can't find a single difference between your code and mine though)

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 Offline
Senior Expert
3run  Offline
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:
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////

#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);
}




Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: ERROR! ERROR! ERROR... good! [Re: 3run] #338171
08/16/10 11:59
08/16/10 11:59
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Thanks for the effort but not so much.
you see what I want is when one invader touches the ground they all disappear as well as the tank.
Then my game over entity appears.
In your code only the invader that had a collision disappeared, the tank didn't and game over did not appear.
Thanks anyway though.
Any more suggestions?

Page 1 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