c_move crashed

Posted By: NovaTech2010

c_move crashed - 07/12/15 18:56

Hoi ^^

I'm on script a shooter, now c_move is crashing the engine, although the code has already worked...
My guess is the engine is to old...

Code:
function bulletHit(){
/* Hit-Event */
}
function alginProjectil(ENTITY* bullet,ENTITY* weapon){
/* Algin bullets */
}

function shoot_bullet01(){
	var life=50;
	my.event=bulletHit;
	alginProjectil(me,you);
	ang_add(me.pan,vector(random(3)-1.5,random(3)-1.5,random(3)-1.5));
while(life>0){
		c_move(me,vector(0,-1000*time_step,0),nullvector,USE_POLYGON | IGNORE_YOU);//[color:#FF0000]<---Crash[/color]
		life-=1*time_step;
		wait(1);
	}
}



If i delete the c_move-row the game don't crash, but i need the c_move command smirk

Thank you for helps and tips and stuff!
Posted By: 3run

Re: c_move crashed - 07/12/15 19:04

Originally Posted By: NovaTech2010
My guess is the engine is to old...
grin

alginProjectil(me,you); - from where do you get your YOU pointer? Cause your 'c_move' has IGNORE_YOU.

Greets
Posted By: NovaTech2010

Re: c_move crashed - 07/12/15 19:09

The weapon ist the YOU-pointer, i have tryed NULL as flag, it isn't the crash reason.
c_move don't crash if the ENTITY of c_move isn't the 'me' ^^
Posted By: NovaTech2010

Re: c_move crashed - 07/12/15 19:14

P.S.: I have the A7 Extra Version xD
Posted By: 3run

Re: c_move crashed - 07/12/15 19:16

Better avoid using 'you' and pointers in general like that, that's caused the crash, I'm pretty sure. That pointer changed by many other functions.

Edit: use A8 free.
Posted By: NovaTech2010

Re: c_move crashed - 07/12/15 19:21

Thank you, yes maybe, but if i cancel alginProjectil(me,you); from the function, it crashes nevertheless smirk
Posted By: 3run

Re: c_move crashed - 07/12/15 19:33

Raw example of 'c_move' with event:
Code:
function hit_bullet(){

	if(event_type == EVENT_ENTITY){				
		my.skill1 = -1;		
	}
}

function shoot_bullet01(){
	
	var life = 50;
	
	my.emask |= ENABLE_ENTITY;
	my.event = hit_bullet;	
	
	my.skill1 = 1;
	
	wait(1);
	c_setminmax(my);
	
	while(my.skill1 > 0){
		
		c_move(me, vector(0, -1000 * time_step, 0), nullvector, USE_POLYGON | IGNORE_YOU);
		
		if(life <= 0){
			my.skill1 = -1;
		}
		life -= 1 * time_step;
		
		wait(1);
	}
	ent_remove(my);
}

void main()
{
	level_load("");
	
	vec_set(camera.x, vector(-301, 177, 13));
	vec_set(camera.pan, vector(302, -2, 0));
	
	
	ENTITY* testEnt = ent_create(CUBE_MDL, vector(0, -1000, 0), NULL);	
	vec_fill(testEnt.scale_x, 10);
	wait(1);
	c_setminmax(testEnt);
	set(testEnt, POLYGON);	
	
	while(1){
		
		ent_create(CUBE_MDL, nullvector, shoot_bullet01);
		
		wait(-1);
	}	
	
}

As you can see, it works :> So, it means that's you've messed up somewhere else.

Greets
Posted By: NovaTech2010

Re: c_move crashed - 07/12/15 19:44

Thank you for help grin
Looks legal but crashes as well :'/
It works if i cancel c_move row xd
I think it is simply the engine, soon i update the A7 Extra to A8 supermegapro and than this thingy maybe is fixed smirk
Posted By: EpsiloN

Re: c_move crashed - 07/12/15 20:00

Not sure about this, but try using NULLVECTOR instead of nullvector. I remember at some point there was a problem using lower-case nullvector in 3DGS... or maybe my memory is failing grin ... anyway, its 1 sec to try...
Posted By: NovaTech2010

Re: c_move crashed - 07/12/15 20:00

Iiiiiiiiiii have found the mysterious mistake!

ent_create(NULL,me.x,shoot_bullet01);

He can't move a NULL.
I apologize for stupidness and thank you so much.

EDIT: and please kill me and bury me.
© 2024 lite-C Forums