Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/06/26 07:18
zorro with ccxt?
by opm. 03/03/26 03:17
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 5,487 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
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