0 registered members (),
1,094
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
c_move crashed
#453218
07/12/15 18:56
07/12/15 18:56
|
Joined: Dec 2009
Posts: 16
NovaTech2010
OP
Newbie
|
OP
Newbie
Joined: Dec 2009
Posts: 16
|
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...
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 Thank you for helps and tips and stuff!
|
|
|
Re: c_move crashed
[Re: NovaTech2010]
#453219
07/12/15 19:04
07/12/15 19:04
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
My guess is the engine is to old... alginProjectil(me,you); - from where do you get your YOU pointer? Cause your 'c_move' has IGNORE_YOU. Greets
|
|
|
Re: c_move crashed
[Re: NovaTech2010]
#453224
07/12/15 19:33
07/12/15 19:33
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Raw example of 'c_move' with event:
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
|
|
|
Re: c_move crashed
[Re: 3run]
#453225
07/12/15 19:44
07/12/15 19:44
|
Joined: Dec 2009
Posts: 16
NovaTech2010
OP
Newbie
|
OP
Newbie
Joined: Dec 2009
Posts: 16
|
Thank you for help 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
|
|
|
Re: c_move crashed
[Re: NovaTech2010]
#453228
07/12/15 20:00
07/12/15 20:00
|
Joined: Dec 2009
Posts: 16
NovaTech2010
OP
Newbie
|
OP
Newbie
Joined: Dec 2009
Posts: 16
|
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.
Last edited by NovaTech2010; 07/12/15 20:02.
|
|
|
|