Crash in... canīt fix it..

Posted By: Espér

Crash in... canīt fix it.. - 07/29/08 00:11

ok..
this is the action:
Code:
action titelheld()
{
	Titel_ent = my;
	my.x = 0;
	my.y = 11280;
	my.z = 0;
	my.pan = 90;
}


It just sais, "Crash in Titelheld()"

Any idea whatīs wrong??
Posted By: croman

Re: Crash in... canīt fix it.. - 07/29/08 08:55

Code:
action titelheld()
{
        wait(3); // in some cases i needed to put that
	Titel_ent = my;
	my.x = 0;
	my.y = 11280;
	my.z = 0;
	my.pan = 90;
}

Posted By: Espér

Re: Crash in... canīt fix it.. - 07/29/08 11:19

No.. donīt work...

Hereīs the complete code..
perhaps it causes somewhere else..:
Click to reveal..

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include "shader.c"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var speed = 1;
var numbers = 0;
var prozentgeber = 1.0;
var intro_part_1_ende = 0;
var remover = 0;

ENTITY* Titel_ent;
ENTITY* schrift;
ENTITY* schrift2;
ENTITY* schrift3;
ENTITY* starry;

BMAP* titeltextstring = "leer.tga";

PANEL* titeltextpan =
{
	pos_x = 0;
	pos_y = 680;
	layer = 100;
	bmap = titeltextstring;
	flags = VISIBLE;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

action titelheld()
{
	wait(3);
	Titel_ent = my;
	my.x = 0;
	my.y = 11280;
	my.z = 0;
	my.pan = 90;
	my.material = Normal_mapping;
}

action nouncers()
{
	my.pan = -90;
	my.tilt = 360;
	my.roll = 0;
	my.x = Titel_ent.x;
	my.z = Titel_ent.z;
	while(Titel_ent.y >= 2500)
	{
		if((Titel_ent.y + 1000) <= my.y)
		{
			my.scale_y -= 0.5*time_step;
			my.scale_x -= 0.5*time_step;
			my.scale_z -= 0.5*time_step;
		}
		wait(1);
	}
	ent_remove(my);
}

action titelschrift()
{
	schrift = my;
}
action titelschrift2()
{
	schrift2 = my;
}
action titelschrift3()
{
	schrift3 = my;
}
action star_x()
{
	while(1)
	{
		if(intro_part_1_ende == 1){my.y -= (2*prozentgeber)*time_step;}
		wait(1);
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function texter()
{
	while(Titel_ent.y >= (-8300))
	{
		if(Titel_ent.y <= (-3900))
		{
			if(Titel_ent.y >= (-4000)){titeltextstring = "TXT_1.tga";}
			if(Titel_ent.y >= (-5000)){titeltextstring = "TXT_2.tga";}
			if(Titel_ent.y >= (-6000)){titeltextstring = "TXT_3.tga";}
			if(Titel_ent.y >= (-7000)){titeltextstring = "TXT_4.tga";}
			if(Titel_ent.y >= (-8000)){titeltextstring = "TXT_5.tga";}
			if(Titel_ent.y <= (-8200)){titeltextstring = "leer.tga";}
		}
		wait(1);
	}
}

function camcontroll()
{
	while(1)
	{
		if (key_cul == 1){Titel_ent.pan += 10*time_step;}
		if (key_cur == 1){Titel_ent.pan -= 10*time_step;}
		if (key_r == 1){Titel_ent.pan = 90;}
		if (key_shiftl == 1){speed = 3;}
		if (key_shiftl == 0){speed = 1;}
		wait(5);
	}
}

action galaxy()
{
	my.pan = Titel_ent.pan;
	my.tilt = random(360);
	my.roll = random(360);
	my.flags |= (BRIGHT | PASSABLE);
	while(1)
	{
		if(intro_part_1_ende == 1){my.y -= (2*prozentgeber)*time_step;}
		wait(1);
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//            KAMERA SETUP
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function camera_setting()
{
	camera.x    = Titel_ent.x;   // X
	camera.y    = Titel_ent.y;       // Y
	camera.z    = Titel_ent.z;               // Höhe
	camera.pan  = Titel_ent.pan;     // Zum Spieler drehen
	wait(1);
}

function starter()
{
	texter();
	while(Titel_ent.y >= -11000)
	{
		Titel_ent.y -= 20*time_step;
		wait(1);
	}
	while(Titel_ent.y >= -12000)
	{
		Titel_ent.y -= 20*time_step;
		if(Titel_ent.x != -176){Titel_ent.x -= 2*time_step;}
		if(Titel_ent.z != 64){Titel_ent.z += 1*time_step;}
		schrift2.y = schrift.y + 50;
		schrift3.y = -11860;
		wait(1);
	}
	while(Titel_ent.y >= -13000)
	{
		Titel_ent.y -= 20*time_step;
		schrift2.y = schrift.y + 50;
		schrift3.y = -11860;
		wait(1);
	}
	while(Titel_ent.y >= -13650)
	{
		Titel_ent.y -= (20*prozentgeber)*time_step;
		if(prozentgeber >= 0.1){prozentgeber *= 0.98;}
		schrift2.y = schrift.y + 50;
		schrift3.y = -11860;
		wait(1);
	}
	prozentgeber = 0.5;
	wait(1);
	while(schrift.y <= 13000)
	{
		intro_part_1_ende = 1;
		schrift.y += (2*prozentgeber)*time_step;
		schrift.alpha -= 0.2*prozentgeber;
		schrift.scale_y -= 0.5*prozentgeber;
		schrift.scale_x -= 0.5*prozentgeber;
		
		schrift2.y += (2*prozentgeber)*time_step;
		schrift2.alpha -= 0.2*prozentgeber;
		schrift2.scale_y /= 1.1*prozentgeber;
		
		schrift3.y += (2*prozentgeber)*time_step;
		schrift3.alpha -= 0.2*prozentgeber;
		
		prozentgeber *= 1.02;
		wait(1);
	}
	schrift.y = 14000;
	schrift2.y = 14050;
	wait(-5);
	sys_exit("Titeltest ende!");
}

function randomstars()
{
	while(numbers <= 700)
	{
		var zufall = random(400);
		if (zufall <= 50)
		{
			ent_create("Star_01.tga",vector((-5600+(random(11200))),(-5600+(random(11200))),(-4000+(random(8000)))),star_x);
			numbers += 1;
		}
		if (zufall >= 50 && zufall <= 100)
		{
			ent_create("Star_02.tga",vector((-5600+(random(11200))),(-5600+(random(11200))),(-4000+(random(8000)))),star_x);
			numbers += 1;
		}
		if (zufall >= 100 && zufall <= 380)
		{
			ent_create("Star_03.tga",vector((-5600+(random(11200))),(-5600+(random(11200))),(-4000+(random(8000)))),star_x);
			numbers += 1;
		}
		if (zufall >= 398)
		{
			ent_create("Star_04.tga",vector((-5600+(random(11200))),(-5600+(random(11200))),(-4000+(random(8000)))),galaxy);
			numbers += 1;
		}
		wait(1);
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function main()
{
	fps_max = 60;
	video_mode = 7;
	level_load("Titel_Hauptmenü.WMB");
	wait(2);
	while(key_l ==0)
	{
		wait(1);
	}
	starter();
	randomstars();
	camcontroll();
	camera.tilt = 0;
	camera.roll = 0;
	while(1)
	{
		camera_setting();
		wait(1);
	}
}




EDIT:
Problem is greater.. if i delete the Titelheld() action, the next action gives the same crash..


.
Posted By: Joozey

Re: Crash in... canīt fix it.. - 07/29/08 12:43

Are you sure the shader.c is totaly correct?
Posted By: Espér

Re: Crash in... canīt fix it.. - 07/29/08 12:51

the problem came up before i added the shader.c ...
but here is it:
Code:
MATERIAL* heldenshader_1 =
{
	flags = ENABLE_RENDER;
	effect = "s_P_cartoon.fx";
}

MATERIAL* Hitzewelle =
{
	flags = TANGENT;
	effect = "s_P_heatHaze.fx";
}

MATERIAL* Normal_mapping =
{
	effect = "normalmap.fx";
}

Posted By: Joozey

Re: Crash in... canīt fix it.. - 07/29/08 13:12

Wait, you first wait 3 ticks and then assign the me to Titel_ent. But the nouncers() action gets already loaded and makes use of Titel_ent before you assigned it. Since you only declared an empty pointer (without the = NULL at definition) it will result in a crash.

I always declare my variables with a default value, e.g. ENTITY* Titel_ent = NULL; to prevent crashes. And you should build in a while (Titel_ent == NULL) {wait(1);} check too in nouncers().

Posted By: Espér

Re: Crash in... canīt fix it.. - 07/29/08 13:16

wait.. plz in a normal language and a bit slower again ^^
Iīm german.. so i donīt understand every gramatical sentence you write ^^.. sry

I edited my Script to:

ENTITY* Titel_ent = NULL;
ENTITY* schrift = NULL;
ENTITY* schrift2 = NULL;
ENTITY* schrift3 = NULL;
ENTITY* starry = NULL;


to that while thing..
The Titelheld() and the beginning of Nouncer() are only played once..
not more... just one time..
Posted By: Joozey

Re: Crash in... canīt fix it.. - 07/29/08 14:18

But no crash?

Quote:
The Titelheld() and the beginning of Nouncer() are only played once..
not more... just one time..

Well yeah it's logic that it's only run once. The Titelheld() is not in a loop, so it only is performed one time.

The nouncers() while or if branch probably do not match the conditions (Titel_ent.y + 1000) <= my.y) But I don't know what the values are for that 'my' entity. If it is only ran once and then removed, then obviously it did not stay in the while/if loop.

Posted By: Espér

Re: Crash in... canīt fix it.. - 07/29/08 16:28

ok.. got it..
just a wait in nouncer()īs beginning fixed.. thank s ^^
© 2023 lite-C Forums