Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
1 registered members (Grant), 999 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Crash in... #298641
11/16/09 17:02
11/16/09 17:02
Joined: Jul 2009
Posts: 15
P
Plasher Offline OP
Newbie
Plasher  Offline OP
Newbie
P

Joined: Jul 2009
Posts: 15
Hey guys,

i have the following problem: i have a enemy script and a common functions script in the enemy script the enemy traces for the players and shoots if he finds one. The shoot function is in the common functions script. thats the code:

Code:
...
c_trace(my.x,vector(my.x+(150*(1+(2*(-my.pan/180)))),my.y,my.z),IGNORE_ME);
   if ((you==e_spieler1)||(you==e_spieler2)) {
      schiessen();	
      you.skill1-=10;	 	
      you=NULL; 
      for (i=0;i<18;i++) {				
          ent_animate(my,"attack",geg_shoot_percentage,ANM_CYCLE); // "walk"-Animationsschleife
           geg_shoot_percentage += 18 * time_step; //3 = Animationsgeschwindigkeit für "walk"
           wait (2);
      }
} 
...



Code:
...
action schuss() //Crashed !!!
{	
  var i=0;
  var richtung;
  richtung=(1+(2*(-e_wer_schiesst.pan/180)));
  while((i<20)&&(me != NULL)) {
    if (c_move(me,vector(5*richtung,0,0),vector(0,0,0), IGNORE_SPRITES | IGNORE_MAPS | IGNORE_PASSENTS | IGNORE_PASSABLE) <= 0) {
	break;
    } 
    i++;
    wait(1);
   }	
   ent_remove(me);		
}

function schiessen()
{
	e_wer_schiesst=me;	
	ent_create("schuss.tga",vector(my.x+(35*(1+(2*(-my.pan/180)))),my.y,my.z+22),schuss);
}



everytime i start the game there is an "chrashed in gegner" error...
i'm pretty sure that the problem is triggered by the "if ((you==e_player1) || (you==e_player2))" but i don't understand why...

please help me

greetz Plasher

Last edited by Plasher; 11/16/09 17:04.
Re: Crash in... [Re: Plasher] #299401
11/23/09 19:30
11/23/09 19:30
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Are you absolutely sure you is not NULL? Try put an error("test"); in the if clause and see where exactly the crash occurs. It's usually a call to a parameter in an empty pointer (you.skill1 while you is NULL) or a division by zero.


Click and join the 3dgs irc community!
Room: #3dgs
Re: Crash in... [Re: Joozey] #299408
11/23/09 21:19
11/23/09 21:19
Joined: Jul 2009
Posts: 15
P
Plasher Offline OP
Newbie
Plasher  Offline OP
Newbie
P

Joined: Jul 2009
Posts: 15
okay.. thanks there where the problem the you where sometimes NULL ... i had to catch it with an if you != NULL clause thanks laugh


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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