Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ent_remove crashes the engine..? #207859
05/22/08 18:49
05/22/08 18:49
Joined: Jul 2007
Posts: 24
N
noobie86 Offline OP
Newbie
noobie86  Offline OP
Newbie
N

Joined: Jul 2007
Posts: 24
hi i'm creating a game in which the player has a 'fireball' spell that is supposed to wreak havoc on enemies smile unfortunately the engine crashes as soon as the fireball hits something..

i'm using lite-c for programming.. here is the code for creation and subsequent removal of the fireball..

//code start
ent_create("fireball.mdl",my.x,glow_me);
// this function creates the fireball and glow_me moves it

action glow_me()
{
set(my,TRANSLUCENT);
set(my,BRIGHT);
my.alpha=80;

set(my,LIGHT);
my.lightrange=300;
my.red=255; my.blue=64; my.green=64;

you=player;
my.pan=your.pan;
my.tilt = camera.tilt+25;

firemovement[1]=-2*cos(my.pan); firemovement[0]=2*sin(my.pan); firemovement[2]=0.5*sin(my.tilt);
// this is due to some axis interchange i forgot to take care of.. x and y are interchanged

while(1)
{

move_mode = IGNORE_ME+IGNORE_YOU+IGNORE_PASSABLE;

ballc = ent_move(firemovement,vector(0,0,0)); //crash coming!!

if(ballc==0){ ent_remove(me); //crash here!!!}

wait(1);
}

}
// code end

this is supposed to remove the fireball as soon as 'ballc' goes to zero when the fireball collides with something. But it crashes the engine for some reason..

if i use something else inside the statement eg if(ballc==0){ my.scale_x=5;} this works fine.. how can i remove the fireball on collision? don wanna leave it there for the rest of the level smile

Last edited by noobie86; 05/22/08 18:56.
Re: ent_remove crashes the engine..? [Re: noobie86] #207864
05/22/08 19:03
05/22/08 19:03
Joined: Apr 2007
Posts: 582
Germany
Poison Offline
User
Poison  Offline
User

Joined: Apr 2007
Posts: 582
Germany
I just give you a tip:
Try to use ent_remove(); not in a while-loop, for example like this:

Code:
 
function blabla()
{
	...
	while(my.skill1 > 0)
	{
		my.skill1 -= 10 * time_step;
		wait(1);
	}
	ent_remove(my);
}



Everything is possible, just Do it!
Re: ent_remove crashes the engine..? [Re: Poison] #207865
05/22/08 19:08
05/22/08 19:08
Joined: Jul 2007
Posts: 24
N
noobie86 Offline OP
Newbie
noobie86  Offline OP
Newbie
N

Joined: Jul 2007
Posts: 24
hey it worked smile i put ent_remove outside the while loop and now it works fine.. i guess it crashed cause 'my' becomes an empty pointer if removed while inside a 'while' loop.. anyway back to roasting goblins smile

thanks Poison smile


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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