Hey guys. I've recently added an enemy in one of my test games and i have been getting a crash.
I have put an enemy on my level in WED, and attached to it a script that make it turn towards the player and move forward, thus moving towards the player. But i keep getting the crash message when the game starts.
This is my code:
Code:
action enemy_action(){
VECTOR* dir; // this will hold the direction towards the player from the enemy
while(1){
vec_diff(dir,player.x,my.x); // set dir towards player
vec_to_angle(my.pan,dir); // set the enemy's pan towards it
c_move(me,vector(3 * time_step,0,0),nullvector,GLIDE); // move forward
wait(1);
}
}
What am i doing wrong? BTW : THIS IS LITE-C NOT C-SCRIPT so do not post up C-Sript codes. Thank you
Re: Help in script! Crashing for no reason.
[Re: Rohiaw]
#270851 06/10/0910:1306/10/0910:13
Your code MUST crash because you're using an empty vector pointer (VECTOR*) and not a vector (VECTOR). Read the manual about the difference between pointers and variables.
Re: Help in script! Crashing for no reason.
[Re: Tobias]
#270861 06/10/0910:4006/10/0910:40