3 registered members (Aku_Aku, 7th_zorro, Ayumi),
1,050
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
die engine is fies
#251925
02/15/09 16:32
02/15/09 16:32
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
Hallo
ich habe ein kleines Problem mit einer Variable. Der Code ist so einfach, der müsste ja eigentlich gut funktionieren; Tut er aber nicht. Die Engine stürzt ab. Hier ein Teil der Funktion, die sich auf das Problem beziehen könnte:
. . .
function panzerketten() { var hohe=20; var jumpen=0; . . . var aufbo=0; . . . panzket=me; while(1) { . . . aufbo=c_move(my,vector(0,0,-6*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS);
. . . if(key_b&&jumpen==0) jumpen=1; if(jumpen==1) { c_move(my,vector(0,0,hohe*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS); if(hohe>0) hohe-=0.5*time_step; if(hohe<18&&aufbo<0.2) { hohe=20; <-- Nehme ich diese Zeile weg funktioniert es jumpen=0; }} wait(1); } }
. . .
Hilf mir, dir zu helfen!
|
|
|
Re: die engine is fies
[Re: hopfel]
#251929
02/15/09 16:47
02/15/09 16:47
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Your problem description is not clear, but I dont read german... BUT aufbo=c_move(my,vector(0,0,-6*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS);
should be v(a bit) v(a LOT)
aufbo=c_move(my, vector(0,0,-6*time_step), nullvector, GLIDE|IGNORE_MODELS); AND each 'part' of an if should have brackets like so if(key_b&&jumpen==0)
should be
if((key_b)&&(jumpen==0))
and later on
if(hohe<18&&aufbo<0.2)
should be
if((hohe<18)&&(aufbo<0.2)) Otherwise odd things can happen.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: die engine is fies
[Re: hopfel]
#252216
02/17/09 07:10
02/17/09 07:10
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Good, you know english. Whats the actual problem? What is it doing/not doing? What "should" happen? And what happens then you put hohe=20; in?
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: die engine is fies
[Re: hopfel]
#252464
02/18/09 12:13
02/18/09 12:13
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK english is OK Nothing looks really bad, can you post the whole function? The problem may be in another part of it. And I know which bit the problem comes from now.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: die engine is fies
[Re: EvilSOB]
#252640
02/19/09 11:53
02/19/09 11:53
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
OP
User
|
OP
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
here's the whole code, that's easier(<-- right?).
#include <acknex.h> #include <default.c> #include "explosion.c"
ANGLE rohr_ang; ENTITY* kabumm; ENTITY* panz; ENTITY* panzket; ENTITY* rack; BMAP* rau="smoke.tga";
function effect_ra(PARTICLE *p) { var temp[3]; spark_randomize(temp, 4); vec_add (p.vel_x, temp); p.bmap = rau; p.flags |= (BRIGHT | MOVE | TRANSLUCENT); p.lifespan = spark_lifespan; p.size = 4 * ScaleFactor; p.event = spark_alphafade; } function pang() { media_tune(media_play("pistolenschuss.wav",NULL,100),0,60,0); } function pang2() { media_tune(media_play("pistolenschuss.wav",NULL,200),0,30,0); }
function rakete() { var bumm; rack=me; while(my) { bumm=c_move(my,vector(10*time_step,0,0),vector(0,0,0 ),IGNORE_MODELS); my.tilt-=0.5*time_step; effect(effect_ra, 2, my.x, normal); if(bumm<1) { effect(effect_flame, 100, my.x, normal); effect(effect_smoke, 50, my.x, normal); effect(effect_dust, 50, my.x, normal); pang2(); short i = 0; for(i; i<7; i++) { kabumm=ent_create("bullet.mdl", my.x, explo_spark); } ent_remove(my); } wait(1); }}
function panzerketten() { var hohe=20; var jumpen=0; var gschw=0; var aufbo=0; var feuer=0; var feuerhilfe=0; VECTOR* abroh; var fahren=0; var schuss=0; vec_set(abroh,nullvector); panzket=me; while(1) { vec_for_bone(abroh,panz,"bone3"); if(fahren<1) fahren=100; fahren-=gschw*time_step; ent_animate(my, "fahren", fahren, ANM_CYCLE); vec_set(camera.x,vector(-200,0,60)); vec_rotate(camera.x,vector(panz.pan,panz.tilt-30,panz.roll)); vec_add(camera.x,panz.x); vec_set(camera.pan,nullvector); ang_add(camera.pan,vector(panz.pan,panz.tilt-30,panz.roll)); vec_set(panz.pan,my.pan); vec_set(panz.x,my.x); my.pan+=2*(key_cul-key_cur)*time_step; c_move(my,vector(gschw*time_step,0,0),vector(0,0,0 ),GLIDE+IGNORE_MODELS); aufbo=c_move(my,vector(0,0,-6*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS); c_move(panz,vector(gschw*time_step,0,0),vector(0,0,0 ),GLIDE+IGNORE_MODELS); c_move(panz,vector(0,0,-6*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS); if(key_cuu&&gschw<4) gschw+=0.4*time_step; if(key_cud&&gschw>-4) gschw-=0.4*time_step; if(key_q&&rohr_ang.tilt<20&&feuer==0||feuer==1) rohr_ang.tilt+=3*time_step; if(key_a&&rohr_ang.tilt>-10&&feuer==0||feuer==1) rohr_ang.tilt-=3*time_step; ent_bonereset(panz,"bone2"); ent_bonerotate(panz,"bone2",rohr_ang); if(key_space&&feuer==0) feuer=1; if(feuer==1) { if(feuerhilfe==0) { rack=ent_create("rack.mdl", abroh, rakete); rack.tilt=rohr_ang.tilt; rack.pan=my.pan; effect(effect_flame, 100, abroh.x, normal); effect(effect_smoke, 50, abroh.x, normal); effect(effect_dust, 50, abroh.x, normal); pang(); short i = 0; for(i; i<7; i++) { kabumm=ent_create("bullet.mdl", abroh.x, explo_spark); } feuerhilfe=1; } if(schuss>0) ent_animate(panz, NULL,NULL, ANM_CYCLE); schuss+=6*time_step; if(schuss>0) ent_animate(panz, "schuss", schuss, ANM_ADD+ANM_CYCLE); if(schuss>100) { schuss=0; feuer=0;feuerhilfe=0; }} if(key_b&&jumpen==0) jumpen=1; if(jumpen==1) { c_move(my,vector(0,0,hohe*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS); c_move(panz,vector(0,0,hohe*time_step),vector(0,0,0 ),GLIDE+IGNORE_MODELS); if(hohe>0) hohe-=0.5*time_step; if(hohe<18&&aufbo<0.2) { jumpen=0; } } wait(1); }}
function main() { video_mode=8; video_screen=1; level_load ("menue.wmb"); wait(-2); panz=ent_create("panzer.mdl", vector(0, 0,0), NULL); panzket=ent_create("panzerketten2.mdl", vector(0, 0,0), panzerketten); //media_loop("musik.mp3",NULL,100); while (1) { wait(1); } }
Hilf mir, dir zu helfen!
|
|
|
Re: die engine is fies
[Re: hopfel]
#252657
02/19/09 13:40
02/19/09 13:40
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
AFTER I changed "VECTOR* abroh;" to be "VECTOR abroh;", then it works OK for me, with everything related to "explosion.c" disabled. (with hohe=20; both in and out)
If that doesnt help you, please post explosion.c also.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|